Skip to content

Commit 737aa73

Browse files
committed
remove try for generic GENERATE_HLSL_INTRINSIC_FUNCTION
1 parent 548299a commit 737aa73

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,6 @@ static Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
240240
return RT.getFirstBitUHighIntrinsic();
241241
}
242242

243-
// Return wave active sum that corresponds to the QT scalar type
244-
static Intrinsic::ID getWaveActiveSumIntrinsic(llvm::Triple::ArchType Arch,
245-
CGHLSLRuntime &RT, QualType QT) {
246-
switch (Arch) {
247-
case llvm::Triple::spirv:
248-
return Intrinsic::spv_wave_reduce_sum;
249-
case llvm::Triple::dxil: {
250-
if (QT->isUnsignedIntegerType())
251-
return Intrinsic::dx_wave_reduce_usum;
252-
return Intrinsic::dx_wave_reduce_sum;
253-
}
254-
default:
255-
llvm_unreachable("Intrinsic WaveActiveSum"
256-
" not supported by target architecture");
257-
}
258-
}
259-
260243
// Return wave active product that corresponds to the QT scalar type
261244
static Intrinsic::ID getWaveActiveProductIntrinsic(llvm::Triple::ArchType Arch,
262245
CGHLSLRuntime &RT, QualType QT) {

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,6 @@
3232
#include <optional>
3333
#include <vector>
3434

35-
#define GENERATE_HLSL_INTRINSIC_CASE(Arch, ArchPrefix, IntrinsicPostfix, HasUnsignedVariant) \
36-
case llvm::Triple::Arch: { \
37-
if (HasUnsignedVariant && QT->isUnsignedIntegerType()) \
38-
return llvm::Intrinsic::##ArchPrefix##_u##IntrinsicPostfix; \
39-
return llvm::Intrinsic::##ArchPrefix##_##IntrinsicPostfix; \
40-
}
41-
42-
#define GENERATE_DX_INTRINSIC_CASE(IntrinsicPostfix, HasUnsignedVariant) \
43-
GENERATE_HLSL_INTRINSIC_CASE(dxil, dx, IntrinsicPostfix, HasUnsignedVariant)
44-
45-
#define GENERATE_SPV_INTRINSIC_CASE(IntrinsicPostfix, HasUnsignedVariant) \
46-
GENERATE_HLSL_INTRINSIC_CASE(spirv, spv, IntrinsicPostfix, HasUnsignedVariant)
47-
48-
#define GENERATE_HLSL_INTRINSIC_FUNCTION_UNSIGNED(FunctionName, IntrinsicPostfix, DxHasUnsignedVariant, SpvHasUnsignedVariant) \
49-
llvm::Intrinsic::ID get##FunctionName##Intrinsic(QualType QT) { \
50-
llvm::Triple::ArchType Arch = getArch(); \
51-
switch (Arch) { \
52-
GENERATE_DX_INTRINSIC_CASE(IntrinsicPostfix, DxHasUnsignedVariant) \
53-
GENERATE_SPV_INTRINSIC_CASE(IntrinsicPostfix, SpvHasUnsignedVariant) \
54-
} \
55-
}
56-
5735
// A function generator macro for picking the right intrinsic
5836
// for the target backend
5937
#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix) \
@@ -172,6 +150,7 @@ class CGHLSLRuntime {
172150
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveIsFirstLane, wave_is_first_lane)
173151
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveGetLaneCount, wave_get_lane_count)
174152
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveReadLaneAt, wave_readlane)
153+
GENERATE_HLSL_INTRINSIC_FUNCTION_UNSIGNED(WaveActiveSum, wave_reduce_sum, true, false);
175154
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitUHigh, firstbituhigh)
176155
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitSHigh, firstbitshigh)
177156
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitLow, firstbitlow)

0 commit comments

Comments
 (0)