Debian Codegraph @

clang/test/SemaHLSL/VectorOverloadResolution.hlsl

raw
1 // RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.6-library -S -fnative-half-type -fnative-int16-type -finclude-default-header -o - -ast-dump %s | FileCheck %s
2 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -fnative-int16-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s --check-prefixes=CHECKIR
3 void Fn(double2 D);
4 void Fn(half2 H);
5
6 // CHECK: FunctionDecl {{.*}} Call 'void (float2)'
7 // CHECK: CallExpr {{.*}}'void'
8 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(double2)' <FunctionToPointerDecay>
9 // CHECK-NEXT: DeclRefExpr {{.*}}'void (double2)' lvalue Function {{.*}} 'Fn' 'void (double2)'
10 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<double, 2>' <FloatingCast>
11 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'float2':'vector<float, 2>' <LValueToRValue>
12 // CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue ParmVar {{.*}} 'F' 'float2':'vector<float, 2>'
13
14 void Call(float2 F) {
15 Fn(F);
16 }
17
18 void Fn2(int64_t2 L);
19 void Fn2(int16_t2 S);
20
21 // CHECK: FunctionDecl {{.*}} Call2 'void (int2)'
22 // CHECK: CallExpr {{.*}} 'void'
23 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
24 // CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn2' 'void (int64_t2)'
25 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <IntegralCast>
26 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int2':'vector<int, 2>' <LValueToRValue>
27 // CHECK-NEXT: DeclRefExpr {{.*}} 'int2':'vector<int, 2>' lvalue ParmVar {{.*}} 'I' 'int2':'vector<int, 2>'
28
29 void Call2(int2 I) {
30 Fn2(I);
31 }
32
33 void Fn3( int64_t2 p0);
34
35 // CHECK: FunctionDecl {{.*}} Call3 'void (half2)'
36 // CHECK: CallExpr {{.*}} 'void'
37 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
38 // CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn3' 'void (int64_t2)'
39 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <FloatingToIntegral>
40 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'half2':'vector<half, 2>' <LValueToRValue>
41 // CHECK-NEXT: DeclRefExpr {{.*}} 'half2':'vector<half, 2>' lvalue ParmVar {{.*}} 'p0' 'half2':'vector<half, 2>'
42 // CHECKIR-LABEL: Call3
43 // CHECKIR: {{.*}} = fptosi <2 x half> {{.*}} to <2 x i64>
44 void Call3(half2 p0) {
45 Fn3(p0);
46 }
47
48 // CHECK: FunctionDecl {{.*}} Call4 'void (float2)'
49 // CHECK: CallExpr {{.*}} 'void'
50 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
51 // CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn3' 'void (int64_t2)'
52 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <FloatingToIntegral>
53 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'float2':'vector<float, 2>' <LValueToRValue>
54 // CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue ParmVar {{.*}} 'p0' 'float2':'vector<float, 2>'
55 // CHECKIR-LABEL: Call4
56 // CHECKIR: {{.*}} = fptosi <2 x float> {{.*}} to <2 x i64>
57 void Call4(float2 p0) {
58 Fn3(p0);
59 }
60
61 void Fn4( float2 p0);
62
63 // CHECK: FunctionDecl {{.*}} Call5 'void (int64_t2)'
64 // CHECK: CallExpr {{.*}} 'void'
65 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(float2)' <FunctionToPointerDecay>
66 // CHECK-NEXT: DeclRefExpr {{.*}} 'void (float2)' lvalue Function {{.*}} 'Fn4' 'void (float2)'
67 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<float, 2>' <IntegralToFloating>
68 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'int64_t2':'vector<int64_t, 2>' <LValueToRValue>
69 // CHECK-NEXT: DeclRefExpr {{.*}} 'int64_t2':'vector<int64_t, 2>' lvalue ParmVar {{.*}} 'p0' 'int64_t2':'vector<int64_t, 2>'
70 // CHECKIR-LABEL: Call5
71 // CHECKIR: {{.*}} = sitofp <2 x i64> {{.*}} to <2 x float>
72 void Call5(int64_t2 p0) {
73 Fn4(p0);
74 }