]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/60137 (Code fails with -mcpu=power8 -O3 -mno-vsx)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 4 Apr 2014 15:02:38 +0000 (15:02 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Fri, 4 Apr 2014 15:02:38 +0000 (15:02 +0000)
[gcc]

2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline r207699.
2014-02-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/60137
* config/rs6000/rs6000.md (128-bit GPR splitter): Add a splitter
for VSX/Altivec vectors that land in GPR registers.

Backport from mainline r207808.
2014-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/60203
* config/rs6000/rs6000.md (rreg): Add TFmode, TDmode constraints.
(mov<mode>_internal, TFmode/TDmode): Split TFmode/TDmode moves
into 64-bit and 32-bit moves.  On 64-bit moves, add support for
using direct move instructions on ISA 2.07.  Also adjust
instruction length for 64-bit.
(mov<mode>_64bit, TFmode/TDmode): Likewise.
(mov<mode>_32bit, TFmode/TDmode): Likewise.

Backport from mainline r207868.
2014-02-18  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/60203
* config/rs6000/rs6000.md (mov<mode>_64bit, TF/TDmode moves):
Split 64-bit moves into 2 patterns.  Do not allow the use of
direct move for TDmode in little endian, since the decimal value
has little endian bytes within a word, but the 64-bit pieces are
ordered in a big endian fashion, and normal subreg's of TDmode are
not allowed.
(mov<mode>_64bit_dm): Likewise.
(movtd_64bit_nodm): Likewise.

[gcc/testsuite]

2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

Backport from mainline r207699.
2014-02-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/60137
* gcc.target/powerpc/pr60137.c: New file.

Backport from mainline r207808.
2014-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/60203
* gcc.target/powerpc/pr60203.c: New testsuite.

From-SVN: r209111

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

index 48c07a936877337c2298d03ba6469eae95c57ebd..73e605fb27766f079839dbeccb854482c36f98f6 100644 (file)
@@ -1,3 +1,37 @@
+2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline r207699.
+       2014-02-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/60137
+       * config/rs6000/rs6000.md (128-bit GPR splitter): Add a splitter
+       for VSX/Altivec vectors that land in GPR registers.
+
+       Backport from mainline r207808.
+       2014-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/60203
+       * config/rs6000/rs6000.md (rreg): Add TFmode, TDmode constraints.
+       (mov<mode>_internal, TFmode/TDmode): Split TFmode/TDmode moves
+       into 64-bit and 32-bit moves.  On 64-bit moves, add support for
+       using direct move instructions on ISA 2.07.  Also adjust
+       instruction length for 64-bit.
+       (mov<mode>_64bit, TFmode/TDmode): Likewise.
+       (mov<mode>_32bit, TFmode/TDmode): Likewise.
+
+       Backport from mainline r207868.
+       2014-02-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/60203
+       * config/rs6000/rs6000.md (mov<mode>_64bit, TF/TDmode moves):
+       Split 64-bit moves into 2 patterns.  Do not allow the use of
+       direct move for TDmode in little endian, since the decimal value
+       has little endian bytes within a word, but the 64-bit pieces are
+       ordered in a big endian fashion, and normal subreg's of TDmode are
+       not allowed.
+       (mov<mode>_64bit_dm): Likewise.
+       (movtd_64bit_nodm): Likewise.
+
 2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline r207658
index ea8776429caa3283e8ba4bfd8d250cecc1448a51..bb1e87640384d1d7eadd66bfc58dd771e5280a24 100644 (file)
 
 (define_mode_attr rreg [(SF   "f")
                        (DF   "ws")
+                       (TF   "f")
+                       (TD   "f")
                        (V4SF "wf")
                        (V2DF "wd")])
 
 ;; It's important to list Y->r and r->Y before r->r because otherwise
 ;; reload, given m->r, will try to pick r->r and reload it, which
 ;; doesn't make progress.
-(define_insn_and_split "*mov<mode>_internal"
+
+;; We can't split little endian direct moves of TDmode, because the words are
+;; not swapped like they are for TImode or TFmode.  Subregs therefore are
+;; problematical.  Don't allow direct move for this case.
+
+(define_insn_and_split "*mov<mode>_64bit_dm"
+  [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r,r,wm")
+       (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r,wm,r"))]
+  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64
+   && (<MODE>mode != TDmode || WORDS_BIG_ENDIAN)
+   && (gpc_reg_operand (operands[0], <MODE>mode)
+       || gpc_reg_operand (operands[1], <MODE>mode))"
+  "#"
+  "&& reload_completed"
+  [(pc)]
+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
+  [(set_attr "length" "8,8,8,12,12,8,8,8")])
+
+(define_insn_and_split "*movtd_64bit_nodm"
+  [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
+       (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
+  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_POWERPC64 && !WORDS_BIG_ENDIAN
+   && (gpc_reg_operand (operands[0], TDmode)
+       || gpc_reg_operand (operands[1], TDmode))"
+  "#"
+  "&& reload_completed"
+  [(pc)]
+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
+  [(set_attr "length" "8,8,8,12,12,8")])
+
+(define_insn_and_split "*mov<mode>_32bit"
   [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
        (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
-  "TARGET_HARD_FLOAT && TARGET_FPRS
+  "TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_POWERPC64
    && (gpc_reg_operand (operands[0], <MODE>mode)
        || gpc_reg_operand (operands[1], <MODE>mode))"
   "#"
   [(set_attr "length" "12")
    (set_attr "type" "three")])
 
+(define_split
+  [(set (match_operand:FMOVE128_GPR 0 "nonimmediate_operand" "")
+       (match_operand:FMOVE128_GPR 1 "input_operand" ""))]
+  "reload_completed
+   && (int_reg_operand (operands[0], <MODE>mode)
+       || int_reg_operand (operands[1], <MODE>mode))"
+  [(pc)]
+{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
+
 ;; Move SFmode to a VSX from a GPR register.  Because scalar floating point
 ;; type is stored internally as double precision in the VSX registers, we have
 ;; to convert it from the vector format.
index d07a6f13e6d7a23c1303b55287ea6de28776f8f0..4c2d92ec24ffcc47f14f556656f839a952cd7c9b 100644 (file)
@@ -1,3 +1,17 @@
+2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       Backport from mainline r207699.
+       2014-02-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/60137
+       * gcc.target/powerpc/pr60137.c: New file.
+
+       Backport from mainline r207808.
+       2014-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/60203
+       * gcc.target/powerpc/pr60203.c: New testsuite.
+
 2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Little Endian Vector API Support
diff --git a/gcc/testsuite/gcc.target/powerpc/pr60137.c b/gcc/testsuite/gcc.target/powerpc/pr60137.c
new file mode 100644 (file)
index 0000000..4777a53
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8 -O3 -mno-vsx" } */
+
+/* target/60137, compiler got a 'could not split insn error'.  */
+
+extern int target_flags;
+extern char fixed_regs[53];
+extern char call_used_regs[53];
+
+void init_reg_sets_1(void)
+{
+  int i;
+  for (i = 0; i < 53; i++)
+    fixed_regs[i] = call_used_regs[i] = (call_used_regs[i] &((target_flags & 0x02000000) ? 2 : 1)) != 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr60203.c b/gcc/testsuite/gcc.target/powerpc/pr60203.c
new file mode 100644 (file)
index 0000000..6a4b4fa
--- /dev/null
@@ -0,0 +1,40 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8 -O3" } */
+
+union u_ld { long double ld; double d[2]; };
+
+long double
+pack (double a, double aa)
+{
+  union u_ld u;
+  u.d[0] = a;
+  u.d[1] = aa;
+  return u.ld;
+}
+
+double
+unpack_0 (long double x)
+{
+  union u_ld u;
+  u.ld = x;
+  return u.d[0];
+}
+
+double
+unpack_1 (long double x)
+{
+  union u_ld u;
+  u.ld = x;
+  return u.d[1];
+}
+
+/* { dg-final { scan-assembler-not "stfd"   } } */
+/* { dg-final { scan-assembler-not "lfd"    } } */
+/* { dg-final { scan-assembler-not "lxsdx"  } } */
+/* { dg-final { scan-assembler-not "stxsdx" } } */
+/* { dg-final { scan-assembler-not "mfvsrd" } } */
+/* { dg-final { scan-assembler-not "mtvsrd" } } */
+
+