aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/sh/ChangeLog5
-rw-r--r--sim/sh/gencode.c19
2 files changed, 21 insertions, 3 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 08db573..7d6cf91 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-14 Oleg Endo <olegendo@gcc.gnu.org> (tiny patch)
+
+ * gencode.c (fabs, fneg): Implement as integer operation
+ instead of using the FP_UNARY macro.
+
2014-08-19 Alan Modra <amodra@gmail.com>
* configure: Regenerate.
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 738b718..bc65604 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -429,8 +429,14 @@ op tab[] =
/* sh2e */
{ "", "", "fabs <FREG_N>", "1111nnnn01011101",
- "FP_UNARY (n, fabs);",
- "/* FIXME: FR (n) &= 0x7fffffff; */",
+ " union",
+ " {",
+ " unsigned int i;",
+ " float f;",
+ " } u;",
+ " u.f = FR (n);",
+ " u.i &= 0x7fffffff;",
+ " SET_FR (n, u.f);",
},
/* sh2e */
@@ -662,7 +668,14 @@ op tab[] =
/* sh2e */
{ "", "", "fneg <FREG_N>", "1111nnnn01001101",
- "FP_UNARY (n, -);",
+ " union",
+ " {",
+ " unsigned int i;",
+ " float f;",
+ " } u;",
+ " u.f = FR (n);",
+ " u.i ^= 0x80000000;",
+ " SET_FR (n, u.f);",
},
/* sh4a */