Skip to content

Commit 495bdaa

Browse files
committed
fixed tablegen mis indexing arguments and finally able to run tests locally
1 parent 0399f3c commit 495bdaa

File tree

6 files changed

+15
-31
lines changed

6 files changed

+15
-31
lines changed

clang/include/clang/Basic/Builtins.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5039,7 +5039,7 @@ def HLSLWaveActiveAnyTrue : LangBuiltin<"HLSL_LANG"> {
50395039
def HLSLWaveActiveBitOr : LangBuiltin<"HLSL_LANG"> {
50405040
let Spellings = ["__builtin_hlsl_wave_active_bit_or"];
50415041
let Attributes = [NoThrow, Const];
5042-
let Prototype = "void (...)";
5042+
let Prototype = "unsigned int (unsigned int)";
50435043
}
50445044

50455045
def HLSLWaveActiveCountBits : LangBuiltin<"HLSL_LANG"> {

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,9 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
835835
"Intrinsic WaveActiveBitOr operand must have a unsigned integer representation");
836836

837837
Intrinsic::ID ID = CGM.getHLSLRuntime().getWaveActiveBitOrIntrinsic();
838-
return EmitRuntimeCall(
839-
Intrinsic::getOrInsertDeclaration(&CGM.getModule(), ID), {Op});
838+
return EmitRuntimeCall(Intrinsic::getOrInsertDeclaration(
839+
&CGM.getModule(), ID, {Op->getType()}),
840+
ArrayRef{Op}, "hlsl.wave.active.bit.or");
840841
}
841842
case Builtin::BI__builtin_hlsl_wave_active_count_bits: {
842843
Value *OpExpr = EmitScalarExpr(E->getArg(0));

clang/test/CodeGenHLSL/builtins/WaveActiveBitOr.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// CHECK-LABEL: test_uint
1212
uint test_uint(uint expr) {
1313
// DXCHECK: %[[RET:.*]] = call [[TY:.*]] @llvm.[[ICF:dx]].wave.reduce.or.i32([[TY]] %[[#]])
14-
// SPVCHECK: %[[RET:.*]] = call [[TY:.*]] @llvm.[[ICF:spv]].wave.reduce.or.i32([[TY]] %[[#]])
14+
// SPVCHECK: %[[RET:.*]] = call spir_func [[TY:.*]] @llvm.[[ICF:spv]].wave.reduce.or.i32([[TY]] %[[#]])
1515
// CHECK: ret [[TY]] %[[RET]]
1616
return WaveActiveBitOr(expr);
1717
}
@@ -21,7 +21,7 @@ uint test_uint(uint expr) {
2121
// CHECK-LABEL: test_uint64_t
2222
uint64_t test_uint64_t(uint64_t expr) {
2323
// DXCHECK: %[[RET:.*]] = call [[TY:.*]] @llvm.[[ICF:dx]].wave.reduce.or.i64([[TY]] %[[#]])
24-
// SPVCHECK: %[[RET:.*]] = call [[TY:.*]] @llvm.[[ICF:spv]].wave.reduce.or.i64([[TY]] %[[#]])
24+
// SPVCHECK: %[[RET:.*]] = call spir_func [[TY:.*]] @llvm.[[ICF:spv]].wave.reduce.or.i64([[TY]] %[[#]])
2525
// CHECK: ret [[TY]] %[[RET]]
2626
return WaveActiveBitOr(expr);
2727
}

clang/test/SemaHLSL/BuiltIns/WaveActiveBitOr-errors.hlsl

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,17 @@ uint test_too_few_arg() {
55
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
66
}
77

8-
uint2 test_too_many_arg(uint2 p0) {
8+
uint test_too_many_arg(uint p0) {
99
return __builtin_hlsl_wave_active_bit_or(p0, p0);
1010
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
1111
}
1212

13-
uint test_expr_bool_type_check(bool p0) {
14-
return __builtin_hlsl_wave_active_bit_or(p0);
15-
// expected-error@-1 {{invalid operand of type 'bool'}}
16-
}
17-
18-
uint test_expr_float_type_check(float p0) {
19-
return __builtin_hlsl_wave_active_bit_or(p0);
20-
// expected-error@-1 {{invalid operand of type 'float'}}
21-
}
22-
23-
uint2 test_expr_bool_vec_type_check(bool2 p0) {
24-
return __builtin_hlsl_wave_active_bit_or(p0);
25-
// expected-error@-1 {{invalid operand of type 'bool2' (aka 'vector<bool, 2>')}}
26-
}
27-
28-
uint2 test_expr_float_type_check(float2 p0) {
29-
return __builtin_hlsl_wave_active_bit_or(p0);
30-
// expected-error@-1 {{invalid operand of type 'float2' (aka 'vector<float, 2>')}}
31-
}
32-
33-
struct S { float f; };
13+
struct Foo
14+
{
15+
int a;
16+
};
3417

35-
uint test_expr_struct_type_check(S p0) {
18+
uint test_type_check(Foo p0) {
3619
return __builtin_hlsl_wave_active_bit_or(p0);
37-
// expected-error@-1 {{invalid operand of type 'S' where a scalar or vector is required}}
20+
// expected-error@-1 {{no viable conversion from 'Foo' to 'unsigned int'}}
3821
}

llvm/include/llvm/IR/IntrinsicsDirectX.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def int_dx_wave_active_countbits : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i1
154154
def int_dx_wave_all : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_i1_ty], [IntrConvergent, IntrNoMem]>;
155155
def int_dx_wave_any : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_i1_ty], [IntrConvergent, IntrNoMem]>;
156156
def int_dx_wave_getlaneindex : DefaultAttrsIntrinsic<[llvm_i32_ty], [], [IntrConvergent, IntrNoMem]>;
157-
def int_dx_wave_reduce_or : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyint_ty], [IntrConvergent, IntrNoMem]>;
157+
def int_dx_wave_reduce_or : DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
158158
def int_dx_wave_reduce_max : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
159159
def int_dx_wave_reduce_umax : DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
160160
def int_dx_wave_reduce_min : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;

llvm/include/llvm/IR/IntrinsicsSPIRV.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def int_spv_rsqrt : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty]
120120
def int_spv_wave_active_countbits : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i1_ty], [IntrConvergent, IntrNoMem]>;
121121
def int_spv_wave_all : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_i1_ty], [IntrConvergent, IntrNoMem]>;
122122
def int_spv_wave_any : DefaultAttrsIntrinsic<[llvm_i1_ty], [llvm_i1_ty], [IntrConvergent, IntrNoMem]>;
123-
def int_spv_wave_reduce_or : DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyint_ty], [IntrConvergent, IntrNoMem]>;
123+
def int_spv_wave_reduce_or : DefaultAttrsIntrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
124124
def int_spv_wave_reduce_umax : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
125125
def int_spv_wave_reduce_max : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;
126126
def int_spv_wave_reduce_min : DefaultAttrsIntrinsic<[llvm_any_ty], [LLVMMatchType<0>], [IntrConvergent, IntrNoMem]>;

0 commit comments

Comments
 (0)