Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Ping. -- K On Wed, Jul 27, 2011 at 10:23 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Okay, then here is an updated patch updated ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config.gcc (i[34567]86-*-*): Replace abmintrin.h with lzcntintrin.h. (x86_64-*-*): Likewise. * config/i386/i386.opt (mlzcnt): New. * config/i386/abmintrin.h: File removed. (__lzcnt_u16, __lzcnt, __lzcnt_u64): Moved to ... * config/i386/lzcntintrin.h: ... here. New file. (__lzcnt): Rename to ... (__lzcnt32): ... this. * config/i386/bmiintrin.h (head): Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Likewise. (__lzcnt_u64): Likewise. * config/i386/x86intrin.h: Include lzcntintrin.h when __LZCNT__ is defined, remove abmintrin.h. * config/i386/cpuid.h: New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New option -mlzcnt. (ix86_option_override_internal): Handle LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Update. * config/i386/i386.md (clzmode2): Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Mention -mlzcnt option. * doc/extend.texi: Likewise. Bootstrapped successfully. Ok? K On Wed, Jul 27, 2011 at 8:51 PM, H.J. Lu hjl.to...@gmail.com wrote: On Wed, Jul 27, 2011 at 9:49 AM, Uros Bizjak ubiz...@gmail.com wrote: On Wed, Jul 27, 2011 at 6:12 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Than as it is ABM header, it should include two headers: lzcntinrin.h and popcntintrin.h But again, it seems useless to me. If we cannot remove empty header, let it stay empty... K On Wed, Jul 27, 2011 at 7:53 PM, H.J. Lu hjl.to...@gmail.com wrote: On Wed, Jul 27, 2011 at 8:45 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Just have a closer look to ABM intrinsics support in GCC Seems, we have popcnt support in separate file: popcntintrin.h So, after I move lzcnt intrinsics to lzcntintrin.h, abmintrin will become useless and have to be removed at all We can't remove an installed header file. It should just include other header files. ambintrin.h has: #ifndef _X86INTRIN_H_INCLUDED # error Never use abmintrin.h directly; include x86intrin.h instead. #endif I see no problem in removing this header. It is not possible to #include it directly. Sounds good to me. -- H.J.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Mon, Aug 1, 2011 at 10:21 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Okay, then here is an updated patch updated ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config.gcc (i[34567]86-*-*): Replace abmintrin.h with lzcntintrin.h. (x86_64-*-*): Likewise. * config/i386/i386.opt (mlzcnt): New. * config/i386/abmintrin.h: File removed. (__lzcnt_u16, __lzcnt, __lzcnt_u64): Moved to ... * config/i386/lzcntintrin.h: ... here. New file. (__lzcnt): Rename to ... (__lzcnt32): ... this. * config/i386/bmiintrin.h (head): Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Likewise. (__lzcnt_u64): Likewise. * config/i386/x86intrin.h: Include lzcntintrin.h when __LZCNT__ is defined, remove abmintrin.h. * config/i386/cpuid.h: New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New option -mlzcnt. (ix86_option_override_internal): Handle LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Update. * config/i386/i386.md (clzmode2): Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Mention -mlzcnt option. * doc/extend.texi: Likewise. Bootstrapped successfully. OK for mainline. Uros.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. lzcnt-5.gcc.patch Description: Binary data
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. +# Return 1 if lzcnt instruction can be compiled. +proc check_effective_target_lzcnt { } { +return [check_no_compiler_messages lzcnt object { + void _lzcnt (void) + { + __builtin_clzs (0); + } +} -O2 -mlzcnt ] +} GCC may optimize this away. Please fix it similar to: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html -- H.J.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Hi HJ, Thanks for input. I've missed it. Done. Updated patch is attached. Thanks, K On Mon, Aug 1, 2011 at 4:26 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. +# Return 1 if lzcnt instruction can be compiled. +proc check_effective_target_lzcnt { } { + return [check_no_compiler_messages lzcnt object { + void _lzcnt (void) + { + __builtin_clzs (0); + } + } -O2 -mlzcnt ] +} GCC may optimize this away. Please fix it similar to: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html -- H.J. lzcnt-5.gcc.patch Description: Binary data
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Mon, Aug 1, 2011 at 5:36 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Hi HJ, Thanks for input. I've missed it. Done. Updated patch is attached. Compiler may still optimize it away. You need to replace 0 with a function parameter. Please see: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html H.J. --- Thanks, K On Mon, Aug 1, 2011 at 4:26 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. +# Return 1 if lzcnt instruction can be compiled. +proc check_effective_target_lzcnt { } { + return [check_no_compiler_messages lzcnt object { + void _lzcnt (void) + { + __builtin_clzs (0); + } + } -O2 -mlzcnt ] +} GCC may optimize this away. Please fix it similar to: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Done. Updated patch is attached. Thanks, K On Mon, Aug 1, 2011 at 4:49 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:36 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Hi HJ, Thanks for input. I've missed it. Done. Updated patch is attached. Compiler may still optimize it away. You need to replace 0 with a function parameter. Please see: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html H.J. --- Thanks, K On Mon, Aug 1, 2011 at 4:26 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. +# Return 1 if lzcnt instruction can be compiled. +proc check_effective_target_lzcnt { } { + return [check_no_compiler_messages lzcnt object { + void _lzcnt (void) + { + __builtin_clzs (0); + } + } -O2 -mlzcnt ] +} GCC may optimize this away. Please fix it similar to: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html lzcnt-6.gcc.patch Description: Binary data
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Mon, Aug 1, 2011 at 6:13 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Done. Updated patch is attached. Thanks, K On Mon, Aug 1, 2011 at 4:49 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:36 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Hi HJ, Thanks for input. I've missed it. Done. Updated patch is attached. Compiler may still optimize it away. You need to replace 0 with a function parameter. Please see: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html H.J. --- Thanks, K On Mon, Aug 1, 2011 at 4:26 PM, H.J. Lu hjl.to...@gmail.com wrote: On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've merged my changes with trunk (there was a conflict) and fixed typo. Updated patch is attached. Waiting for commit... Thanks, K On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks! Guys with waa rights, could anybody commit my fix? Thanks, K OK for mainline. Uros. +# Return 1 if lzcnt instruction can be compiled. +proc check_effective_target_lzcnt { } { + return [check_no_compiler_messages lzcnt object { + void _lzcnt (void) + { + __builtin_clzs (0); + } + } -O2 -mlzcnt ] +} GCC may optimize this away. Please fix it similar to: http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html We should use long long on 64bit intrinsic. I checked in this as an obvious fix. -- H.J. --- Index: ChangeLog === --- ChangeLog (revision 177080) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-08-01 H.J. Lu hongjiu...@intel.com + + * config/i386/lzcntintrin.h (__lzcnt64): Replace long with + long long. + 2011-08-01 Sebastian Pop sebastian@amd.com Joseph Myers jos...@codesourcery.com Index: config/i386/lzcntintrin.h === --- config/i386/lzcntintrin.h (revision 177080) +++ config/i386/lzcntintrin.h (working copy) @@ -45,10 +45,10 @@ __lzcnt32 (unsigned int __X) } #ifdef __x86_64__ -extern __inline unsigned long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lzcnt64 (unsigned long __X) +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inli ne__, __artificial__)) +__lzcnt64 (unsigned long long __X) { - return __builtin_clzl (__X); + return __builtin_clzll (__X); } #endif
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Thanks for inputs! I'll do it today. Just ine point. How AVX is connected to LZCNT features? AVX requires OS support since it has wider registers etc. LZCNT need no support from OS side, so from my point of view it is redundant to check in lzcnt-check.h presence of AVX support from OS side. Or I get you wrong? Thanks, K On Tue, Jul 26, 2011 at 7:56 PM, Uros Bizjak ubiz...@gmail.com wrote: On Tue, Jul 26, 2011 at 5:40 PM, Mike Stump mikest...@comcast.net wrote: On Jul 26, 2011, at 7:50 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've also prepared a bunch of tests for lzcnt instuction generation.. /ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com * lib/target-supports.exp (check_lzcnt_hw_available): New. (check_effective_target_lzcnt_runtime): Likewise. (check_effective_target_lzcnt): Likewise. For target supports, could you add an x86 to the name somewhere... Actually, please implement LZCNT detection in gcc.target/i386 directory, since it is used only in this directory. You wull need only check_effective_target_lzcnt in gcc.target/i386/i386.exp, runtime detection should be handled in lzcnt-check.h. Oh, bonus points if you implement avx-os-support.h (to check OS support with xgetbv insn) and use it in all *-check.h that check for AVX runtime (including your new lzcnt-check.h). Other than that, your new option should be tested in gcc.target/i386/sse-12.c, gcc.target/i386/sse-13.c, gcc.target/i386/sse-14.c, g++.dg/other/i386-2.C and g++.dg/other/i386-3.C. See these testcases for further details. Uros.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Wed, Jul 27, 2011 at 9:05 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks for inputs! I'll do it today. Just ine point. How AVX is connected to LZCNT features? AVX requires OS support since it has wider registers etc. LZCNT need no support from OS side, so from my point of view it is redundant to check in lzcnt-check.h presence of AVX support from OS side. Or I get you wrong? Ah, I see. I got distracted by the wrong comment in your patch: +# Return 1 if the target supports running AVX executables, 0 otherwise. + +proc check_effective_target_lzcnt_runtime { } { +if { [check_effective_target_lzcnt] + [check_lzcnt_hw_available] } { + return 1 +} +return 0 +} (I will add avx-os-support.h myself later today). Uros.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Sorry, for misunderstanding I've introduced with error in my comment. Your inputs are fixed. Since they don't touch sources, just testsuite, I am posting only tesuite/ChangeLog updated entry. tesuite/ChangeLog entry: 2011-07-27 Kirill Yukhin kirill.yuk...@intel.com * gcc.target/i386/i386.exp (check_effective_target_lzcnt): New. * gcc.target/i386/lzcnt-1.c: New test. * gcc.target/i386/lzcnt-2.c: Likewise. * gcc.target/i386/lzcnt-2a.c: Likewise. * gcc.target/i386/lzcnt-3.c: New test. * gcc.target/i386/lzcnt-4.c: Likewise. * gcc.target/i386/lzcnt-4a.c: Likewise. * gcc.target/i386/lzcnt-5.c: Likewise. * gcc.target/i386/lzcnt-6.c: Likewise. * gcc.target/i386/lzcnt-6a.c: Likewise. * gcc.target/i386/lzcnt-check.h: New driver to run LZCNT-* tests only if HW available. * gcc.target/i386/sse-12.c: Added -mlzcnt switch. * gcc.target/i386/sse-13.c: Likewise. * gcc.target/i386/sse-14.c: Likewise. * g++.dg/other/i386-2.C: Likewise. * g++.dg/other/i386-3.C: Likewise. Patch attached. Changes were bootstrapped and make-check-ed (lzcnt ones under simulator). Is it OK for now? Thanks, K On Wed, Jul 27, 2011 at 11:22 AM, Uros Bizjak ubiz...@gmail.com wrote: On Wed, Jul 27, 2011 at 9:05 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Thanks for inputs! I'll do it today. Just ine point. How AVX is connected to LZCNT features? AVX requires OS support since it has wider registers etc. LZCNT need no support from OS side, so from my point of view it is redundant to check in lzcnt-check.h presence of AVX support from OS side. Or I get you wrong? Ah, I see. I got distracted by the wrong comment in your patch: +# Return 1 if the target supports running AVX executables, 0 otherwise. + +proc check_effective_target_lzcnt_runtime { } { + if { [check_effective_target_lzcnt] + [check_lzcnt_hw_available] } { + return 1 + } + return 0 +} (I will add avx-os-support.h myself later today). Uros. lzcnt-2.gcc.patch Description: Binary data
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Okay, Uros, thanks for correcting me. Here is updated Changelogs and patch. ChangeLog entry: 2011-07-27 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config/i386/abmintrin.h (head): Check if __LZCNT__ is defined. (__lzcnt): Rename to ... (__lzcnt32): ... this. * config/i386/bmiintrin.h (head): Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Removed. (__lzcnt_u64): Likewise. * config/i386/cpuid.h: New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New option -mlzcnt. (ix86_option_override_internal): Handle LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Update. * config/i386/i386.md (clzmode2): Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Mention -mlzcnt option. * doc/extend.texi: Likewise. testsuite/ChangeLog entry: 2011-07-27 Kirill Yukhin kirill.yuk...@intel.com * gcc.target/i386/i386.exp (check_effective_target_lzcnt): New. * gcc.target/i386/lzcnt-1.c: New test. * gcc.target/i386/lzcnt-2.c: Likewise. * gcc.target/i386/lzcnt-2a.c: Likewise. * gcc.target/i386/lzcnt-3.c: Likewise. * gcc.target/i386/lzcnt-4.c: Likewise. * gcc.target/i386/lzcnt-4a.c: Likewise. * gcc.target/i386/lzcnt-5.c: Likewise. * gcc.target/i386/lzcnt-6.c: Likewise. * gcc.target/i386/lzcnt-6a.c: Likewise. * gcc.target/i386/lzcnt-check.h: Likewise. * gcc.target/i386/sse-12.c (dg-compile): Add -mlzcnt. * gcc.target/i386/sse-13.c: Likewise. * gcc.target/i386/sse-14.c: Likewise. * g++.dg/other/i386-2.C: Likewise. * g++.dg/other/i386-3.C: Likewise. Harsha, is it OK for trunk? Thanks, K On Wed, Jul 27, 2011 at 3:23 PM, Uros Bizjak ubiz...@gmail.com wrote: On Wed, Jul 27, 2011 at 12:56 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Sorry, for misunderstanding I've introduced with error in my comment. Your inputs are fixed. Since they don't touch sources, just testsuite, I am posting only tesuite/ChangeLog updated entry. tesuite/ChangeLog entry: 2011-07-27 Kirill Yukhin kirill.yuk...@intel.com * gcc.target/i386/i386.exp (check_effective_target_lzcnt): New. * gcc.target/i386/lzcnt-1.c: New test. * gcc.target/i386/lzcnt-2.c: Likewise. * gcc.target/i386/lzcnt-2a.c: Likewise. * gcc.target/i386/lzcnt-3.c: New test. * gcc.target/i386/lzcnt-4.c: Likewise. * gcc.target/i386/lzcnt-4a.c: Likewise. * gcc.target/i386/lzcnt-5.c: Likewise. * gcc.target/i386/lzcnt-6.c: Likewise. * gcc.target/i386/lzcnt-6a.c: Likewise. * gcc.target/i386/lzcnt-check.h: New driver to run LZCNT-* tests only if HW available. New. * gcc.target/i386/sse-12.c: Added -mlzcnt switch. * gcc.target/i386/sse-12.c (dg-compile): Add -mlzcnt. * gcc.target/i386/sse-13.c: Likewise. * gcc.target/i386/sse-14.c: Likewise. * g++.dg/other/i386-2.C: Likewise. * g++.dg/other/i386-3.C: Likewise. Patch attached. Patch also includes non-testsuite changes, please update ChangeLog entry as follows: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config/i386/abmintrin.h (head): Added check if __LZCNT__ is defined. Check if __LZCNT__ is defined. (__lzcnt32): Fixed name according to Spec. Rename to ... * config/i386/bmiintrin.h (head): Updated year for Copyright. Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Removed. (__lzcnt_u64): Likewise. * config/i386/cpuid.h: New bit defined. * config/i386/cpuid.h (__bit_LZCNT): New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New entry to array. New option -mlzcnt. (ix86_option_override_internal): Handling LZCNT option. Handle ... (ix86_valid_target_attribute_inner_p): Likewise. (bdesc_args): built-in for LZCNT is extended to work under another flag. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Updated flag name. ... : Update. * config/i386/i386.md (clzmode2): Target fixed. ... : Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Added mention of
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Just have a closer look to ABM intrinsics support in GCC Seems, we have popcnt support in separate file: popcntintrin.h So, after I move lzcnt intrinsics to lzcntintrin.h, abmintrin will become useless and have to be removed at all K On Wed, Jul 27, 2011 at 6:20 PM, H.J. Lu hjl.to...@gmail.com wrote: On Wed, Jul 27, 2011 at 7:06 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Okay, Uros, thanks for correcting me. Here is updated Changelogs and patch. ChangeLog entry: 2011-07-27 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config/i386/abmintrin.h (head): Check if __LZCNT__ is defined. (__lzcnt): Rename to ... (__lzcnt32): ... this. * config/i386/bmiintrin.h (head): Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Removed. (__lzcnt_u64): Likewise. * config/i386/cpuid.h: New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New option -mlzcnt. (ix86_option_override_internal): Handle LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Update. * config/i386/i386.md (clzmode2): Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Mention -mlzcnt option. * doc/extend.texi: Likewise. Please mention config/i386/i386.opt. It is very odd to include abmintrin.h for lzcnt. What if someone decides to add new intrinsics for ABM? I think it should be renamed to lzcntintrin.h and make abmintrin.h include it instead. H.J.
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Wed, Jul 27, 2011 at 8:45 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Just have a closer look to ABM intrinsics support in GCC Seems, we have popcnt support in separate file: popcntintrin.h So, after I move lzcnt intrinsics to lzcntintrin.h, abmintrin will become useless and have to be removed at all We can't remove an installed header file. It should just include other header files. H.J. ---
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Okay, then here is an updated patch updated ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config.gcc (i[34567]86-*-*): Replace abmintrin.h with lzcntintrin.h. (x86_64-*-*): Likewise. * config/i386/i386.opt (mlzcnt): New. * config/i386/abmintrin.h: File removed. (__lzcnt_u16, __lzcnt, __lzcnt_u64): Moved to ... * config/i386/lzcntintrin.h: ... here. New file. (__lzcnt): Rename to ... (__lzcnt32): ... this. * config/i386/bmiintrin.h (head): Update copyright year. (__lzcnt_u16): Removed. (__lzcnt_u32): Likewise. (__lzcnt_u64): Likewise. * config/i386/x86intrin.h: Include lzcntintrin.h when __LZCNT__ is defined, remove abmintrin.h. * config/i386/cpuid.h: New define. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New option -mlzcnt. (ix86_option_override_internal): Handle LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (struct builtin_description bdesc_args) IX86_BUILTIN_CLZS: Update. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Update. * config/i386/i386.md (clzmode2): Update insn constraint. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Mention -mlzcnt option. * doc/extend.texi: Likewise. Bootstrapped successfully. Ok? K On Wed, Jul 27, 2011 at 8:51 PM, H.J. Lu hjl.to...@gmail.com wrote: On Wed, Jul 27, 2011 at 9:49 AM, Uros Bizjak ubiz...@gmail.com wrote: On Wed, Jul 27, 2011 at 6:12 PM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Than as it is ABM header, it should include two headers: lzcntinrin.h and popcntintrin.h But again, it seems useless to me. If we cannot remove empty header, let it stay empty... K On Wed, Jul 27, 2011 at 7:53 PM, H.J. Lu hjl.to...@gmail.com wrote: On Wed, Jul 27, 2011 at 8:45 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: Just have a closer look to ABM intrinsics support in GCC Seems, we have popcnt support in separate file: popcntintrin.h So, after I move lzcnt intrinsics to lzcntintrin.h, abmintrin will become useless and have to be removed at all We can't remove an installed header file. It should just include other header files. ambintrin.h has: #ifndef _X86INTRIN_H_INCLUDED # error Never use abmintrin.h directly; include x86intrin.h instead. #endif I see no problem in removing this header. It is not possible to #include it directly. Sounds good to me. -- H.J. lzcnt-4.gcc.patch Description: Binary data
[Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
Hi, I've prepared a patch for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49547 I've also prepared a bunch of tests for lzcnt instuction generation. ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com PR target/49547 * config/i386/abmintrin.h (head): Added check if __LZCNT__ is defined. (__lzcnt32): Fixed name according to Spec. * config/i386/bmiintrin.h (head): Updated year for Copyright. (__lzcnt_u16): Removed. (__lzcnt_u32): Removed. (__lzcnt_u64): Likewise. * config/i386/cpuid.h: New bit defined. * config/i386/driver-i386.c (host_detect_local_cpu): Detect LZCNT feature. * config/i386/i386-c.c (ix86_target_macros_internal): Define __LZCNT__ if needed. * config/i386/i386.c (ix86_target_string): New entry to array. (ix86_option_override_internal): Handling LZCNT option. (ix86_valid_target_attribute_inner_p): Likewise. (bdesc_args): built-in for LZCNT is extended to work under another flag. * config/i386/i386.h (TARGET_LZCNT): New. (CLZ_DEFINED_VALUE_AT_ZERO): Updated flag name. * config/i386/i386.md (clzmode2): Target fixed. (clzmode2_lzcnt): Likewise. * doc/invoke.texi: Added mention of -mlzcnt option. * doc/extend.texi: Likewise. testsuite/ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com * lib/target-supports.exp (check_lzcnt_hw_available): New. (check_effective_target_lzcnt_runtime): Likewise. (check_effective_target_lzcnt): Likewise. * gcc.target/i386/lzcnt-1.c: New test. * gcc.target/i386/lzcnt-2.c: Likewise. * gcc.target/i386/lzcnt-2a.c: Likewise. * gcc.target/i386/lzcnt-3.c: New test. * gcc.target/i386/lzcnt-4.c: Likewise. * gcc.target/i386/lzcnt-4a.c: Likewise. * gcc.target/i386/lzcnt-5.c: Likewise. * gcc.target/i386/lzcnt-6.c: Likewise. * gcc.target/i386/lzcnt-6a.c: Likewise. * gcc.target/i386/lzcnt-check.h: New driver to run LZCNT-* tests only if HW available. Bootstrapped, make-check-ed. No new fails. OK for trunk? Thanks, K lzcnt.gcc.patch Description: Binary data
Re: [Patch, i386, testsuite] Fix for PR49547, new tescases for lzcnt instruction
On Jul 26, 2011, at 7:50 AM, Kirill Yukhin kirill.yuk...@gmail.com wrote: I've also prepared a bunch of tests for lzcnt instuction generation.. /ChangeLog entry: 2011-07-26 Kirill Yukhin kirill.yuk...@intel.com * lib/target-supports.exp (check_lzcnt_hw_available): New. (check_effective_target_lzcnt_runtime): Likewise. (check_effective_target_lzcnt): Likewise. For target supports, could you add an x86 to the name somewhere...