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
This commit is contained in:
Jakub Jelinek 2012-11-02 09:03:02 +01:00 committed by Jakub Jelinek
parent 073deae695
commit e217d64f15
4 changed files with 38 additions and 47 deletions

View file

@ -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.

View file

@ -12669,55 +12669,10 @@
(define_expand "bswapdi2"
[(set (match_operand:DI 0 "register_operand")
(bswap:DI (match_operand:DI 1 "nonimmediate_operand")))]
""
"TARGET_64BIT"
{
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)))]
{
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"

View file

@ -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.

View file

@ -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;
}