This is the mail archive of the
mailing list for the GCC project.
Re: [patch] misc bswap fixes
- From: Eric Christopher <echristo at apple dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 6 Nov 2006 10:06:00 -0800
- Subject: Re: [patch] misc bswap fixes
- References: <firstname.lastname@example.org>
This will pick "bswap" word from __builtin_bswap. You should probably
use scan-assembler-not "builtin_bswap".
int foo (int a)
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.
Heh. And none of us noticed the first time. Good catch.
+ [(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"
+ [(set_attr "prefix_0f" "1")])
Does this patern need to be disabled on 64 bits? IMO it can still be
used with 32bit argument.
Not as far as I know, bswap operates on the entire register and
registers are 64-bit
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:
[(set (match_operand:HI 0 "register_operand" "=G")
(bswap:HI (match_operand:HI 1 "register_operand" "0")))]
I'm sure that linux's __be16 and __le16 data could find some use for
Mostly because I hadn't done it yet. There's no support for
If you feel like supporting writing the rest of the support...