This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] add ceil library function
ClosedPublic

Authored by bob80905 on Sep 20 2022, 2:42 PM.

Details

Summary

This change exposes the ceil library function for HLSL,
excluding long, int, and long long doubles.
Ceil is supported for all scalar, vector, and matrix types.

Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the ceil function only works on floating type arguments.

The full documentation of the HLSL ceil function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ceil

Diff Detail

Event Timeline

bob80905 created this revision.Sep 20 2022, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 2:42 PM
Herald added a subscriber: Anastasia. · View Herald Transcript
bob80905 requested review of this revision.Sep 20 2022, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2022, 2:42 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
beanz added a comment.Sep 20 2022, 2:49 PM

For this builtin you should be able to use __builtin_elementwise_ceil for all the overload cases, and you should be able to add the vector cases too.

bob80905 updated this revision to Diff 461725.Sep 20 2022, 3:07 PM
  • add elementwise function tests. Remove integer tests, ceil will not take integer types as an arg
bob80905 updated this revision to Diff 461727.Sep 20 2022, 3:11 PM
  • remove int attribute links in hlsl_intrinsics.h
bob80905 edited the summary of this revision. (Show Details)
python3kgae added inline comments.Sep 20 2022, 3:51 PM
clang/lib/Headers/hlsl/hlsl_intrinsics.h
17–18

The change to remove these already in.
Rebase to skip it in this PR.

bob80905 updated this revision to Diff 461739.Sep 20 2022, 3:53 PM
  • add elementwise function tests
  • remove int attribute links in hlsl_intrinsics.h
  • rebase
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
bob80905 updated this revision to Diff 461747.Sep 20 2022, 4:03 PM

fix attempt 1

bob80905 updated this revision to Diff 461749.Sep 20 2022, 4:09 PM

fix attempt 2

clementval removed a project: Restricted Project.Sep 21 2022, 12:08 AM
python3kgae accepted this revision.Sep 22 2022, 4:41 PM
This revision is now accepted and ready to land.Sep 22 2022, 4:41 PM
bob80905 updated this revision to Diff 463680.Sep 28 2022, 3:13 PM
  • adhere to clang format
bob80905 updated this revision to Diff 463720.Sep 28 2022, 5:06 PM
  • whitespace try 2
bob80905 updated this revision to Diff 463960.Sep 29 2022, 10:41 AM
  • got clang-format working on VS2022
This revision was automatically updated to reflect the committed changes.