This is an archive of the discontinued LLVM Phabricator instance.

Add codegen for llvm log2/log10 elementwise builtins
ClosedPublic

Authored by bob80905 on Feb 2 2023, 12:17 PM.

Details

Summary

Add codegen for llvm log2 / log10 elementwise builtin
The log2/log10 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.
The new builtins are restricted to floating point types only.

Diff Detail

Event Timeline

bob80905 created this revision.Feb 2 2023, 12:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2023, 12:17 PM
bob80905 requested review of this revision.Feb 2 2023, 12:17 PM
bob80905 updated this revision to Diff 494470.Feb 2 2023, 4:32 PM

add release note line

bob80905 updated this revision to Diff 494471.Feb 2 2023, 4:34 PM

include first commit

Add log2 together?
They're in same category.

clang/test/Sema/aarch64-sve-vector-log-ops.c
25

newline.

clang/test/SemaCXX/builtins-elementwise-math.cpp
97

newline.

bob80905 updated this revision to Diff 494477.Feb 2 2023, 5:09 PM
  • add log2 as well
bob80905 edited the summary of this revision. (Show Details)Feb 2 2023, 5:09 PM
bob80905 retitled this revision from Add codegen for llvm log10 elementwise builtin to Add codegen for llvm log2/log10 elementwise builtins.
fhahn accepted this revision.Feb 7 2023, 5:10 AM

LGTM, thanks! Looks like a straight-forward extension of the existing builtins.

clang/test/Sema/aarch64-sve-vector-log-ops.c
17

We should ideally not mention integer type here. Not directly related to the patch, but would be great to see this fixed.

This revision is now accepted and ready to land.Feb 7 2023, 5:10 AM
This revision was automatically updated to reflect the committed changes.