On Thu, 2012-11-08 at 17:40 -0500, Peter Gavin wrote: > > I was just wondering if there's a real implementation that actually > implements the l.mul and l.mulu instructions correctly, including the > OV and CY flags, and if any software actually uses them.
Hi Pete, I thought Or1ksim got this right? > > GCC doesn't use them (from a quick glance at the or1k.md), so if > anyone actually uses them it would have to be assembly code. And (as we have found out the hard way), you would be amazed at how much hand-coded assembler is out there. BTW have you looked at whether these instructions are used in the GCC library routines? > Would anyone be bothered if the CY flag was never set by the l.mul and > l.mulu instructions, and instead, the OV flag was set for signed > overflow in the case of l.mul, and for unsigned overflow in the case > of l.mulu? It sounds like you are fixing the wrong problem. It should be the case that CY is used for unsigned overflow and OV for 2's complement overflow. These flags should be set by arithmetic, but not logical instructions. IIUC, you want to make l.mulu (only) use the OV flag for unsigned overflow, because it then allows you to use the OVE flag to control exception handling. Surely the correct thing if you need fine-grained control of both signed and unsigned overflow is to add a CYE flag? Best wishes, Jeremy -- Tel: +44 (1590) 610184 Cell: +44 (7970) 676050 SkypeID: jeremybennett Email: [email protected] Web: www.embecosm.com _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
