This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The following patch provides inline intrinsic support for GCC's __builtin_bswap64 on 32-bit IA-32 for CPUs that support bswap. Currently, the following code: long long foo (long long x) { return __builtin_bswap64 (x); } Generates the following code with "-O2 -march=pentium4 -fomit-frame-pointer" on i686-pc-linux-gnu. foo: subl $28, %esp movl 32(%esp), %eax movl 36(%esp), %edx movl %eax, (%esp) movl %edx, 4(%esp) call __bswapdi2 addl $28, %esp ret With the patch below, we now generate: foo: movl 4(%esp), %edx movl 8(%esp), %eax bswap %edx bswap %eax ret The following patch has been tested on both i686-pc-linux-gnu and x86_64-unknown-linux-gnu, with a full "make bootstrap", all default languages including Ada, and regression tested with a top-level "make -k check" with no new failures. Ok for mainline? 2007-02-09 Roger Sayle <roger@eyesopen.com> * config/i386/i386.md (bswapdi2_rex): Renamed from bswapdi2. (bswapdi2): New define_expand to provide 32-bit implementation. * gcc.target/i386/builtin-bswap-3.c: New test case. Roger --
Attachment:
patchb.txt
Description: Text document
Attachment:
builtin-bswap-3.c
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |