This will pick "bswap" word from __builtin_bswap. You should probably
use scan-assembler-not "builtin_bswap".
int foo (int a)
{
int b;
b = __builtin_bswap (a);
There is no __builtin_bswap() builtin function, only
__builtin_bswap32() and __builtin_bswap64(). The test "passes" only
due to above problem.
+(define_insn "bswapsi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (bswap:SI (match_operand:SI 1 "register_operand" "0")))
+ (clobber (reg:CC FLAGS_REG))]
+ "!TARGET_64BIT && TARGET_BSWAP"
+ "bswap\t%1"
bswap\t%0
+ [(set_attr "prefix_0f" "1")])
Does this patern need to be disabled on 64 bits? IMO it can still be
used with 32bit argument.
BTW: I wonder, why there is no bswaphi2 pattern. Intel recommends xchg
instruction to swap bytes in HImode argument. The relevant pattern
could be defined like:
(define_insn "bswaphi2"
[(set (match_operand:HI 0 "register_operand" "=G")
(bswap:HI (match_operand:HI 1 "register_operand" "0")))]
""
"xchg\t%b0, %h0")
I'm sure that linux's __be16 and __le16 data could find some use for
this pattern.