This is an archive of the discontinued LLVM Phabricator instance.

Adding front-end support to several intrinsics (bit scanning, conversion and state reading intrinsics)
ClosedPublic

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

Details

Summary

Adding LLVM front-end support to two intrinsics dealing with bit scan: _bit_scan_forward and _bit_scan_reverse.
Their functionality is as described in Intel intrinsics guide:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_forward&expand=371,370
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_bit_scan_reverse&expand=371,370

Furthermore, adding clang front-end support to these conversion intrinsics: _mm256_cvtsd_f64, _mm256_cvtsi256_si32 and _mm256_cvtss_f32.

Finally, adding tests to all of the above, as well as to the state reading intrinsics _rdpmc and _rdtsc.
Their functionality is also specified in the Intel intrinsics guide.

Diff Detail

Event Timeline

opaparo updated this revision to Diff 56126.May 4 2016, 5:36 AM
opaparo retitled this revision from to Adding back-end support to bit scan intrinsics.
opaparo updated this object.
opaparo added reviewers: m_zuckerman, AsafBadouh, igorb.
opaparo updated this revision to Diff 56131.May 4 2016, 5:50 AM
opaparo retitled this revision from Adding back-end support to bit scan intrinsics to Adding support to several intrinsics (bit scanning, conversion and state reading intrinsics).
opaparo updated this object.
opaparo retitled this revision from Adding support to several intrinsics (bit scanning, conversion and state reading intrinsics) to Adding front-end support to several intrinsics (bit scanning, conversion and state reading intrinsics).May 4 2016, 5:53 AM
opaparo updated this object.
m_zuckerman added inline comments.May 4 2016, 6:26 AM
test/CodeGen/avx-builtins.c
192

Add more one line

test/CodeGen/bitscan-builtins.c
18

Add more one line

test/CodeGen/rd-builtins.c
19

Add more one line

m_zuckerman added inline comments.May 4 2016, 6:41 AM
include/clang/Basic/BuiltinsX86.def
39

convention: add _ia32

40

convention: add _ia32

m_zuckerman added inline comments.May 4 2016, 6:48 AM
include/clang/Basic/BuiltinsX86.def
39

Why use BUILTIN and not target_builtin?

AsafBadouh added inline comments.May 4 2016, 7:24 AM
lib/Headers/immintrin.h
112

is it only for X86_64?
I think it isn't.

test/CodeGen/bitscan-builtins.c
1

you don't need all the target features

test/CodeGen/rd-builtins.c
1

I think that the target features are incorrect.

opaparo updated this revision to Diff 56533.May 9 2016, 12:43 AM
opaparo edited edge metadata.
opaparo updated this revision to Diff 56535.May 9 2016, 1:07 AM
AsafBadouh accepted this revision.May 25 2016, 12:47 AM
AsafBadouh edited edge metadata.

LGTM

This revision is now accepted and ready to land.May 25 2016, 12:47 AM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r271387.