[clang] [clang][HLSL] Move hlsl_wave_get_lane_index to EmitHLSLBuiltinExpr (PR #87131)
Marc Auberer via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 30 09:15:39 PDT 2024
https://github.com/marcauberer updated https://github.com/llvm/llvm-project/pull/87131
>From b275a7b3e79fdf316ac2d19b25b43e9298b3715a Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at chillibits.com>
Date: Sat, 30 Mar 2024 01:52:52 +0100
Subject: [PATCH] [Clang] Move hlsl_wave_get_lane_index to EmitHLSLBuiltinExpr
---
clang/lib/CodeGen/CGBuiltin.cpp | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 287e763bad82dd..bb007231c0b783 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5892,16 +5892,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
Name),
{NDRange, Kernel, Block}));
}
-
- case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
- auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
- llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
- {}, false, true));
- if (getTarget().getTriple().isSPIRVLogical())
- CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
- return RValue::get(CI);
- }
-
case Builtin::BI__builtin_store_half:
case Builtin::BI__builtin_store_halff: {
Value *Val = EmitScalarExpr(E->getArg(0));
@@ -18317,6 +18307,14 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
/*ReturnType=*/Op0->getType(), Intrinsic::dx_rsqrt,
ArrayRef<Value *>{Op0}, nullptr, "dx.rsqrt");
}
+ case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
+ auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
+ llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
+ {}, false, true));
+ if (getTarget().getTriple().isSPIRVLogical())
+ CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
+ return CI;
+ }
}
return nullptr;
}
More information about the cfe-commits
mailing list