[SH] Correct fabs and fneg insns in simulator

Oleg Endo oleg.endo@t-online.de
Mon Oct 13 23:39:00 GMT 2014


Hi,

It seems that the implementation of the SH fabs and fneg insns in the
simulator is not correct.  They use the FP_UNARY macro which checks the
FPSCR.PR setting and raises an exception if PR = 1 (double precision)
and the register number is not even (i.e. a valid DF reg number).
For normal unary FP insns this is fine.  However, fneg and fabs perform
the same (integer) operations regardless of the FPSCR.PR setting.

This issue initially popped up here
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63260

I've checked some of the failing tests mentioned in GCC PR 63260 above
with the patch applied and the failures go away.

Could somebody please apply it if it's OK?

I'm not subscribed to gdb-patches, please CC me when replying.

Cheers,
Oleg

sim/ChangeLog:

2014-10-14  Oleg Endo <olegendo@gcc.gnu.org>

	* sh/gencode.c (fabs, fneg): Implement as integer operation 
	instead of using the FP_UNARY macro.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sh_sim_fneg_fabs.patch
Type: text/x-patch
Size: 805 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20141013/94ef1aed/attachment.bin>


More information about the Gdb-patches mailing list