This is an archive of the discontinued LLVM Phabricator instance.

clang: Add elementwise bitreverse builtin
ClosedPublic

Authored by bob80905 on Jul 26 2023, 11:45 AM.

Details

Summary

Add codegen for llvm bitreverse elementwise builtin
The bitreverse elementwise builtin is necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered when these functions are given inputs of incompatible types, or too many inputs.
The new builtin is restricted to integer types only.

Diff Detail

Event Timeline

bob80905 created this revision.Jul 26 2023, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 11:45 AM
Herald added a subscriber: Anastasia. · View Herald Transcript
bob80905 requested review of this revision.Jul 26 2023, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2023, 11:45 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
bob80905 updated this revision to Diff 544463.Jul 26 2023, 11:46 AM

add attempt 1 commit

bob80905 updated this revision to Diff 544563.Jul 26 2023, 5:26 PM
  • remove strictfp test, add cgbuiltin case and update test in codegen
bob80905 updated this revision to Diff 544610.Jul 26 2023, 10:42 PM
  • remove tests that only test floating point inputs
bob80905 updated this revision to Diff 544830.Jul 27 2023, 10:03 AM
  • apply clang-format on CGBuiltin.cpp
arsenm added inline comments.Jul 28 2023, 4:20 AM
clang/docs/LanguageExtensions.rst
634

Unrelated but I noticed a couple of the elementwise builtins are missing from this list if you're fixing up the docs for them. Can't remember which off the top of my head

clang/test/Sema/builtins-elementwise-math.c
272

Test the vector of float case?

bob80905 updated this revision to Diff 545251.Jul 28 2023, 12:53 PM
  • add float4 test
clang/docs/LanguageExtensions.rst
634

Are you sure?
I double checked CGBuiltin.cpp and Builtins.def for all "builtin_elementwise*"'s, there's only the 24 listed here.

arsenm accepted this revision.Jul 31 2023, 9:53 AM
This revision is now accepted and ready to land.Jul 31 2023, 9:53 AM
This revision was automatically updated to reflect the committed changes.