This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add BSR/BSF/BSWAP intrinsics to ia32intrin.h to match gcc.
ClosedPublic

Authored by craig.topper on Mar 22 2019, 12:12 AM.

Details

Summary

These are all implemented by icc as well.

I made bit_scan_forward/reverse forward to the bsfd/bsrq since we also have
bsfq/bsrq.

Note, when lzcnt is enabled the bsr intrinsics generates lzcnt+xor instead of bsr.

Diff Detail

Repository
rC Clang

Event Timeline

craig.topper created this revision.Mar 22 2019, 12:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2019, 12:12 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
RKSimon added inline comments.Mar 22 2019, 6:20 AM
lib/Headers/ia32intrin.h
31

Ideally we'd have doxygen comments.

test/CodeGen/bitscan-builtins.c
24

Should we be testing the is_zero_undef flag is true?

Add doxygen comments. Check the zero_undef flag.

RKSimon accepted this revision.Mar 23 2019, 4:23 PM

LGTM - cheers

This revision is now accepted and ready to land.Mar 23 2019, 4:23 PM
This revision was automatically updated to reflect the committed changes.