re PR target/87870 (ppc64le generates poor code when loading constants into TImode...
authorPeter Bergner <bergner@linux.ibm.com>
Mon, 17 Dec 2018 22:07:11 +0000 (22:07 +0000)
committerPeter Bergner <bergner@gcc.gnu.org>
Mon, 17 Dec 2018 22:07:11 +0000 (16:07 -0600)
gcc/
PR target/87870
* config/rs6000/vsx.md (nW): New mode iterator.
(vsx_mov<mode>_64bit): Use it.  Remove redundant GPR 0/-1 alternative.
Update length attribute for (<??r>, <nW>)  alternative.
(vsx_mov<mode>_32bit): Likewise.

gcc/testsuite/
PR target/87870
* gcc.target/powerpc/pr87870.c: New test.

From-SVN: r267221

gcc/ChangeLog
gcc/config/rs6000/vsx.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr87870.c [new file with mode: 0644]

index 0f8708f02c0c88833b936e1cadf11661cb2f505a..625429c31c04889a8112eda7e14bf1610d80f20b 100644 (file)
@@ -1,3 +1,11 @@
+2018-12-17  Peter Bergner  <bergner@linux.ibm.com>
+
+       PR target/87870
+       * config/rs6000/vsx.md (nW): New mode iterator.
+       (vsx_mov<mode>_64bit): Use it.  Remove redundant GPR 0/-1 alternative.
+       Update length attribute for (<??r>, <nW>)  alternative.
+       (vsx_mov<mode>_32bit): Likewise.
+
 2018-12-17  Tom de Vries  <tdevries@suse.de>
 
        * config/nvptx/nvptx.c (PTX_VECTOR_LENGTH, PTX_WORKER_LENGTH,
index 52dee7d9f080fcb1567a2f8cff207e9717dde5a0..65a9892ff9ff89336fe043556503143be40304f4 100644 (file)
                         (TF    "??r")
                         (TI    "r")])
 
+;; A mode attribute used for 128-bit constant values.
+(define_mode_attr nW   [(V16QI "W")
+                        (V8HI  "W")
+                        (V4SI  "W")
+                        (V4SF  "W")
+                        (V2DI  "W")
+                        (V2DF  "W")
+                        (V1TI  "W")
+                        (KF    "W")
+                        (TF    "W")
+                        (TI    "n")])
+
 ;; Same size integer type for floating point data
 (define_mode_attr VSi [(V4SF  "v4si")
                       (V2DF  "v2di")
 
 ;;              VSX store  VSX load   VSX move  VSX->GPR   GPR->VSX    LQ (GPR)
 ;;              STQ (GPR)  GPR load   GPR store GPR move   XXSPLTIB    VSPLTISW
-;;              VSX 0/-1   GPR 0/-1   VMX const GPR const  LVX (VMX)   STVX (VMX)
+;;              VSX 0/-1   VMX const  GPR const LVX (VMX)  STVX (VMX)
 (define_insn "vsx_mov<mode>_64bit"
   [(set (match_operand:VSX_M 0 "nonimmediate_operand"
                "=ZwO,      <VSa>,     <VSa>,     r,         we,        ?wQ,
                 ?&r,       ??r,       ??Y,       <??r>,     wo,        v,
-                ?<VSa>,    *r,        v,         ??r,       wZ,        v")
+                ?<VSa>,    v,         <??r>,     wZ,        v")
 
        (match_operand:VSX_M 1 "input_operand" 
                "<VSa>,     ZwO,       <VSa>,     we,        r,         r,
                 wQ,        Y,         r,         r,         wE,        jwM,
-                ?jwM,      jwM,       W,         W,         v,         wZ"))]
+                ?jwM,      W,         <nW>,      v,         wZ"))]
 
   "TARGET_POWERPC64 && VECTOR_MEM_VSX_P (<MODE>mode)
    && (register_operand (operands[0], <MODE>mode) 
   [(set_attr "type"
                "vecstore,  vecload,   vecsimple, mffgpr,    mftgpr,    load,
                 store,     load,      store,     *,         vecsimple, vecsimple,
-                vecsimple, *,         *,         *,         vecstore,  vecload")
+                vecsimple, *,         *,         vecstore,  vecload")
 
    (set_attr "length"
                "4,         4,         4,         8,         4,         8,
                 8,         8,         8,         8,         4,         4,
-                4,         8,         20,        20,        4,         4")])
+                4,         20,        8,         4,         4")])
 
 ;;              VSX store  VSX load   VSX move   GPR load   GPR store  GPR move
-;;              XXSPLTIB   VSPLTISW   VSX 0/-1   GPR 0/-1   VMX const  GPR const
+;;              XXSPLTIB   VSPLTISW   VSX 0/-1   VMX const  GPR const
 ;;              LVX (VMX)  STVX (VMX)
 (define_insn "*vsx_mov<mode>_32bit"
   [(set (match_operand:VSX_M 0 "nonimmediate_operand"
                "=ZwO,      <VSa>,     <VSa>,     ??r,       ??Y,       <??r>,
-                wo,        v,         ?<VSa>,    *r,        v,         ??r,
+                wo,        v,         ?<VSa>,    v,         <??r>,
                 wZ,        v")
 
        (match_operand:VSX_M 1 "input_operand" 
                "<VSa>,     ZwO,       <VSa>,     Y,         r,         r,
-                wE,        jwM,       ?jwM,      jwM,       W,         W,
+                wE,        jwM,       ?jwM,      W,         <nW>,
                 v,         wZ"))]
 
   "!TARGET_POWERPC64 && VECTOR_MEM_VSX_P (<MODE>mode)
 }
   [(set_attr "type"
                "vecstore,  vecload,   vecsimple, load,      store,    *,
-                vecsimple, vecsimple, vecsimple, *,         *,        *,
+                vecsimple, vecsimple, vecsimple, *,         *,
                 vecstore,  vecload")
 
    (set_attr "length"
                "4,         4,         4,         16,        16,        16,
-                4,         4,         4,         16,        20,        32,
+                4,         4,         4,         20,        16,
                 4,         4")])
 
 ;; Explicit  load/store expanders for the builtin functions
index 50ff5322a4beff0fc1d0aa18387bd0f1fd81342f..77787b2c8c79959cef7a7f7af96a66b2a0269793 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-17  Peter Bergner  <bergner@linux.ibm.com>
+
+       PR target/87870
+       * gcc.target/powerpc/pr87870.c: New test.
+
 2018-12-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/88410
diff --git a/gcc/testsuite/gcc.target/powerpc/pr87870.c b/gcc/testsuite/gcc.target/powerpc/pr87870.c
new file mode 100644 (file)
index 0000000..d2108ac
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-options "-O2" } */
+
+__int128
+test0 (void)
+{
+  return 0;
+}
+
+__int128
+test1 (void)
+{
+  return 1;
+}
+
+__int128
+test2 (void)
+{
+  return -1;
+}
+
+__int128
+test3 (void)
+{
+  return ((__int128)0xdeadbeefcafebabe << 64) | 0xfacefeedbaaaaaad;
+}
+
+/* { dg-final { scan-assembler-not {\mld\M} } } */