Debian Codegraph @

clang/test/CodeGenHLSL/semantics/semantic.array.output.hlsl

raw
1 // RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV -DTARGET=spv
2 // RUN: %clang_cc1 -triple dxil-px-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL -DTARGET=dx
3
4 struct S0 {
5 float4 position[2];
6 float4 color;
7 };
8
9 // CHECK-SPIRV-DAG: @A0 = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations ![[#METADATA_0:]]
10
11 [shader("pixel")]
12 S0 main1(float4 input : A) : B {
13 // CHECK: %[[#ARG:]] = alloca %struct.S0, align 16
14 // CHECK-SPIRV: %[[#INPUT:]] = load <4 x float>, ptr addrspace(7) @A0, align 16
15 // CHECK-DXIL: %A0 = call <4 x float> @llvm.dx.load.input.v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison)
16 // CHECK-DXIL: call void @{{.*}}main1{{.*}}(ptr %[[#ARG]], <4 x float> %A0)
17 // CHECK-SPIRV: call spir_func void @{{.*}}main1{{.*}}(ptr %[[#ARG]], <4 x float> %[[#INPUT]])
18
19 // CHECK: %[[#ST:]] = load %struct.S0, ptr %[[#ARG]], align 16
20 // CHECK: %[[#TMP:]] = extractvalue %struct.S0 %[[#ST]], 0
21 // CHECK-SPIRV: store [2 x <4 x float>] %[[#TMP]], ptr addrspace(8) @B0, align 16
22 // CHECK-DXIL: call void @llvm.dx.store.output.a2v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison, [2 x <4 x float>] %[[#TMP]])
23 // CHECK: %[[#TMP:]] = extractvalue %struct.S0 %[[#ST]], 1
24 // CHECK-SPIRV: store <4 x float> %[[#TMP]], ptr addrspace(8) @B2, align 16
25 // CHECK-DXIL: call void @llvm.dx.store.output.v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison, <4 x float> %[[#TMP]])
26
27 S0 output;
28 output.position[0] = input;
29 output.position[1] = input;
30 output.color = input;
31 return output;
32 }
33
34 // CHECK-SPIRV-DAG: ![[#METADATA_0]] = !{![[#METADATA_1:]]}
35 // CHECK-SPIRV-DAG: ![[#METADATA_1]] = !{i32 30, i32 0}
36 // | `- Location index
37 // `-> Decoration "Location"