[patch] Move the popcnt intrinsics to a separate file

Sebastian Pop sebpop@gmail.com
Fri Dec 4 17:54:00 GMT 2009


On Fri, Dec 4, 2009 at 11:24, Richard Henderson <rth@redhat.com> wrote:
> On 12/04/2009 02:21 AM, Jakub Jelinek wrote:
>>
>>        * config/i386/abmintrin.h (_mm_popcnt_u32, _mm_popcnt_u64): Don't
>>        define if __SSE4_2__ is defined.
>
> This seems wrong.  These instructions are covered by the POPCNT cpuid bit,
> not the SSE4.2 bit.  And indeed are properly marked in the md file.
>
> What I don't see is what the ABM isa corresponds to.  That needs to be
> added to config/gcc/cpuid.h and testsuite/gcc.target/i386/isa-check.h,
> if only for documentation purposes.
>

ABM corresponds to two instructions popcnt and lzcnt.  See a recent
version of manual 3: "General Purpose and System Instructions Rev
3.15" from http://support.amd.com/us/Processor_TechDocs/24594.pdf

> I do see that the ABM isa does properly imply the POPCNT isa, so I'm not
> sure why Jakub thought this change was needed?
>

Otherwise we define the _mm_popcnt_u[32,64] in both smmintrin.h and
abmintrin.h when both -msse4.2 and -mabm are used.

In my opinion the _mm_popcnt_u* intrinsics should be removed from the
smmintrin.h, as they do not deal with XMM registers, and they should
be put separately in a popcount.h file, as I originally proposed, and
then include that file in abmintrin.h and somewhere else than smmintrin.h
for Intel processors.

Sebastian



More information about the Gcc-patches mailing list