This is an archive of the discontinued LLVM Phabricator instance.

clang: Add elementwise pow builtin
ClosedPublic

Authored by bob80905 on Jun 19 2023, 4:09 PM.

Details

Summary

Add codegen for llvm pow elementwise builtin
The pow 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 floating point types only.

Diff Detail

Event Timeline

bob80905 created this revision.Jun 19 2023, 4:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 4:09 PM
bob80905 requested review of this revision.Jun 19 2023, 4:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 4:09 PM
bob80905 updated this revision to Diff 541294.Jul 17 2023, 6:18 PM

fix void return, and incorrect expectation of arg count

bob80905 updated this revision to Diff 541651.Jul 18 2023, 11:25 AM
  • remove unimportant part of test
bob80905 retitled this revision from Add builtin_elementwise_pow to Add codegen for llvm pow builtin.Jul 18 2023, 12:38 PM

Add a test for the strictfp case (there's an existing strictfp test for all the elementwise builtins)

clang/lib/CodeGen/CGBuiltin.cpp
3241

emitBinaryBuiltin?

bob80905 updated this revision to Diff 541717.Jul 18 2023, 1:50 PM
  • add strictfp test, use emitbinarybuiltin, fix some whitespace
bob80905 updated this revision to Diff 541721.Jul 18 2023, 1:53 PM
  • add newline EOF

Ping, can someone please take a look?

Code looks fine, patch title is a bit confusing. Don't say codegen, and say clang: Add elementwise pow builtin?

bob80905 retitled this revision from Add codegen for llvm pow builtin to clang: Add elementwise pow builtin.Jul 24 2023, 11:48 AM
arsenm accepted this revision.Jul 24 2023, 11:56 AM
arsenm added inline comments.
clang/test/CodeGen/strictfp-elementwise-bulitins.cpp
223

This is broken but I know this is a pre-existing broken with the others

This revision is now accepted and ready to land.Jul 24 2023, 11:56 AM
This revision was automatically updated to reflect the committed changes.