Skip to content

Commit 105dcc8

Browse files
authored
[HLSL][SPIRV] Add any intrinsic lowering (#88325)
- `CGBuiltin.cpp` - Switch to using `CGM.getHLSLRuntime().get##NAME##Intrinsic()` - `CGHLSLRuntime.h` - Add any to backend intrinsic abstraction - `IntrinsicsSPIRV.td` - Add any intrinsic to SPIR-V. - `SPIRVInstructionSelector.cpp` - Add means of selecting any intrinsic. Any and All share the same behavior up to the opCode. They are only different in vector cases. Completes #88045
1 parent 67e733d commit 105dcc8

File tree

6 files changed

+460
-131
lines changed

6 files changed

+460
-131
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18194,7 +18194,8 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1819418194
Value *Op0 = EmitScalarExpr(E->getArg(0));
1819518195
return Builder.CreateIntrinsic(
1819618196
/*ReturnType=*/llvm::Type::getInt1Ty(getLLVMContext()),
18197-
Intrinsic::dx_any, ArrayRef<Value *>{Op0}, nullptr, "dx.any");
18197+
CGM.getHLSLRuntime().getAnyIntrinsic(), ArrayRef<Value *>{Op0}, nullptr,
18198+
"hlsl.any");
1819818199
}
1819918200
case Builtin::BI__builtin_hlsl_elementwise_clamp: {
1820018201
Value *OpX = EmitScalarExpr(E->getArg(0));

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class CGHLSLRuntime {
7373
//===----------------------------------------------------------------------===//
7474

7575
GENERATE_HLSL_INTRINSIC_FUNCTION(All, all)
76+
GENERATE_HLSL_INTRINSIC_FUNCTION(Any, any)
7677
GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
7778

7879
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)