Debian Codegraph @

clang/test/SemaHLSL/Language/AggregateSplatCasts.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -fnative-half-type %s -ast-dump | FileCheck %s
2
3 // splat from vec1 to vec
4 // CHECK-LABEL: call1
5 // CHECK: CStyleCastExpr {{.*}} 'int3':'vector<int, 3>' <HLSLAggregateSplatCast>
6 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <FloatingToIntegral> part_of_explicit_cast
7 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <HLSLVectorTruncation> part_of_explicit_cast
8 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'float1':'vector<float, 1>' <LValueToRValue> part_of_explicit_cast
9 // CHECK-NEXT: DeclRefExpr {{.*}} 'float1':'vector<float, 1>' lvalue Var {{.*}} 'A' 'float1':'vector<float, 1>'
10 export void call1() {
11 float1 A = {1.0};
12 int3 B = (int3)A;
13 }
14
15 struct S {
16 int A;
17 float B;
18 int C;
19 float D;
20 };
21
22 // splat from scalar to aggregate
23 // CHECK-LABEL: call2
24 // CHECK: CStyleCastExpr {{.*}} 'S' <HLSLAggregateSplatCast>
25 // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 5
26 export void call2() {
27 S s = (S)5;
28 }