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 (clz<mode>2): Target fixed. ... : Update insn constraint. > (clz<mode>2_lzcnt): Likewise. > * doc/invoke.texi: Added mention of -mlzcnt option. Mention -mlzcnt option. > * doc/extend.texi: Likewise. > Changes were bootstrapped and make-check-ed (lzcnt ones under simulator). > Is it OK for now? Testsuite changes are OK, with a few nits, see below. The patch is OK in principle, but since it touches public header, we need also OK from AMD (CC'd). +++ b/gcc/testsuite/gcc.target/i386/lzcnt-2.c + while ( (res<16) && (((src>>(15-res))&1) == 0)) Please watch whitespace. +++ b/gcc/testsuite/gcc.target/i386/lzcnt-4.c + while ( (res<32) && (((src>>(31-res))&1) == 0)) Same here. +++ b/gcc/testsuite/gcc.target/i386/lzcnt-6.c + while ( (res<64) && (((src>>(63-res))&1) == 0)) And here. Uros.