csky.md (*fpuv2_nmulsf3_1, [...]): Handle -frounding-math.
authorXianmiao Qu <xianmiao_qu@c-sky.com>
Mon, 12 Nov 2018 02:36:45 +0000 (02:36 +0000)
committerXianmiao Qu <xianmiao@gcc.gnu.org>
Mon, 12 Nov 2018 02:36:45 +0000 (02:36 +0000)
2018-11-11  Xianmiao Qu  <xianmiao_qu@c-sky.com>

gcc/
* config/csky/csky.md (*fpuv2_nmulsf3_1, *fpuv2_nmuldf3_1): Handle
-frounding-math.

gcc/testsuite
* gcc.target/csky/fnmul-1.c: New.
* gcc.target/csky/fnmul-2.c: New.
* gcc.target/csky/fnmul-3.c: New.
* gcc.target/csky/fnmul-4.c: New.

From-SVN: r266024

gcc/ChangeLog
gcc/config/csky/csky_insn_fpu.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/csky/fnmul-1.c [new file with mode: 0755]
gcc/testsuite/gcc.target/csky/fnmul-2.c [new file with mode: 0755]
gcc/testsuite/gcc.target/csky/fnmul-3.c [new file with mode: 0755]
gcc/testsuite/gcc.target/csky/fnmul-4.c [new file with mode: 0755]

index 958cff19e894f3ce3b8c85f463b11787c9456c58..066ef79f51d3a6d9c057c8bc31be8f90356869b1 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-11  Xianmiao Qu  <xianmiao_qu@c-sky.com>
+
+       * config/csky/csky.md (*fpuv2_nmulsf3_1, *fpuv2_nmuldf3_1): Handle
+       -frounding-math.
+
 2018-11-11  Sandra Loosemore  <sandra@codesourcery.com>
 
        PR c++/43105
index d188ef24bc7a42513e6f37e2776e74d83ca96e37..0598203e48f3084ba6aac336ad9a49d17efb8e35 100644 (file)
   [(set (match_operand:SF                 0 "register_operand" "=v")
        (mult:SF (neg:SF (match_operand:SF 1 "register_operand" "%v"))
                 (match_operand:SF         2 "register_operand" "v")))]
-  "CSKY_ISA_FEATURE (fpv2_sf)"
+  "CSKY_ISA_FEATURE (fpv2_sf) && !flag_rounding_math"
   "fnmuls\t%0, %1, %2")
 
 (define_insn "*fpuv2_nmulsf3_2"
   [(set (match_operand:DF                 0 "register_operand" "=v")
        (mult:DF (neg:DF (match_operand:DF 1 "register_operand" "%v"))
                 (match_operand:DF         2 "register_operand" "v")))]
- "CSKY_ISA_FEATURE (fpv2_df)"
+ "CSKY_ISA_FEATURE (fpv2_df) && !flag_rounding_math"
  "fnmuld\t%0, %1, %2")
 
 (define_insn "*fpuv2_nmuldf3_2"
index dd2cc13ccfc4185ed23d3034d665e51acc3bd717..31ad101796cfab4b9151c4e7ed19eeaaaff75c02 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-11  Xianmiao Qu  <xianmiao_qu@c-sky.com>
+
+       * gcc.target/csky/fnmul-1.c: New.
+       * gcc.target/csky/fnmul-2.c: New.
+       * gcc.target/csky/fnmul-3.c: New.
+       * gcc.target/csky/fnmul-4.c: New.
+
 2018-11-11  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/87928
diff --git a/gcc/testsuite/gcc.target/csky/fnmul-1.c b/gcc/testsuite/gcc.target/csky/fnmul-1.c
new file mode 100755 (executable)
index 0000000..7e4f77a
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -a * b;
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -a * b;
+}
+
diff --git a/gcc/testsuite/gcc.target/csky/fnmul-2.c b/gcc/testsuite/gcc.target/csky/fnmul-2.c
new file mode 100755 (executable)
index 0000000..f12ebc1
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2 -frounding-math" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnegd" } } */
+  /* { dg-final { scan-assembler "fmuld" } } */
+  return -a * b;
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnegs" } } */
+  /* { dg-final { scan-assembler "fmuls" } } */
+  return -a * b;
+}
+
diff --git a/gcc/testsuite/gcc.target/csky/fnmul-3.c b/gcc/testsuite/gcc.target/csky/fnmul-3.c
new file mode 100755 (executable)
index 0000000..558e23c
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -(a * b);
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -(a * b);
+}
+
diff --git a/gcc/testsuite/gcc.target/csky/fnmul-4.c b/gcc/testsuite/gcc.target/csky/fnmul-4.c
new file mode 100755 (executable)
index 0000000..fa186bb
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2 -frounding-math" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -(a * b);
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -(a * b);
+}
+