diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bda22d0f736..486cd9358f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-02-12 Roger Sayle + + * config/i386/i386.md (*bswapdi2_rex): Renamed from bswapdi2. + (bswapdi2): New define_expand to implement 32-bit implementation. + 2007-02-12 Nick Clifton * doc/invoke.texi (Overall Options): Document --help=. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 19cd0913ffc..04d013666ff 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -14973,7 +14973,7 @@ [(set_attr "prefix_0f" "1") (set_attr "length" "2")]) -(define_insn "bswapdi2" +(define_insn "*bswapdi2_rex" [(set (match_operand:DI 0 "register_operand" "=r") (bswap:DI (match_operand:DI 1 "register_operand" "0"))) (clobber (reg:CC FLAGS_REG))] @@ -14982,6 +14982,25 @@ [(set_attr "prefix_0f" "1") (set_attr "length" "3")]) +(define_expand "bswapdi2" + [(parallel [(set (match_operand:DI 0 "register_operand" "") + (bswap:DI (match_operand:DI 1 "register_operand" ""))) + (clobber (reg:CC FLAGS_REG))])] + "TARGET_BSWAP" + { + if (!TARGET_64BIT) + { + rtx tmp1, tmp2; + tmp1 = gen_reg_rtx (SImode); + tmp2 = gen_reg_rtx (SImode); + emit_insn (gen_bswapsi2 (tmp1, gen_lowpart (SImode, operands[1]))); + emit_insn (gen_bswapsi2 (tmp2, gen_highpart (SImode, operands[1]))); + emit_move_insn (gen_lowpart (SImode, operands[0]), tmp2); + emit_move_insn (gen_highpart (SImode, operands[0]), tmp1); + DONE; + } + }) + (define_expand "clzdi2" [(parallel [(set (match_operand:DI 0 "register_operand" "") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 822bcff203b..2edb100babf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-02-12 Roger Sayle + + * gcc.target/i386/builtin-bswap-3.c: New test case. + 2007-02-12 Dorit Nuzman PR tree-optimization/29145 diff --git a/gcc/testsuite/gcc.target/i386/builtin-bswap-3.c b/gcc/testsuite/gcc.target/i386/builtin-bswap-3.c new file mode 100644 index 00000000000..eaea53748c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/builtin-bswap-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=nocona" } */ +/* { dg-final { scan-assembler-not "bswapdi2" } } */ + +long long foo (long long x) +{ + return __builtin_bswap64 (x); +} +