aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-11-02 09:03:02 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-11-02 09:03:02 +0100
commite217d64f150ed7940e9ffe84f38a090ad777b0d3 (patch)
treed8ebde5b69d103dd535d8c01fdca060ef9c3dcb0
parent073deae69594e1277e5b9577b99fc07db325d3f2 (diff)
downloadgcc-e217d64f150ed7940e9ffe84f38a090ad777b0d3.zip
gcc-e217d64f150ed7940e9ffe84f38a090ad777b0d3.tar.gz
gcc-e217d64f150ed7940e9ffe84f38a090ad777b0d3.tar.bz2
re PR target/55147 (x86: wrong code for 64-bit load)
PR target/55147 * config/i386/i386.md (bswapdi2): Limit to TARGET_64BIT. (*bswapdi2_doubleword): Removed. * gcc.target/i386/pr55147.c: New test. From-SVN: r193090
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.md49
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr55147.c25
4 files changed, 38 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63db1eb..64fe31a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/55147
+ * config/i386/i386.md (bswapdi2): Limit to TARGET_64BIT.
+ (*bswapdi2_doubleword): Removed.
+
2012-11-02 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (Specific): Remove moxie web reference.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 538120c..61d3ccd 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -12669,55 +12669,10 @@
(define_expand "bswapdi2"
[(set (match_operand:DI 0 "register_operand")
(bswap:DI (match_operand:DI 1 "nonimmediate_operand")))]
- ""
-{
- if (TARGET_64BIT && !TARGET_MOVBE)
- operands[1] = force_reg (DImode, operands[1]);
-})
-
-(define_insn_and_split "*bswapdi2_doubleword"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m")
- (bswap:DI
- (match_operand:DI 1 "nonimmediate_operand" "0,m,r")))]
- "!TARGET_64BIT
- && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
- "#"
- "&& reload_completed"
- [(set (match_dup 2)
- (bswap:SI (match_dup 1)))
- (set (match_dup 0)
- (bswap:SI (match_dup 3)))]
+ "TARGET_64BIT"
{
- split_double_mode (DImode, &operands[0], 2, &operands[0], &operands[2]);
-
- if (REG_P (operands[0]) && REG_P (operands[1]))
- {
- emit_insn (gen_swapsi (operands[0], operands[2]));
- emit_insn (gen_bswapsi2 (operands[0], operands[0]));
- emit_insn (gen_bswapsi2 (operands[2], operands[2]));
- DONE;
- }
-
if (!TARGET_MOVBE)
- {
- if (MEM_P (operands[0]))
- {
- emit_insn (gen_bswapsi2 (operands[3], operands[3]));
- emit_insn (gen_bswapsi2 (operands[1], operands[1]));
-
- emit_move_insn (operands[0], operands[3]);
- emit_move_insn (operands[2], operands[1]);
- }
- if (MEM_P (operands[1]))
- {
- emit_move_insn (operands[2], operands[1]);
- emit_move_insn (operands[0], operands[3]);
-
- emit_insn (gen_bswapsi2 (operands[2], operands[2]));
- emit_insn (gen_bswapsi2 (operands[0], operands[0]));
- }
- DONE;
- }
+ operands[1] = force_reg (DImode, operands[1]);
})
(define_expand "bswapsi2"
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 735d109..b161d58 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/55147
+ * gcc.target/i386/pr55147.c: New test.
+
2012-11-01 David Edelsohn <dje.gcc@gmail.com>
* gfortran.dg/default_format_1.f90: XFAIL on AIX.
diff --git a/gcc/testsuite/gcc.target/i386/pr55147.c b/gcc/testsuite/gcc.target/i386/pr55147.c
new file mode 100644
index 0000000..5be02f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr55147.c
@@ -0,0 +1,25 @@
+/* PR target/55147 */
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+/* { dg-additional-options "-march=i486" { target ia32 } } */
+
+extern void abort (void);
+
+__attribute__((noclone, noinline)) unsigned int
+foo (unsigned long long *p, int i)
+{
+ return __builtin_bswap64 (p[i]);
+}
+
+int
+main ()
+{
+ unsigned long long p[64];
+ int i;
+ for (i = 0; i < 64; i++)
+ p[i] = 0x123456789abcdef0ULL ^ (1ULL << i) ^ (1ULL << (63 - i));
+ for (i = 0; i < 64; i++)
+ if (foo (p, i) != __builtin_bswap32 (p[i] >> 32))
+ abort ();
+ return 0;
+}