brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · f57ac60 Raw
38 lines · plain
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=spv2// 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=dx3 4struct S0 {5  float4 position[2];6  float4 color;7};8 9// CHECK: %struct.S0 = type { [2 x <4 x float>], <4 x float> }10 11// CHECK-SPIRV: @A0 = external hidden thread_local addrspace(7) externally_initialized constant [2 x <4 x float>], !spirv.Decorations ![[#MD_0:]]12// CHECK-SPIRV: @A2 = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations ![[#MD_2:]]13 14// CHECK:       define void @main0()15// CHECK-DXIL:          %A0 = call [2 x <4 x float>] @llvm.dx.load.input.a2v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison)16// CHECK-DXIL:  %[[#TMP0:]] = insertvalue %struct.S0 poison, [2 x <4 x float>] %A0, 017// CHECK-DXIL:          %A2 = call <4 x float> @llvm.dx.load.input.v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison)18// CHECK-DXIL:  %[[#TMP1:]] = insertvalue %struct.S0 %[[#TMP0]], <4 x float> %A2, 119 20// CHECK-SPIRV:   %[[#A0:]] = load [2 x <4 x float>], ptr addrspace(7) @A0, align 1621// CHECK-SPIRV: %[[#TMP0:]] = insertvalue %struct.S0 poison, [2 x <4 x float>] %[[#A0]], 022// CHECK-SPIRV:  %[[#A01:]] = load <4 x float>, ptr addrspace(7) @A2, align 1623// CHECK-SPIRV: %[[#TMP1:]] = insertvalue %struct.S0 %[[#TMP0]], <4 x float> %[[#A01]], 124 25// CHECK:        %[[#ARG:]] = alloca %struct.S0, align 1626// CHECK:                     store %struct.S0 %[[#TMP1]], ptr %[[#ARG]], align 1627// CHECK-DXIL:                call void @{{.*}}main0{{.*}}(ptr %[[#ARG]])28// CHECK-SPIRV:               call spir_func void @{{.*}}main0{{.*}}(ptr %[[#ARG]])29[shader("pixel")]30void main0(S0 p : A) {31  float tmp = p.position[0] + p.position[1] + p.color;32}33 34// CHECK-SPIRV: ![[#MD_0]] = !{![[#MD_1:]]}35// CHECK-SPIRV: ![[#MD_1]] = !{i32 30, i32 0}36// CHECK-SPIRV: ![[#MD_2]] = !{![[#MD_3:]]}37// CHECK-SPIRV: ![[#MD_3]] = !{i32 30, i32 2}38