llvm-project/clang/test/SemaHLSL/BuiltIns/WaveActiveSum-errors.hlsl
Adam Yang 4446a9849a
[HLSL][SPIRV][DXIL] Implement WaveActiveSum intrinsic (#118580)
```    - add clang builtin to Builtins.td
      - link builtin in hlsl_intrinsics
      - add codegen for spirv intrinsic and two directx intrinsics to retain
        signedness information of the operands in CGBuiltin.cpp
      - add semantic analysis in SemaHLSL.cpp
      - add lowering of spirv intrinsic to spirv backend in
        SPIRVInstructionSelector.cpp
      - add lowering of directx intrinsics to WaveActiveOp dxil op in
    DXIL.td

      - add test cases to illustrate passespendent pr merges.
```
Resolves #70106

---------

Co-authored-by: Finn Plummer <canadienfinn@gmail.com>
2025-01-16 10:35:23 -08:00

29 lines
986 B
HLSL

// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -emit-llvm-only -disable-llvm-passes -verify
int test_too_few_arg() {
return __builtin_hlsl_wave_active_sum();
// expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
}
float2 test_too_many_arg(float2 p0) {
return __builtin_hlsl_wave_active_sum(p0, p0);
// expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
}
bool test_expr_bool_type_check(bool p0) {
return __builtin_hlsl_wave_active_sum(p0);
// expected-error@-1 {{invalid operand of type 'bool'}}
}
bool2 test_expr_bool_vec_type_check(bool2 p0) {
return __builtin_hlsl_wave_active_sum(p0);
// expected-error@-1 {{invalid operand of type 'bool2' (aka 'vector<bool, 2>')}}
}
struct S { float f; };
S test_expr_struct_type_check(S p0) {
return __builtin_hlsl_wave_active_sum(p0);
// expected-error@-1 {{invalid operand of type 'S' where a scalar or vector is required}}
}