This is an archive of the discontinued LLVM Phabricator instance.

Adding back-end support to two bit scanning intrinsics
ClosedPublic

Authored by opaparo on May 4 2016, 5:54 AM.

Diff Detail

Event Timeline

opaparo updated this revision to Diff 56132.May 4 2016, 5:54 AM
opaparo retitled this revision from to Adding back-end support to two bit scanning intrinsics.
opaparo updated this object.
AsafBadouh added inline comments.May 4 2016, 6:43 AM
test/CodeGen/X86/bitscan.ll
2

please change "-mcpu=core-avx-i -mattr=+rdrnd " to "-mcpu=corei7"

7

add CHECK-LABE

12

same

m_zuckerman edited edge metadata.EditedMay 4 2016, 6:47 AM
This comment has been deleted.
include/llvm/IR/IntrinsicsX86.td
8722

Add more one line

test/CodeGen/X86/bitscan.ll
2

Why you need -mcpu=core-avx-i?

18

Add more one line

m_zuckerman added inline comments.May 4 2016, 6:49 AM
include/llvm/IR/IntrinsicsX86.td
8716

convention: add _ia32

8719

convention: add _ia32

opaparo updated this revision to Diff 56532.May 9 2016, 12:41 AM
opaparo edited edge metadata.
RKSimon added a subscriber: RKSimon.
RKSimon added inline comments.
include/llvm/IR/IntrinsicsX86.td
8719

Why doesn't the patch include support for the 16 and 64 bit BSR/BSF instructions as well?

As Michael said, even if the 16 and 64 bit versions aren't included in this patch the intrinsic naming convention should include the type size for consistency if/when they are added added in the future.

opaparo updated this revision to Diff 56711.May 10 2016, 7:00 AM
opaparo added inline comments.May 10 2016, 7:32 AM
include/llvm/IR/IntrinsicsX86.td
8719

As my implementation follows Intel's Intrinsics guide, the only version of this form of BSR/BSF intrinsics, as specified in the guide, is the 32-bit version. There is another form of the BSR/BSF intrinsics, which has a 32-bit version as well as a 64-bit version, but this form is fully implemented as part of the front-end and has no back-end part.
As for the naming convention - the appropriate change was made.

RKSimon edited edge metadata.May 13 2016, 5:48 AM

Couple of minors

test/CodeGen/X86/bitscan.ll
2

Please can you test with a 32-bit triple as well?

12

Please run the file through the utils\update_llc_test_checks.py script to test the codegen more thoroughly.

opaparo updated this revision to Diff 57466.May 17 2016, 5:19 AM
opaparo edited edge metadata.

Added 32-bit test for the intrinsics

RKSimon accepted this revision.May 23 2016, 7:31 AM
RKSimon edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 23 2016, 7:31 AM
AsafBadouh accepted this revision.May 25 2016, 12:36 AM
AsafBadouh edited edge metadata.

LGTM

This revision was automatically updated to reflect the committed changes.