Page MenuHomePhabricator

[HLSL] Add clang builtin for HLSL.
Needs ReviewPublic

Authored by python3kgae on May 2 2022, 4:28 PM.

Details

Summary

Two directx specific clang builtins are introduced:

unsigned builtin_dx_umax_i3232(unsigned, unsigned);
unsigned
builtin_dx_umin_i3232(unsigned, unsigned);

They're for https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DXIL.rst#umax and
https://github.com/Microsoft/DirectXShaderCompiler/blob/master/docs/DXIL.rst#umini.

These 2 builtins are translated into llvm umax/umin intrinsic in clang codeGen.

Diff Detail

Unit TestsFailed

TimeTest
110 msx64 debian > Clang.CodeGen::debug-info-block-vars.c
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/15.0.0/include -nostdsysteminc -no-opaque-pointers -x c -std=c89 -fblocks -debug-info-kind=standalone -emit-llvm -O0 -triple x86_64-apple-darwin -o - /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGen/debug-info-block-vars.c | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGen/debug-info-block-vars.c
40 msx64 debian > Clang.CodeGenHLSL::umax_umin.hlsl
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang --driver-mode=dxc -Tlib_6_7 -Fo - /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGenHLSL/umax_umin.hlsl | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGenHLSL/umax_umin.hlsl
90 msx64 debian > Clang.CodeGenObjCXX::nrvo.mm
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/15.0.0/include -nostdsysteminc -emit-llvm -o - -fblocks /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGenObjCXX/nrvo.mm -O1 -fno-inline-functions -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/clang/test/CodeGenObjCXX/nrvo.mm

Event Timeline

python3kgae created this revision.May 2 2022, 4:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 4:28 PM
Herald added a subscriber: Anastasia. · View Herald Transcript
python3kgae requested review of this revision.May 2 2022, 4:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 4:28 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
yonghong-song resigned from this revision.May 4 2022, 9:10 PM

please having proper reviewers. Me, @anakryiko @ast are not the right persons to review this patch.

sameerds resigned from this revision.May 4 2022, 11:48 PM

I am not much familiar with DirectX and HLSL, so unable to review this patch. It might help to post on the Discourse under Clang Frontend:

https://discourse.llvm.org/c/clang/6