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] |
On Wed, Jun 10, 2009 at 9:05 AM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Wed, Jun 10, 2009 at 8:38 AM, Paolo Bonzini<paolo.bonzini@gmail.com> wrote: >> >>> int >>> rol(int x, int y) >>> { >>> ?return (x << y) | (x >> (32 - y)); >>> ?} >> >> Uhm, because it is not a rotate (the >> shift is arithmetic). ?But this >> works: >> >> ?return ((unsigned)x << y) + ((unsigned)x >> (32-y)); >> >> and the dumps show that it is done before inlining. >> >> I could not get it to work for rolb/rolw due to int promotion, but I think >> we should treat this as a tree-level missed optimization. >> > > I will update my patch to rewrite 32bit and 64bit rotate/shift. > Here is the updated patch. Any comments? Thanks. -- H.J. ----- 2009-06-11 H.J. Lu <hongjiu.lu@intel.com> * config.gcc (extra_headers): Add ia32intrin.h for x86. * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_BSRSI, IX86_BUILTIN_BSRDI. IX86_BUILTIN_RDPMC, IX86_BUILTIN_RDTSC. IX86_BUILTIN_RDTSCP. IX86_BUILTIN_ROLQI, IX86_BUILTIN_ROLHI, IX86_BUILTIN_RORQI and IX86_BUILTIN_RORHI. (ix86_special_builtin_type): Add UINT64_FTYPE_VOID, UINT64_FTYPE_PINT, INT_FTYPE_INT, UINT64_FTYPE_INT, INT64_FTYPE_INT64, UINT16_FTYPE_UINT16_INT and UINT8_FTYPE_UINT8_INT (bdesc_special_args): Add __builtin_ia32_rdtsc and __builtin_ia32_rdtscp. (bdesc_args): Add __builtin_ia32_bsrsi, __builtin_ia32_bsrdi, __builtin_ia32_rolqi, __builtin_ia32_rolhi, __builtin_ia32_rorqi and __builtin_ia32_rorhi, (ix86_init_mmx_sse_builtins): Handle UINT64_FTYPE_VOID, UINT64_FTYPE_PINT, INT_FTYPE_INT, UINT64_FTYPE_INT, INT64_FTYPE_INT64, UINT16_FTYPE_UINT16_INT and UINT8_FTYPE_UINT8_INT. (ix86_expand_args_builtin): Likewise. (ix86_expand_special_args_builtin): Likewise. (x86_64_load_64bit_split): New. * config/i386/i386.md (UNSPECV_RDTSCP): New. (UNSPECV_RDTSC): Likewise. (UNSPECV_RDPMC): Likewise. (bsr): New. (bsr_rex64): Likewise. (rdpmc): Likewise. (*rdpmc): Likewise. (*rdpmc_rex64): Likewise. (rdtsc): Likewise. (*rdtsc): Likewise. (*rdtsc_rex64): Likewise. (rdtscp): Likewise. (*rdtscp): Likewise. (*rdtscp_rex64): Likewise. * config/i386/i386-protos.h (x86_64_load_64bit_split): New. * config/i386/ia32intrin.h: New. * config/i386/x86intrin.h: Include <ia32intrin.h>.
Attachment:
gcc-intrin-2.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |