diff --git a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.multiple-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV/type.constant-buffer.multiple-dimensions.hlsl deleted file mode 100644 index 039454fbe..000000000 --- a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.multiple-dimensions.hlsl +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: %dxc -T ps_6_0 -E main -fspv-target-env=universal1.5 - -struct Foo { - float4 a; - int2 b; -}; - -// CHECK: [[s01:%\w+]] = OpTypeStruct %v4float %v2int -// CHECK: [[s02:%\w+]] = OpTypeArray [[s01]] %uint_3 -// CHECK: [[s03:%\w+]] = OpTypeArray [[s02]] %uint_2 -// CHECK: [[s04:%\w+]] = OpTypePointer Uniform [[s03]] -ConstantBuffer myCB2[2][3] : register(b0, space1); - -struct VSOutput { - float2 TexCoord : TEXCOORD; -}; - -float4 main(VSOutput input) : SV_TARGET { - // CHECK: [[s05:%\w+]] = OpTypePointer Uniform %v4float - // CHECK: [[s06:%\w+]] = OpVariable [[s04:%\w+]] Uniform - // CHECK: OpAccessChain [[s05]] [[s06]] %int_1 %int_0 %int_0 - return float4(1.0, 1.0, 1.0, 1.0) * myCB2[1][0].a; -} diff --git a/tools/clang/test/CodeGenSPIRV/type.string.hlsl b/tools/clang/test/CodeGenSPIRV/type.string.hlsl deleted file mode 100644 index 92fd03d3c..000000000 --- a/tools/clang/test/CodeGenSPIRV/type.string.hlsl +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: %dxc -T cs_6_0 -E main - -// CHECK: {{%\d+}} = OpString "first string" -string first = "first string"; -// CHECK: {{%\d+}} = OpString "second string" -string second = "second string"; -// CHECK: {{%\d+}} = OpString "third string" -const string third = "third string"; -// CHECK-NOT: {{%\d+}} = OpString "first string" -const string a = "first string"; - -[numthreads(1,1,1)] -void main() { -} - diff --git a/tools/clang/test/CodeGenSPIRV/class.enum.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/class.enum.hlsl similarity index 67% rename from tools/clang/test/CodeGenSPIRV/class.enum.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/class.enum.hlsl index 856324fda..1b42c69a5 100644 --- a/tools/clang/test/CodeGenSPIRV/class.enum.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/class.enum.hlsl @@ -1,8 +1,8 @@ -// RUN: %dxc -T ps_6_2 -E PSMain +// RUN: %dxc -T ps_6_2 -E PSMain -fcgl %s -spirv | FileCheck %s // The value for the enum is stored in a variable, which will be optimized // away when optimizations are enabled. -// CHECK: [[enum_var:%\w+]] = OpVariable %_ptr_Private_int Private %int_1 +// CHECK: [[enum_var:%[a-zA-Z0-9_]+]] = OpVariable %_ptr_Private_int Private %int_1 struct TestStruct { enum EnumInTestStruct { A = 1, @@ -11,7 +11,7 @@ struct TestStruct { // CHECK: %testFunc = OpFunction %int // CHECK-NEXT: OpLabel -// CHECK-NEXT: [[ld:%\w+]] = OpLoad %int [[enum_var]] +// CHECK-NEXT: [[ld:%[a-zA-Z0-9_]+]] = OpLoad %int [[enum_var]] // CHECK-NEXT: OpReturnValue [[ld]] TestStruct::EnumInTestStruct testFunc() { return TestStruct::A; diff --git a/tools/clang/test/CodeGenSPIRV/type.array.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.array.hlsl similarity index 90% rename from tools/clang/test/CodeGenSPIRV/type.array.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.array.hlsl index 5bb94d4a7..1edf81dc9 100644 --- a/tools/clang/test/CodeGenSPIRV/type.array.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.array.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: %_arr_uint_uint_4 = OpTypeArray %uint %uint_4 diff --git a/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.buffer.hlsl similarity index 99% rename from tools/clang/test/CodeGenSPIRV/type.buffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.buffer.hlsl index 7c66fe325..aeb3aa345 100644 --- a/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.buffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T ps_6_0 -E main +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpCapability SampledBuffer // CHECK: OpCapability StorageImageExtendedFormats diff --git a/tools/clang/test/CodeGenSPIRV/type.cbuffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.hlsl similarity index 95% rename from tools/clang/test/CodeGenSPIRV/type.cbuffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.hlsl index 44db8a38a..a67931a29 100644 --- a/tools/clang/test/CodeGenSPIRV/type.cbuffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_MyCbuffer "type.MyCbuffer" // CHECK-NEXT: OpMemberName %type_MyCbuffer 0 "a" diff --git a/tools/clang/test/CodeGenSPIRV/type.cbuffer.including.resource.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.including.resource.hlsl similarity index 62% rename from tools/clang/test/CodeGenSPIRV/type.cbuffer.including.resource.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.including.resource.hlsl index 662d3d7e8..f00946720 100644 --- a/tools/clang/test/CodeGenSPIRV/type.cbuffer.including.resource.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.including.resource.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T ps_6_0 -E main +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK-NOT: OpDecorate %buf3 @@ -42,19 +42,19 @@ cbuffer buf3 : register(b2) { } float4 main(float2 uv : TEXCOORD) : SV_TARGET { -// CHECK: [[ptr_x:%\d+]] = OpAccessChain %_ptr_Uniform_v4float %buf2 %int_0 -// CHECK: [[x:%\d+]] = OpLoad %v4float [[ptr_x]] +// CHECK: [[ptr_x:%[0-9]+]] = OpAccessChain %_ptr_Uniform_v4float %buf2 %int_0 +// CHECK: [[x:%[0-9]+]] = OpLoad %v4float [[ptr_x]] -// CHECK: [[y:%\d+]] = OpLoad %type_2d_image %y -// CHECK: [[z:%\d+]] = OpLoad %type_sampler %z -// CHECK: [[yz:%\d+]] = OpSampledImage %type_sampled_image [[y]] [[z]] -// CHECK: [[sample0:%\d+]] = OpImageSampleImplicitLod %v4float [[yz]] -// CHECK: [[add0:%\d+]] = OpFAdd %v4float [[x]] [[sample0]] +// CHECK: [[y:%[0-9]+]] = OpLoad %type_2d_image %y +// CHECK: [[z:%[0-9]+]] = OpLoad %type_sampler %z +// CHECK: [[yz:%[0-9]+]] = OpSampledImage %type_sampled_image [[y]] [[z]] +// CHECK: [[sample0:%[0-9]+]] = OpImageSampleImplicitLod %v4float [[yz]] +// CHECK: [[add0:%[0-9]+]] = OpFAdd %v4float [[x]] [[sample0]] -// CHECK: [[y:%\d+]] = OpLoad %type_2d_image %y -// CHECK: [[w:%\d+]] = OpLoad %type_sampler %w -// CHECK: [[yw:%\d+]] = OpSampledImage %type_sampled_image [[y]] [[w]] -// CHECK: [[sample1:%\d+]] = OpImageSampleImplicitLod %v4float [[yw]] +// CHECK: [[y_0:%[0-9]+]] = OpLoad %type_2d_image %y +// CHECK: [[w:%[0-9]+]] = OpLoad %type_sampler %w +// CHECK: [[yw:%[0-9]+]] = OpSampledImage %type_sampled_image [[y_0]] [[w]] +// CHECK: [[sample1:%[0-9]+]] = OpImageSampleImplicitLod %v4float [[yw]] // CHECK: OpFAdd %v4float [[add0]] [[sample1]] return x + y.Sample(z, uv) + y.Sample(w, uv); } diff --git a/tools/clang/test/CodeGenSPIRV/type.class.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.class.hlsl similarity index 92% rename from tools/clang/test/CodeGenSPIRV/type.class.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.class.hlsl index 50f000217..1b410d73f 100644 --- a/tools/clang/test/CodeGenSPIRV/type.class.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.class.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %N "N" diff --git a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.assign.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.assign.hlsl similarity index 86% rename from tools/clang/test/CodeGenSPIRV/type.constant-buffer.assign.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.assign.hlsl index c6ee96ed8..cf1a39b3a 100644 --- a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.assign.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.assign.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_ConstantBuffer_S "type.ConstantBuffer.S" // CHECK-NEXT: OpMemberName %type_ConstantBuffer_S 0 "someFloat" @@ -24,7 +24,7 @@ void main() { // CHECK: %local = OpVariable %_ptr_Function_type_ConstantBuffer_S Function -// CHECK: [[val:%\d+]] = OpLoad %type_ConstantBuffer_S %buffer +// CHECK: [[val:%[0-9]+]] = OpLoad %type_ConstantBuffer_S %buffer // CHECK: OpStore %local [[val]] ConstantBuffer local; local = buffer; diff --git a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.bindless.array.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.bindless.array.hlsl similarity index 50% rename from tools/clang/test/CodeGenSPIRV/type.constant-buffer.bindless.array.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.bindless.array.hlsl index 78ce025e7..56513ea77 100644 --- a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.bindless.array.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.bindless.array.hlsl @@ -1,15 +1,15 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // Used for ConstantBuffer definition. -// CHECK: [[type_CB_PerDraw:%\w+]] = OpTypeStruct %mat4v4float +// CHECK: [[type_CB_PerDraw:%[a-zA-Z0-9_]+]] = OpTypeStruct %mat4v4float // Used for PerDraw local variable. -// CHECK: [[type_PerDraw:%\w+]] = OpTypeStruct %mat4v4float +// CHECK: [[type_PerDraw:%[a-zA-Z0-9_]+]] = OpTypeStruct %mat4v4float struct PerDraw { float4x4 Transform; }; -// CHECK: [[ptr_type_CB_PerDraw:%\w+]] = OpTypePointer Uniform [[type_CB_PerDraw]] +// CHECK: [[ptr_type_CB_PerDraw:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform [[type_CB_PerDraw]] // Used for ConstantBuffer to PerDraw type cast. @@ -23,9 +23,9 @@ struct VSInput { }; float4 main(in VSInput input) : SV_POSITION { -// CHECK: [[ptr:%\w+]] = OpAccessChain [[ptr_type_CB_PerDraw]] %PerDraws -// CHECK: [[cb_PerDraw:%\w+]] = OpLoad [[type_CB_PerDraw]] [[ptr]] -// CHECK: [[float4x4:%\w+]] = OpCompositeExtract %mat4v4float [[cb_PerDraw]] 0 +// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpAccessChain [[ptr_type_CB_PerDraw]] %PerDraws +// CHECK: [[cb_PerDraw:%[a-zA-Z0-9_]+]] = OpLoad [[type_CB_PerDraw]] [[ptr]] +// CHECK: [[float4x4:%[a-zA-Z0-9_]+]] = OpCompositeExtract %mat4v4float [[cb_PerDraw]] 0 // CHECK: OpCompositeConstruct [[type_PerDraw]] [[float4x4]] const PerDraw perDraw = PerDraws[input.DrawIdx]; return mul(float4(input.Position, 1.0f), perDraw.Transform); diff --git a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.hlsl similarity index 96% rename from tools/clang/test/CodeGenSPIRV/type.constant-buffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.hlsl index 0895ff7cd..c29b24320 100644 --- a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_ConstantBuffer_T "type.ConstantBuffer.T" // CHECK-NEXT: OpMemberName %type_ConstantBuffer_T 0 "a" diff --git a/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.multiple-dimensions.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.multiple-dimensions.hlsl new file mode 100644 index 000000000..651eaf0c5 --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.multiple-dimensions.hlsl @@ -0,0 +1,23 @@ +// RUN: %dxc -T ps_6_0 -E main -fspv-target-env=universal1.5 -fcgl %s -spirv | FileCheck %s + +struct Foo { + float4 a; + int2 b; +}; + +// CHECK: [[s01:%[a-zA-Z0-9_]+]] = OpTypeStruct %v4float %v2int +// CHECK: [[s02:%[a-zA-Z0-9_]+]] = OpTypeArray [[s01]] %uint_3 +// CHECK: [[s03:%[a-zA-Z0-9_]+]] = OpTypeArray [[s02]] %uint_2 +// CHECK: [[s04:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform [[s03]] +ConstantBuffer myCB2[2][3] : register(b0, space1); + +struct VSOutput { + float2 TexCoord : TEXCOORD; +}; + +float4 main(VSOutput input) : SV_TARGET { + // CHECK: [[s05:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform %v4float + // CHECK: [[s06:%[a-zA-Z0-9_]+]] = OpVariable [[s04_0:%[a-zA-Z0-9_]+]] Uniform + // CHECK: OpAccessChain [[s05]] [[s06]] %int_1 %int_0 %int_0 + return float4(1.0, 1.0, 1.0, 1.0) * myCB2[1][0].a; +} diff --git a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.return.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.return.hlsl similarity index 69% rename from tools/clang/test/CodeGenSPIRV/type.constant-buffer.return.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.return.hlsl index f366fd6a3..d538cabe7 100644 --- a/tools/clang/test/CodeGenSPIRV/type.constant-buffer.return.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.return.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_ConstantBuffer_S "type.ConstantBuffer.S" // CHECK-NEXT: OpMemberName %type_ConstantBuffer_S 0 "someFloat" @@ -17,7 +17,7 @@ struct S // CHECK: %_runtimearr_type_ConstantBuffer_S = OpTypeRuntimeArray %type_ConstantBuffer_S // CHECK: %_ptr_Uniform__runtimearr_type_ConstantBuffer_S = OpTypePointer Uniform %_runtimearr_type_ConstantBuffer_S -// CHECK: [[fnType:%\d+]] = OpTypeFunction %type_ConstantBuffer_S %_ptr_Function_uint +// CHECK: [[fnType:%[0-9]+]] = OpTypeFunction %type_ConstantBuffer_S %_ptr_Function_uint // CHECK: %buffers = OpVariable %_ptr_Uniform__runtimearr_type_ConstantBuffer_S Uniform ConstantBuffer buffers[]; @@ -26,14 +26,14 @@ ConstantBuffer buffers[]; ConstantBuffer getBuf(uint indx) { // CHECK-DAG: %temp_var_ret = OpVariable %_ptr_Function_type_ConstantBuffer_S Function -// CHECK-DAG: [[bufPtr:%\d+]] = OpAccessChain %_ptr_Uniform_type_ConstantBuffer_S %buffers [[indx:%\d+]] -// CHECK-DAG: [[bufVal:%\d+]] = OpLoad %type_ConstantBuffer_S [[bufPtr]] +// CHECK-DAG: [[bufPtr:%[0-9]+]] = OpAccessChain %_ptr_Uniform_type_ConstantBuffer_S %buffers [[indx:%[0-9]+]] +// CHECK-DAG: [[bufVal:%[0-9]+]] = OpLoad %type_ConstantBuffer_S [[bufPtr]] // CHECK-DAG: OpStore %temp_var_ret [[bufVal]] return buffers[indx]; }; void main() { -// CHECK-DAG: [[val:%\d+]] = OpFunctionCall %type_ConstantBuffer_S %getBuf %param_var_indx +// CHECK-DAG: [[val:%[0-9]+]] = OpFunctionCall %type_ConstantBuffer_S %getBuf %param_var_indx getBuf(1); } diff --git a/tools/clang/test/CodeGenSPIRV/type.enum.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.enum.hlsl similarity index 55% rename from tools/clang/test/CodeGenSPIRV/type.enum.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.enum.hlsl index 99ff513d9..38baa4d73 100644 --- a/tools/clang/test/CodeGenSPIRV/type.enum.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.enum.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T cs_6_0 -E main +// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s //CHECK: %First = OpVariable %_ptr_Private_int Private %int_0 //CHECK-NEXT: %Second = OpVariable %_ptr_Private_int Private %int_1 @@ -15,7 +15,7 @@ enum Number { //CHECK-NEXT: %b = OpVariable %_ptr_Workgroup_int Workgroup //CHECK-NEXT: %c = OpVariable %_ptr_Uniform_type_AppendStructuredBuffer_ Uniform -//CHECK: [[second:%\d+]] = OpLoad %int %Second +//CHECK: [[second:%[0-9]+]] = OpLoad %int %Second //CHECK-NEXT: OpStore %a [[second]] static ::Number a = Second; groupshared Number b; @@ -26,26 +26,26 @@ void testParamTypeCast(int param) {} [numthreads(1, 1, 1)] void main() { -//CHECK: [[a:%\d+]] = OpLoad %int %a +//CHECK: [[a:%[0-9]+]] = OpLoad %int %a //CHECK-NEXT: OpStore %foo [[a]] int foo = a; -//CHECK: [[fourth:%\d+]] = OpLoad %int %Fourth +//CHECK: [[fourth:%[0-9]+]] = OpLoad %int %Fourth //CHECK-NEXT: OpStore %b [[fourth]] b = Fourth; -//CHECK: [[c:%\d+]] = OpAccessChain %_ptr_Uniform_int %c %uint_0 -//CHECK-NEXT: [[third:%\d+]] = OpLoad %int %Third +//CHECK: [[c:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int %c %uint_0 +//CHECK-NEXT: [[third:%[0-9]+]] = OpLoad %int %Third //CHECK-NEXT: OpStore [[c]] [[third]] c.Append(Third); -//CHECK: [[c:%\d+]] = OpAccessChain %_ptr_Uniform_int %c %uint_0 %57 -//CHECK-NEXT: [[third:%\d+]] = OpLoad %int %Third -//CHECK-NEXT: OpStore [[c]] [[third]] +//CHECK: [[c_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_int %c %uint_0 %57 +//CHECK-NEXT: [[third_0:%[0-9]+]] = OpLoad %int %Third +//CHECK-NEXT: OpStore [[c_0]] [[third_0]] c.Append(Number::Third); Number d; -//CHECK: [[d:%\d+]] = OpLoad %int %d +//CHECK: [[d:%[0-9]+]] = OpLoad %int %d //CHECK-NEXT: OpSelectionMerge %switch_merge None //CHECK-NEXT: OpSwitch [[d]] %switch_default 0 %switch_0 1 %switch_1 switch (d) { @@ -60,39 +60,39 @@ void main() { break; } -//CHECK: [[fourth:%\d+]] = OpLoad %int %Fourth -//CHECK-NEXT: OpStore %e [[fourth]] +//CHECK: [[fourth_0:%[0-9]+]] = OpLoad %int %Fourth +//CHECK-NEXT: OpStore %e [[fourth_0]] static ::Number e = Fourth; -//CHECK: [[d:%\d+]] = OpLoad %int %d -//CHECK-NEXT: [[third:%\d+]] = OpLoad %int %Third -//CHECK-NEXT: OpSLessThan %bool [[d]] [[third]] +//CHECK: [[d_0:%[0-9]+]] = OpLoad %int %d +//CHECK-NEXT: [[third_1:%[0-9]+]] = OpLoad %int %Third +//CHECK-NEXT: OpSLessThan %bool [[d_0]] [[third_1]] if (d < Third) { -//CHECK: [[first:%\d+]] = OpLoad %int %First -//CHECK-NEXT: [[second:%\d+]] = OpLoad %int %Second -//CHECK-NEXT: [[add:%\d+]] = OpIAdd %int [[first]] [[second]] +//CHECK: [[first:%[0-9]+]] = OpLoad %int %First +//CHECK-NEXT: [[second_0:%[0-9]+]] = OpLoad %int %Second +//CHECK-NEXT: [[add:%[0-9]+]] = OpIAdd %int [[first]] [[second_0]] //CHECK-NEXT: OpStore %d [[add]] d = First + Second; } -//CHECK: [[foo:%\d+]] = OpLoad %int %foo -//CHECK-NEXT: [[foo:%\d+]] = OpBitcast %int [[foo]] -//CHECK-NEXT: OpStore %d [[foo]] +//CHECK: [[foo:%[0-9]+]] = OpLoad %int %foo +//CHECK-NEXT: [[foo_0:%[0-9]+]] = OpBitcast %int [[foo]] +//CHECK-NEXT: OpStore %d [[foo_0]] if (First < Third) d = (Number)foo; -//CHECK: [[a:%\d+]] = OpLoad %int %a -//CHECK-NEXT: OpStore %param_var_param [[a]] +//CHECK: [[a_0:%[0-9]+]] = OpLoad %int %a +//CHECK-NEXT: OpStore %param_var_param [[a_0]] //CHECK-NEXT: OpFunctionCall %void %testParam %param_var_param testParam(a); -//CHECK: [[second:%\d+]] = OpLoad %int %Second -//CHECK-NEXT: OpStore %param_var_param_0 [[second]] +//CHECK: [[second_1:%[0-9]+]] = OpLoad %int %Second +//CHECK-NEXT: OpStore %param_var_param_0 [[second_1]] //CHECK-NEXT: OpFunctionCall %void %testParam %param_var_param_0 testParam(Second); -//CHECK: [[a:%\d+]] = OpLoad %int %a -//CHECK-NEXT: OpStore %param_var_param_1 [[a]] +//CHECK: [[a_1:%[0-9]+]] = OpLoad %int %a +//CHECK-NEXT: OpStore %param_var_param_1 [[a_1]] //CHECK-NEXT: OpFunctionCall %void %testParamTypeCast %param_var_param_1 testParamTypeCast(a); @@ -100,9 +100,9 @@ void main() { //CHECK-NEXT: OpFunctionCall %void %testParamTypeCast %param_var_param_2 testParamTypeCast(Second); -//CHECK: [[a:%\d+]] = OpLoad %int %a -//CHECK-NEXT: [[a:%\d+]] = OpBitcast %float [[a]] -//CHECK-NEXT: [[sin:%\d+]] = OpExtInst %float {{%\d+}} Sin [[a]] +//CHECK: [[a_2:%[0-9]+]] = OpLoad %int %a +//CHECK-NEXT: [[a_3:%[0-9]+]] = OpBitcast %float [[a_2]] +//CHECK-NEXT: [[sin:%[0-9]+]] = OpExtInst %float {{%[0-9]+}} Sin [[a_3]] //CHECK-NEXT: OpStore %bar [[sin]] float bar = sin(a); } diff --git a/tools/clang/test/CodeGenSPIRV/type.runtime-array.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.runtime-array.hlsl similarity index 94% rename from tools/clang/test/CodeGenSPIRV/type.runtime-array.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.runtime-array.hlsl index 065cdbc83..c1296e7d6 100644 --- a/tools/clang/test/CodeGenSPIRV/type.runtime-array.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.runtime-array.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T ps_6_0 -E main +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpCapability RuntimeDescriptorArray diff --git a/tools/clang/test/CodeGenSPIRV/type.rwbuffer.half.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.rwbuffer.half.hlsl similarity index 85% rename from tools/clang/test/CodeGenSPIRV/type.rwbuffer.half.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.rwbuffer.half.hlsl index 86f4ee384..5edee137d 100644 --- a/tools/clang/test/CodeGenSPIRV/type.rwbuffer.half.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.rwbuffer.half.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T cs_6_0 -E main +// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: %type_buffer_image = OpTypeImage %float Buffer 2 0 0 2 Rgba16f // CHECK: %_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image diff --git a/tools/clang/test/CodeGenSPIRV/type.rwtexture.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.hlsl similarity index 97% rename from tools/clang/test/CodeGenSPIRV/type.rwtexture.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.hlsl index 7ca0bea0d..f901d44cf 100644 --- a/tools/clang/test/CodeGenSPIRV/type.rwtexture.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpCapability Image1D diff --git a/tools/clang/test/CodeGenSPIRV/type.rwtexture.with.64bit.scalar.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.64bit.scalar.hlsl similarity index 93% rename from tools/clang/test/CodeGenSPIRV/type.rwtexture.with.64bit.scalar.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.64bit.scalar.hlsl index 6da014685..0edfb6bdb 100644 --- a/tools/clang/test/CodeGenSPIRV/type.rwtexture.with.64bit.scalar.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.64bit.scalar.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T cs_6_0 -E main +// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: %type_2d_image = OpTypeImage %ulong 2D 2 0 0 2 R64ui // CHECK: %_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image diff --git a/tools/clang/test/CodeGenSPIRV/type.rwtexture.with.min.precision.scalar.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.min.precision.scalar.hlsl similarity index 93% rename from tools/clang/test/CodeGenSPIRV/type.rwtexture.with.min.precision.scalar.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.min.precision.scalar.hlsl index 111f3eaea..9c8aa6670 100644 --- a/tools/clang/test/CodeGenSPIRV/type.rwtexture.with.min.precision.scalar.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.rwtexture.with.min.precision.scalar.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T cs_6_0 -E main +// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: %type_2d_image = OpTypeImage %float 2D 2 0 0 2 Rgba16f // CHECK: %_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image diff --git a/tools/clang/test/CodeGenSPIRV/type.sampler.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.sampler.hlsl similarity index 89% rename from tools/clang/test/CodeGenSPIRV/type.sampler.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.sampler.hlsl index 5404e4e11..a5d4cdff4 100644 --- a/tools/clang/test/CodeGenSPIRV/type.sampler.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.sampler.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: %type_sampler = OpTypeSampler // CHECK: %_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler diff --git a/tools/clang/test/CodeGenSPIRV_Lit/type.string.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.string.hlsl new file mode 100644 index 000000000..0edb63a9d --- /dev/null +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.string.hlsl @@ -0,0 +1,15 @@ +// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s + +// CHECK: {{%[0-9]+}} = OpString "first string" +string first = "first string"; +// CHECK: {{%[0-9]+}} = OpString "second string" +string second = "second string"; +// CHECK: {{%[0-9]+}} = OpString "third string" +const string third = "third string"; +// CHECK-NOT: {{%[0-9]+}} = OpString "first string" +const string a = "first string"; + +[numthreads(1,1,1)] +void main() { +} + diff --git a/tools/clang/test/CodeGenSPIRV/type.structured-buffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.hlsl similarity index 96% rename from tools/clang/test/CodeGenSPIRV/type.structured-buffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.hlsl index fb26d61ce..be88684e1 100644 --- a/tools/clang/test/CodeGenSPIRV/type.structured-buffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T ps_6_0 -E main -fspv-reflect +// RUN: %dxc -T ps_6_0 -E main -fspv-reflect -fcgl %s -spirv | FileCheck %s // CHECK: OpExtension "SPV_GOOGLE_hlsl_functionality1" diff --git a/tools/clang/test/CodeGenSPIRV/type.structured-buffer.vector.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.vector.hlsl similarity index 86% rename from tools/clang/test/CodeGenSPIRV/type.structured-buffer.vector.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.vector.hlsl index 1d664c89d..92e5aecc9 100644 --- a/tools/clang/test/CodeGenSPIRV/type.structured-buffer.vector.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.structured-buffer.vector.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T ps_6_0 -E main +// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpDecorate %_runtimearr_v3uint ArrayStride 16 // CHECK: OpDecorate %type_StructuredBuffer_v3uint BufferBlock diff --git a/tools/clang/test/CodeGenSPIRV/type.tbuffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.tbuffer.hlsl similarity index 95% rename from tools/clang/test/CodeGenSPIRV/type.tbuffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.tbuffer.hlsl index 8900a8322..83df386ee 100644 --- a/tools/clang/test/CodeGenSPIRV/type.tbuffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.tbuffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_MyTbuffer "type.MyTbuffer" // CHECK-NEXT: OpMemberName %type_MyTbuffer 0 "a" diff --git a/tools/clang/test/CodeGenSPIRV/type.texture-buffer.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.texture-buffer.hlsl similarity index 96% rename from tools/clang/test/CodeGenSPIRV/type.texture-buffer.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.texture-buffer.hlsl index 8afcd18fc..a21e2745e 100644 --- a/tools/clang/test/CodeGenSPIRV/type.texture-buffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.texture-buffer.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpName %type_TextureBuffer_T "type.TextureBuffer.T" // CHECK-NEXT: OpMemberName %type_TextureBuffer_T 0 "a" diff --git a/tools/clang/test/CodeGenSPIRV/type.texture.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.texture.hlsl similarity index 98% rename from tools/clang/test/CodeGenSPIRV/type.texture.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.texture.hlsl index 03f443b73..1e1004a64 100644 --- a/tools/clang/test/CodeGenSPIRV/type.texture.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.texture.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s // CHECK: OpCapability Sampled1D diff --git a/tools/clang/test/CodeGenSPIRV/type.typedef.hlsl b/tools/clang/test/CodeGenSPIRV_Lit/type.typedef.hlsl similarity index 87% rename from tools/clang/test/CodeGenSPIRV/type.typedef.hlsl rename to tools/clang/test/CodeGenSPIRV_Lit/type.typedef.hlsl index bf3d2d5a6..02e3d3ede 100644 --- a/tools/clang/test/CodeGenSPIRV/type.typedef.hlsl +++ b/tools/clang/test/CodeGenSPIRV_Lit/type.typedef.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -T vs_6_0 -E main +// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s typedef int myInt; typedef const uint myConstUint; diff --git a/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp b/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp index eb5c171af..0665133db 100644 --- a/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp +++ b/tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp @@ -24,54 +24,6 @@ TEST_F(FileTest, StructTypeEmptyStructArrayStride) { TEST_F(FileTest, StructTypeUniqueness) { runFileTest("type.struct.uniqueness.hlsl"); } -TEST_F(FileTest, StringTypes) { runFileTest("type.string.hlsl"); } -TEST_F(FileTest, ClassTypes) { runFileTest("type.class.hlsl"); } -TEST_F(FileTest, ArrayTypes) { runFileTest("type.array.hlsl"); } -TEST_F(FileTest, RuntimeArrayTypes) { runFileTest("type.runtime-array.hlsl"); } -TEST_F(FileTest, TypedefTypes) { runFileTest("type.typedef.hlsl"); } -TEST_F(FileTest, SamplerTypes) { runFileTest("type.sampler.hlsl"); } -TEST_F(FileTest, TextureTypes) { runFileTest("type.texture.hlsl"); } -TEST_F(FileTest, RWTextureTypes) { runFileTest("type.rwtexture.hlsl"); } -TEST_F(FileTest, RWTextureTypesWithMinPrecisionScalarTypes) { - runFileTest("type.rwtexture.with.min.precision.scalar.hlsl"); -} -TEST_F(FileTest, RWTextureTypesWith64bitsScalarTypes) { - runFileTest("type.rwtexture.with.64bit.scalar.hlsl"); -} -TEST_F(FileTest, BufferType) { runFileTest("type.buffer.hlsl"); } - -TEST_F(FileTest, RWBufferTypeHalfElementType) { - runFileTest("type.rwbuffer.half.hlsl"); -} -TEST_F(FileTest, CBufferType) { runFileTest("type.cbuffer.hlsl"); } -TEST_F(FileTest, TypeCBufferIncludingResource) { - runFileTest("type.cbuffer.including.resource.hlsl"); -} -TEST_F(FileTest, ConstantBufferType) { - runFileTest("type.constant-buffer.hlsl"); -} -TEST_F(FileTest, ConstantBufferTypeAssign) { - runFileTest("type.constant-buffer.assign.hlsl"); -} -TEST_F(FileTest, ConstantBufferTypeReturn) { - runFileTest("type.constant-buffer.return.hlsl"); -} -TEST_F(FileTest, ConstantBufferTypeMultiDimensionalArray) { - runFileTest("type.constant-buffer.multiple-dimensions.hlsl"); -} -TEST_F(FileTest, BindlessConstantBufferArrayType) { - runFileTest("type.constant-buffer.bindless.array.hlsl"); -} -TEST_F(FileTest, EnumType) { runFileTest("type.enum.hlsl"); } -TEST_F(FileTest, ClassEnumType) { runFileTest("class.enum.hlsl"); } -TEST_F(FileTest, TBufferType) { runFileTest("type.tbuffer.hlsl"); } -TEST_F(FileTest, TextureBufferType) { runFileTest("type.texture-buffer.hlsl"); } -TEST_F(FileTest, StructuredBufferType) { - runFileTest("type.structured-buffer.hlsl"); -} -TEST_F(FileTest, StructuredBufferTypeWithVector) { - runFileTest("type.structured-buffer.vector.hlsl"); -} // Test shaders that require Vulkan1.1 support with // -fspv-target-env=vulkan1.2 option to make sure that enabling