This is an archive of the discontinued LLVM Phabricator instance.

[Headers] Fix up some conditionals
ClosedPublic

Authored by probinson on Jun 22 2023, 10:39 AM.

Details

Summary

While looking at adding intrinsic function descriptions, I found some
oddities in the conditionals. I've fiddled with some of them. This is
not a complete audit.

Two headers have been changed to require only immintrin.h and not
x86intrin.h; this conforms to which header actually includes them, and with
Intel documentation.

One function in bmi2intrin.h was defined only in 32-bit mode, for no
apparent reason; I fixed that.

clzerointrin.h is included from x86intrin.h, so I made it not check for immintrin.h.
This is an AMD only instruction so there's no Intel documentation to check against.

Diff Detail

Event Timeline

probinson created this revision.Jun 22 2023, 10:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 10:39 AM
probinson requested review of this revision.Jun 22 2023, 10:39 AM
This revision is now accepted and ready to land.Jun 22 2023, 10:58 AM

The mulx function being 32-bit mode only is also true in gcc. It probably won't generate a mulx instruction on x86-64. Maybe that's why it was 32-bit only? But it should still be functionally correct.

The Intel documentation doesn't hint that _mulx_32 isn't available in 64-bit mode. I'm guessing gcc messed up and we copied them.

probinson closed this revision.EditedJun 22 2023, 11:23 AM

Committed [[ here | https://github.com/llvm/llvm-project/commit/3db8410487ce704f02ef8a175e87295d4e86c8df ]] and closing manually because I forgot to put the review link in the commit message.

The mulx function being 32-bit mode only is also true in gcc. It probably won't generate a mulx instruction on x86-64. Maybe that's why it was 32-bit only? But it should still be functionally correct.

It's not functionally correct. Candidate fix D153620.