]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[ARC] Don't use drsub* instructions when selecting fpuda.
authorClaudiu Zissulescu <claziss@synopsys.com>
Thu, 28 Apr 2016 12:15:06 +0000 (14:15 +0200)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Thu, 28 Apr 2016 12:15:06 +0000 (14:15 +0200)
The double precision floating point assist instructions are not
implementing the reverse double subtract instruction (drsub) found in
the FPX extension.

gcc/
2016-04-28  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.md (cpu_facility): Add fpx variant.
(subdf3): Prohibit use reverse sub when assist operations option
is enabled.
* config/arc/fpx.md (subdf3_insn, *dsubh_peep2_insn): Allow drsub
instructions only when FPX is enabled.
        * testsuite/gcc.target/arc/trsub.c: New test.

From-SVN: r235562

gcc/ChangeLog
gcc/config/arc/arc.md
gcc/config/arc/fpx.md
gcc/testsuite/gcc.target/arc/trsub.c [new file with mode: 0644]

index bfe7b833a49aa76efbf95d8894a81828bda27633..40258635363b12fee79ba0bbb139a3430014705f 100644 (file)
@@ -1,3 +1,12 @@
+2016-04-28  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * config/arc/arc.md (cpu_facility): Add fpx variant.
+       (subdf3): Prohibit use reverse sub when assist operations option
+       is enabled.
+       * config/arc/fpx.md (subdf3_insn, *dsubh_peep2_insn): Allow drsub
+       instructions only when FPX is enabled.
+       * testsuite/gcc.target/arc/trsub.c: New test.
+
 2016-04-28  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (*fop_<mode>_1_mixed): Do not check for
index 4a7287b053654618ddff115356646d2bb86c9dc1..a58b491355a9dc1ca834c8c17d9296a6d877306c 100644 (file)
                     - get_attr_length (insn)")))
 
 ; for ARCv2 we need to disable/enable different instruction alternatives
-(define_attr "cpu_facility" "std,av1,av2"
+(define_attr "cpu_facility" "std,av1,av2,fpx"
   (const_string "std"))
 
 ; We should consider all the instructions enabled until otherwise
         (and (eq_attr "cpu_facility" "av2")
              (not (match_test "TARGET_V2")))
         (const_string "no")
+
+        (and (eq_attr "cpu_facility" "fpx")
+             (match_test "TARGET_FP_DP_AX"))
+        (const_string "no")
         ]
        (const_string "yes")))
 
   "
    if (TARGET_DPFP)
     {
+     if (TARGET_FP_DP_AX && (GET_CODE (operands[1]) == CONST_DOUBLE))
+       operands[1] = force_reg (DFmode, operands[1]);
      if ((GET_CODE (operands[1]) == CONST_DOUBLE)
           || GET_CODE (operands[2]) == CONST_DOUBLE)
       {
index b7906003748955960f38a20f7a53d5947ed2c56b..2e11157cabfbd0f87b80d2249fac12f6a46ddb7f 100644 (file)
      drsubh%F0%F2 0,%H1,%L1
      drsubh%F0%F2 0,%3,%L1"
   [(set_attr "type" "dpfp_addsub")
-  (set_attr "length" "4,8,4,8")])
+   (set_attr "length" "4,8,4,8")
+   (set_attr "cpu_facility" "*,*,fpx,fpx")])
 
 ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; ;; Peephole for following conversion
   drsubh%F0%F2 %H6, %H1, %L1
   drsubh%F0%F2 %H6, %3, %L1"
  [(set_attr "type" "dpfp_addsub")
-  (set_attr "length" "4,8,4,8")]
-)
+  (set_attr "length" "4,8,4,8")
+  (set_attr "cpu_facility" "*,*,fpx,fpx")])
diff --git a/gcc/testsuite/gcc.target/arc/trsub.c b/gcc/testsuite/gcc.target/arc/trsub.c
new file mode 100644 (file)
index 0000000..031935f
--- /dev/null
@@ -0,0 +1,10 @@
+/* Tests if we generate rsub instructions when compiling using
+   floating point assist instructions.  */
+/* { dg-do compile } */
+/* { dg-options "-mfpu=fpuda -mcpu=arcem" } */
+
+double foo (double a)
+{
+  return ((double) 0.12 - a);
+}
+/* { dg-final { scan-assembler-not "drsub.*" } } */