Skip to content

Commit c316336

Browse files
committed
remove CGHLSLRuntime.h changes
1 parent 70e76cd commit c316336

File tree

4 files changed

+38
-54
lines changed

4 files changed

+38
-54
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ backend:SPIR-V:
663663
- clang/lib/Driver/ToolChains/SPIRV.*
664664
- clang/lib/Sema/SemaSPIRV.cpp
665665
- clang/include/clang/Sema/SemaSPIRV.h
666+
- clang/include/clang/Basic/BuiltinsSPIRV.td
666667
- llvm/lib/Target/SPIRV/**
667668
- llvm/test/CodeGen/SPIRV/**
668669
- llvm/test/Frontend/HLSL/**

clang/include/clang/Sema/SemaSPIRV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ class SemaSPIRV : public SemaBase {
2626
};
2727
} // namespace clang
2828

29-
#endif // LLVM_CLANG_SEMA_SEMASPIRV_H
29+
#endif // LLVM_CLANG_SEMA_SEMASPIRV_H

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,22 @@
3030
#include <optional>
3131
#include <vector>
3232

33-
#define GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FunctionName, \
34-
IntrinsicPostfix) \
35-
GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix, 1, 1)
36-
3733
// A function generator macro for picking the right intrinsic
3834
// for the target backend
39-
#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix, \
40-
IncludeDXIL, IncludeSPIRV) \
35+
#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix) \
4136
llvm::Intrinsic::ID get##FunctionName##Intrinsic() { \
4237
llvm::Triple::ArchType Arch = getArch(); \
4338
switch (Arch) { \
44-
/* Include DXIL case only if IncludeDXIL is true */ \
45-
IF_INCLUDE(IncludeDXIL, case llvm::Triple::dxil \
46-
: return llvm::Intrinsic::dx_##IntrinsicPostfix;) \
47-
/* Include SPIRV case only if IncludeSPIRV is true */ \
48-
IF_INCLUDE(IncludeSPIRV, case llvm::Triple::spirv \
49-
: return llvm::Intrinsic::spv_##IntrinsicPostfix;) \
50-
\
39+
case llvm::Triple::dxil: \
40+
return llvm::Intrinsic::dx_##IntrinsicPostfix; \
41+
case llvm::Triple::spirv: \
42+
return llvm::Intrinsic::spv_##IntrinsicPostfix; \
5143
default: \
5244
llvm_unreachable("Intrinsic " #IntrinsicPostfix \
5345
" not supported by target architecture"); \
5446
} \
5547
}
5648

57-
#define IF_INCLUDE(Condition, Code) IF_INCLUDE_IMPL(Condition, Code)
58-
#define IF_INCLUDE_IMPL(Condition, Code) IF_INCLUDE_##Condition(Code)
59-
60-
#define IF_INCLUDE_1(Code) Code
61-
#define IF_INCLUDE_0(Code)
62-
6349
namespace llvm {
6450
class GlobalVariable;
6551
class Function;
@@ -86,39 +72,36 @@ class CGHLSLRuntime {
8672
// Start of reserved area for HLSL intrinsic getters.
8773
//===----------------------------------------------------------------------===//
8874

89-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(All, all)
90-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Any, any)
91-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Cross, cross)
92-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Degrees, degrees)
93-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Frac, frac)
94-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Lerp, lerp)
95-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Normalize, normalize)
96-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Rsqrt, rsqrt)
97-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Saturate, saturate)
98-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Sign, sign)
99-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Step, step)
100-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Radians, radians)
101-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(ThreadId, thread_id)
102-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FDot, fdot)
103-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(SDot, sdot)
104-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(UDot, udot)
105-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Dot4AddI8Packed, dot4add_i8packed)
106-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(Dot4AddU8Packed, dot4add_u8packed)
107-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(WaveActiveAnyTrue, wave_any)
108-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(WaveActiveCountBits,
109-
wave_active_countbits)
110-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(WaveIsFirstLane, wave_is_first_lane)
111-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(WaveReadLaneAt, wave_readlane)
112-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FirstBitUHigh, firstbituhigh)
113-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FirstBitSHigh, firstbitshigh)
114-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(NClamp, nclamp)
115-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(SClamp, sclamp)
116-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(UClamp, uclamp)
117-
118-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(CreateHandleFromBinding,
119-
handle_fromBinding)
120-
GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(BufferUpdateCounter,
121-
bufferUpdateCounter)
75+
GENERATE_HLSL_INTRINSIC_FUNCTION(All, all)
76+
GENERATE_HLSL_INTRINSIC_FUNCTION(Any, any)
77+
GENERATE_HLSL_INTRINSIC_FUNCTION(Cross, cross)
78+
GENERATE_HLSL_INTRINSIC_FUNCTION(Degrees, degrees)
79+
GENERATE_HLSL_INTRINSIC_FUNCTION(Frac, frac)
80+
GENERATE_HLSL_INTRINSIC_FUNCTION(Lerp, lerp)
81+
GENERATE_HLSL_INTRINSIC_FUNCTION(Normalize, normalize)
82+
GENERATE_HLSL_INTRINSIC_FUNCTION(Rsqrt, rsqrt)
83+
GENERATE_HLSL_INTRINSIC_FUNCTION(Saturate, saturate)
84+
GENERATE_HLSL_INTRINSIC_FUNCTION(Sign, sign)
85+
GENERATE_HLSL_INTRINSIC_FUNCTION(Step, step)
86+
GENERATE_HLSL_INTRINSIC_FUNCTION(Radians, radians)
87+
GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
88+
GENERATE_HLSL_INTRINSIC_FUNCTION(FDot, fdot)
89+
GENERATE_HLSL_INTRINSIC_FUNCTION(SDot, sdot)
90+
GENERATE_HLSL_INTRINSIC_FUNCTION(UDot, udot)
91+
GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddI8Packed, dot4add_i8packed)
92+
GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddU8Packed, dot4add_u8packed)
93+
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAnyTrue, wave_any)
94+
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveCountBits, wave_active_countbits)
95+
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveIsFirstLane, wave_is_first_lane)
96+
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveReadLaneAt, wave_readlane)
97+
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitUHigh, firstbituhigh)
98+
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitSHigh, firstbitshigh)
99+
GENERATE_HLSL_INTRINSIC_FUNCTION(NClamp, nclamp)
100+
GENERATE_HLSL_INTRINSIC_FUNCTION(SClamp, sclamp)
101+
GENERATE_HLSL_INTRINSIC_FUNCTION(UClamp, uclamp)
102+
103+
GENERATE_HLSL_INTRINSIC_FUNCTION(CreateHandleFromBinding, handle_fromBinding)
104+
GENERATE_HLSL_INTRINSIC_FUNCTION(BufferUpdateCounter, bufferUpdateCounter)
122105

123106
//===----------------------------------------------------------------------===//
124107
// End of reserved area for HLSL intrinsic getters.

clang/lib/Sema/SemaSPIRV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID,
7474
}
7575
return false;
7676
}
77-
} // namespace clang
77+
} // namespace clang

0 commit comments

Comments
 (0)