aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2012-05-03 21:47:45 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2012-05-03 21:47:45 +0000
commit65d512d10ecd585b72a099c54453831c40d2e4f7 (patch)
treef95f0c0eb5ac8d733e0695c53536f1397049d0b7
parent88f4f86ff03dce4b72a0dbc7366e8469d894b711 (diff)
downloadgcc-65d512d10ecd585b72a099c54453831c40d2e4f7.zip
gcc-65d512d10ecd585b72a099c54453831c40d2e4f7.tar.gz
gcc-65d512d10ecd585b72a099c54453831c40d2e4f7.tar.bz2
re PR target/53199 (__builtin_bswap64 and __builtin_bswap32 generate errors if -mcpu=power6)
[gcc] 2012-05-03 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/53199 * config/rs6000/rs6000.md (bswapdi splitters): If -mavoid-indexed-addresses (or -mcpu=power6 which sets it by default) is used, generate an alternate sequence that does not depend on using indexed addressing. [gcc/testsuite] 2012-05-03 Michael Meissner <meissner@linux.vnet.ibm.com> PR target/53199 * gcc.target/powwerpc/pr53199.c: New file. From-SVN: r187119
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/rs6000/rs6000.md52
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr53199.c50
4 files changed, 111 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8081d80..8907303 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/53199
+ * config/rs6000/rs6000.md (bswapdi splitters): If
+ -mavoid-indexed-addresses (or -mcpu=power6 which sets it by
+ default) is used, generate an alternate sequence that does not
+ depend on using indexed addressing.
+
2012-05-03 Jason Merrill <jason@redhat.com>
* gengtype.c (write_types): Fix warning message.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 3d27169..78e5603 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -2550,7 +2550,18 @@
if (GET_CODE (addr1) == PLUS)
{
emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
- addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
+ if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
+ addr2 = op2;
+ }
+ else
+ addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
+ }
+ else if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
+ addr2 = op2;
}
else
{
@@ -2600,7 +2611,18 @@
if (GET_CODE (addr1) == PLUS)
{
emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
- addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
+ if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
+ addr2 = op2;
+ }
+ else
+ addr2 = gen_rtx_PLUS (Pmode, op2, XEXP (addr1, 1));
+ }
+ else if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
+ addr2 = op2;
}
else
{
@@ -2681,7 +2703,18 @@
if (GET_CODE (addr1) == PLUS)
{
emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
- addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
+ if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
+ addr2 = op2;
+ }
+ else
+ addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
+ }
+ else if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
+ addr2 = op2;
}
else
{
@@ -2726,7 +2759,18 @@
if (GET_CODE (addr1) == PLUS)
{
emit_insn (gen_add3_insn (op2, XEXP (addr1, 0), GEN_INT (4)));
- addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
+ if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, XEXP (addr1, 1), op2));
+ addr2 = op2;
+ }
+ else
+ addr2 = gen_rtx_PLUS (SImode, op2, XEXP (addr1, 1));
+ }
+ else if (TARGET_AVOID_XFORM)
+ {
+ emit_insn (gen_add3_insn (op2, addr1, GEN_INT (4)));
+ addr2 = op2;
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0bdfa09..0395dc7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/53199
+ * gcc.target/powwerpc/pr53199.c: New file.
+
2012-05-03 Jason Merrill <jason@redhat.com>
* g++.dg/debug/dwarf2/nested-3.C: Adjust pattern.
diff --git a/gcc/testsuite/gcc.target/powerpc/pr53199.c b/gcc/testsuite/gcc.target/powerpc/pr53199.c
new file mode 100644
index 0000000..89a0cad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr53199.c
@@ -0,0 +1,50 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O2 -mcpu=power6 -mavoid-indexed-addresses" } */
+/* { dg-final { scan-assembler-times "lwbrx" 6 } } */
+/* { dg-final { scan-assembler-times "stwbrx" 6 } } */
+
+/* PR 51399: bswap gets an error if -mavoid-indexed-addresses was used in
+ creating the two lwbrx instructions. */
+
+long long
+load64_reverse_1 (long long *p)
+{
+ return __builtin_bswap64 (*p);
+}
+
+long long
+load64_reverse_2 (long long *p)
+{
+ return __builtin_bswap64 (p[1]);
+}
+
+long long
+load64_reverse_3 (long long *p, int i)
+{
+ return __builtin_bswap64 (p[i]);
+}
+
+void
+store64_reverse_1 (long long *p, long long x)
+{
+ *p = __builtin_bswap64 (x);
+}
+
+void
+store64_reverse_2 (long long *p, long long x)
+{
+ p[1] = __builtin_bswap64 (x);
+}
+
+void
+store64_reverse_3 (long long *p, long long x, int i)
+{
+ p[i] = __builtin_bswap64 (x);
+}
+
+long long
+reg_reverse (long long x)
+{
+ return __builtin_bswap64 (x);
+}