rs6000: Various fixes for the new fpscr builtins (PR87509)
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 5 Oct 2018 10:52:33 +0000 (12:52 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Fri, 5 Oct 2018 10:52:33 +0000 (12:52 +0200)
With these fixes all testcases test clean for me, both on
powerpc64-linux {-m32,-m64} and on powerpc64le-linux, with all
relevant -mcpu= settings.

PR target/87509
* config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_SET_FPSCR_DRN): Use
RS6000_BTM_DFP.
* config/rs6000/rs6000.md (rs6000_set_fpscr_rn): Require the operand
to be DImode.  When using mffscrn, force the operand to a register.

gcc/testsuite/
PR target/87509
* gcc.target/powerpc/test_fpscr_drn_builtin.c: Use hard_dfp instead
of dfp_hw.  Don't include <altivec.h>.
* gcc.target/powerpc/test_fpscr_drn_builtin_error.c: Ditto.  Require
lp64.
* gcc.target/powerpc/test_fpscr_rn_builtin.c: Don't include <altivec.h>.
* gcc.target/powerpc/test_fpscr_rn_builtin_error.c: Ditto.
* gcc.target/powerpc/test_mffsl.c: Ditto.

From-SVN: r264863

gcc/ChangeLog
gcc/config/rs6000/rs6000-builtin.def
gcc/config/rs6000/rs6000.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/test_fpscr_drn_builtin.c
gcc/testsuite/gcc.target/powerpc/test_fpscr_drn_builtin_error.c
gcc/testsuite/gcc.target/powerpc/test_fpscr_rn_builtin.c
gcc/testsuite/gcc.target/powerpc/test_fpscr_rn_builtin_error.c
gcc/testsuite/gcc.target/powerpc/test_mffsl.c

index 9504cfe74e27bd521a69cda79abebc8e011f7896..e5575fe99855156a68e963a96911c1ab80a6cd69 100644 (file)
@@ -1,3 +1,11 @@
+2018-10-05  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/87509
+       * config/rs6000/rs6000-builtin.def (RS6000_BUILTIN_SET_FPSCR_DRN): Use
+       RS6000_BTM_DFP.
+       * config/rs6000/rs6000.md (rs6000_set_fpscr_rn): Require the operand
+       to be DImode.  When using mffscrn, force the operand to a register.
+
 2018-10-04  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (*fop_<X87MODEF:mode>_2_i387): Macroize insn
index 976c36b252ef1552df70f35b01d0fd2d62fc59dd..ec0528a7ac308154ab1e1bfe7780de704aeeaa5e 100644 (file)
@@ -2510,7 +2510,7 @@ RS6000_BUILTIN_X (RS6000_BUILTIN_SET_FPSCR_RN, "__builtin_set_fpscr_rn",
                  CODE_FOR_rs6000_set_fpscr_rn)
 
 RS6000_BUILTIN_X (RS6000_BUILTIN_SET_FPSCR_DRN, "__builtin_set_fpscr_drn",
-                 RS6000_BTM_ALWAYS,
+                 RS6000_BTM_DFP,
                  RS6000_BTC_MISC | RS6000_BTM_64BIT | RS6000_BTC_UNARY
                  | RS6000_BTC_VOID,
                  CODE_FOR_rs6000_set_fpscr_drn)
index 31a74ca735a19770ac33fef96bdfe580b1953ec1..5db3e57f347ce100f1bf7d5d44e3eb99058487a7 100644 (file)
   [(set_attr "type" "fp")])
 
 (define_expand "rs6000_set_fpscr_rn"
- [(match_operand 0 "reg_or_cint_operand")]
+ [(match_operand:DI 0 "reg_or_cint_operand")]
   "TARGET_HARD_FLOAT"
 {
   rtx tmp_df = gen_reg_rtx (DFmode);
      new rounding mode bits from operands[0][62:63] into FPSCR[62:63].  */
   if (TARGET_P9_MISC)
     {
-      rtx src_df = gen_reg_rtx (DImode);
-
-      src_df = simplify_gen_subreg (DFmode, operands[0], DImode, 0);
+      rtx src_df = force_reg (DImode, operands[0]);
+      src_df = simplify_gen_subreg (DFmode, src_df, DImode, 0);
       emit_insn (gen_rs6000_mffscrn (tmp_df, src_df));
       DONE;
     }
index 1e0029b1b6d7d8d5eba8ee23ef116052ffb7dd8f..d621194739f2df81a2c07be184c9fac62796562e 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-05  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR target/87509
+       * gcc.target/powerpc/test_fpscr_drn_builtin.c: Use hard_dfp instead
+       of dfp_hw.  Don't include <altivec.h>.
+       * gcc.target/powerpc/test_fpscr_drn_builtin_error.c: Ditto.  Require
+       lp64.
+       * gcc.target/powerpc/test_fpscr_rn_builtin.c: Don't include <altivec.h>.
+       * gcc.target/powerpc/test_fpscr_rn_builtin_error.c: Ditto.
+       * gcc.target/powerpc/test_mffsl.c: Ditto.
+
 2018-10-04  Vinay Kumar  <vinay.kumar@blackfigtech.com>
 
        * c-c++-common/Wprio-ctor-dtor.c: New test.
index 685bf97d70561b09e9882e956cf2c1dc89afb4cb..00b11f867bac09911bbaa88b52dc1ae062261d4c 100644 (file)
@@ -1,9 +1,7 @@
 /* { dg-do run { target { powerpc*-*-* &&  lp64 } } } */
-/* { dg-require-effective-target dfp_hw } */
+/* { dg-require-effective-target hard_dfp } */
 /* { dg-options "-O2 -std=c99" } */
 
-#include <altivec.h>
-
 #ifdef DEBUG
 #include <stdio.h>
 #endif
index 58453f0534d59aa6b18b1a816f438d168730971f..028ab0b6d6670cba9d7f60fffca6555c7ea0f2bf 100644 (file)
@@ -1,9 +1,7 @@
-/* { dg-do compile { target powerpc*-*-* } } */
-/* { dg-require-effective-target dfp_hw } */
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-require-effective-target hard_dfp } */
 /* { dg-options "-O2 -std=c99" } */
 
-#include <altivec.h>
-
 int main ()
 {
 
index be05dcf39f4e28585b86685cec725e5658681ebb..0d0d3f0f96b04bc98bc23378a1448c9c42e5809a 100644 (file)
@@ -1,8 +1,6 @@
 /* { dg-do run { target { powerpc*-*-* } } } */
 /* { dg-options "-O2 -std=c99" } */
 
-#include <altivec.h>
-
 #ifdef DEBUG
 #include <stdio.h>
 #endif
index a529ce6158de941317f0f2bdaf5cf1829c0d8588..aea65091b0c4639171485d7322c282a1d7db6270 100644 (file)
@@ -1,8 +1,6 @@
 /* { dg-do compile { target powerpc*-*-* } } */
 /* { dg-options "-O2 -std=c99" } */
 
-#include <altivec.h>
-
 int main ()
 {
 
index 278dfbfcefe9ff451c1feb127aa17a15cadbb7b5..93a8ec245160ad645f196d6f7a5141b335efe1cd 100644 (file)
@@ -1,8 +1,6 @@
 /* { dg-do run { target { powerpc*-*-* } } } */
 /* { dg-options "-O2 -std=c99" } */
 
-#include <altivec.h>
-
 #ifdef DEBUG
 #include <stdio.h>
 #endif