2
0
Эх сурвалжийг харах

Start organizing codegen tests

This is mostly just starting to move the codegen tests in a directory structure, but I've improved a few tests along the way (change ps to vs, move // CHECK lines near what they're testing, change floats to ints, etc.).
Tristan Labelle 6 жил өмнө
parent
commit
15f30121b6
62 өөрчлөгдсөн 380 нэмэгдсэн , 427 устгасан
  1. 100 0
      tools/clang/test/CodeGenHLSL/declarations/bool_representation/buffer_load_store.hlsl
  2. 0 0
      tools/clang/test/CodeGenHLSL/declarations/bool_representation/cbuffer_load_whole_matrix.hlsl
  3. 54 0
      tools/clang/test/CodeGenHLSL/declarations/bool_representation/local_load_store.hlsl
  4. 55 0
      tools/clang/test/CodeGenHLSL/declarations/constant_buffers/layout.hlsl
  5. 50 0
      tools/clang/test/CodeGenHLSL/declarations/globals/no_initialization.hlsl
  6. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/cbuffer_load.hlsl
  7. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/input_column_major.hlsl
  8. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/input_row_major.hlsl
  9. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/output_param.hlsl
  10. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/output_return.hlsl
  11. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/preserved_with_typedef.hlsl
  12. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_load_struct.hlsl
  13. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_store.hlsl
  14. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_store_struct.hlsl
  15. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/transpose_in_function.hlsl
  16. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/truncation_column_major.hlsl
  17. 0 0
      tools/clang/test/CodeGenHLSL/declarations/matrix_pack/truncation_row_major.hlsl
  18. 23 0
      tools/clang/test/CodeGenHLSL/declarations/structs/anonymous.hlsl
  19. 2 2
      tools/clang/test/CodeGenHLSL/declarations/structs/bitfields_error.hlsl
  20. 4 2
      tools/clang/test/CodeGenHLSL/declarations/structs/builtin_types_no_inheritance.hlsl
  21. 13 0
      tools/clang/test/CodeGenHLSL/declarations/structs/declaration_in_return_type.hlsl
  22. 25 0
      tools/clang/test/CodeGenHLSL/declarations/structs/empty.hlsl
  23. 37 0
      tools/clang/test/CodeGenHLSL/declarations/structured_buffers/layout.hlsl
  24. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_scalar.hlsl
  25. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_struct.hlsl
  26. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_vector.hlsl
  27. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_array.hlsl
  28. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_array_return_vector.hlsl
  29. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_scalar.hlsl
  30. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_struct.hlsl
  31. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_vector.hlsl
  32. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_array.hlsl
  33. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_array_return_scalar.hlsl
  34. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_matrix.hlsl
  35. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_struct.hlsl
  36. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_vector.hlsl
  37. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_array.hlsl
  38. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_array_return_vector.hlsl
  39. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_vector.hlsl
  40. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_array.hlsl
  41. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_array_return_vector.hlsl
  42. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_matrix.hlsl
  43. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_scalar.hlsl
  44. 0 0
      tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_struct.hlsl
  45. 0 0
      tools/clang/test/CodeGenHLSL/expressions/operators/matrices/arithmetic.hlsl
  46. 0 0
      tools/clang/test/CodeGenHLSL/expressions/operators/matrices/increment_decrement.hlsl
  47. 0 0
      tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_Zpc.hlsl
  48. 0 0
      tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_Zpr.hlsl
  49. 0 0
      tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_ast.hlsl
  50. 0 0
      tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/pragma_granularity.hlsl
  51. 0 0
      tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/pragma_granularity_template_syntax.hlsl
  52. 0 12
      tools/clang/test/CodeGenHLSL/quick-test/anon_struct.hlsl
  53. 0 9
      tools/clang/test/CodeGenHLSL/quick-test/arrays_cast_to_vector.hlsl
  54. 0 110
      tools/clang/test/CodeGenHLSL/quick-test/bool_loadbuf_storebuf_memrepr.hlsl
  55. 0 52
      tools/clang/test/CodeGenHLSL/quick-test/bool_memrepr.hlsl
  56. 0 61
      tools/clang/test/CodeGenHLSL/quick-test/disasm_struct_layout_ctbuffer.hlsl
  57. 0 37
      tools/clang/test/CodeGenHLSL/quick-test/disasm_struct_layout_structbuf.hlsl
  58. 0 19
      tools/clang/test/CodeGenHLSL/quick-test/empty_struct.hlsl
  59. 0 20
      tools/clang/test/CodeGenHLSL/quick-test/empty_struct2.hlsl
  60. 0 68
      tools/clang/test/CodeGenHLSL/quick-test/global-var-no-init.hlsl
  61. 0 35
      tools/clang/test/CodeGenHLSL/quick-test/pack_matrix.hlsl
  62. 17 0
      tools/clang/unittests/HLSL/CompilerTest.cpp

+ 100 - 0
tools/clang/test/CodeGenHLSL/declarations/bool_representation/buffer_load_store.hlsl

@@ -0,0 +1,100 @@
+// RUN: %dxc -E main -T vs_6_0 -O0 %s | FileCheck %s
+
+// Ensure that bools are converted from/to their memory representation when loaded/stored in buffers
+
+struct AllTheBools
+{
+    bool2x2 m;
+    bool2 v;
+    bool s;
+    bool2x2 ma[2];
+    bool2 va[2];
+    bool sa[2];
+};
+
+ConstantBuffer<AllTheBools> cb;
+StructuredBuffer<AllTheBools> sb;
+RWStructuredBuffer<AllTheBools> rwsb;
+
+int main(int i : IN) : OUT
+{
+    int result = 0;
+
+    // Constant buffer loads
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+    // CHECK: extractvalue %dx.types.CBufRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    if (cb.m._22 && cb.v.y && cb.s
+        && cb.ma[1]._22 && cb.va[1].y && cb.sa[1])
+    {
+        result++;
+    }
+    
+    // Structured buffer loads
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
+    // CHECK: extractvalue %dx.types.ResRet.i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    if (sb[0].m._22 && sb[0].v.y && sb[0].s
+        && sb[0].ma[1]._22 && sb[0].va[1].y && sb[0].sa[1])
+    {
+        result++;
+    }
+
+    // Structured buffer stores
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: call void @dx.op.bufferStore.i32
+    rwsb[0].m._22 = i == 42;
+    rwsb[0].v.y = i == 42;
+    rwsb[0].s = i == 42;
+    rwsb[0].ma[1]._22 = i == 42;
+    rwsb[0].va[1].y = i == 42;
+    rwsb[0].sa[1] = i == 42;
+
+    return result;
+}

+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/bool_matrix_cbuflegacy_conversion.hlsl → tools/clang/test/CodeGenHLSL/declarations/bool_representation/cbuffer_load_whole_matrix.hlsl


+ 54 - 0
tools/clang/test/CodeGenHLSL/declarations/bool_representation/local_load_store.hlsl

@@ -0,0 +1,54 @@
+// RUN: %dxc -E main -T vs_6_0 -O0 %s | FileCheck %s
+
+// Ensure that bools are converted from/to their memory representation when loaded/stored
+// in local variables.
+
+// Local variables should never be i1s
+// CHECK-NOT: alloca {{.*}}i1
+
+int main(int i : I) : OUT
+{
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool s = i == 42;
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool1 v = i == 42;
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool1x1 m = i == 42;
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool sa[1] = { i == 42 };
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool1 va[1] = { i == 42 };
+    // CHECK: icmp eq i32 {{.*}}, 42
+    // CHECK: zext i1 {{.*}} to i32
+    // CHECK: store i32
+    bool1x1 ma[1] = { i == 42 };
+
+    // CHECK: load i32
+    // CHECK: icmp ne i32 {{.*}}, 0
+    return (s
+        // CHECK: load i32
+        // CHECK: icmp ne i32 {{.*}}, 0
+        && v.x
+        // CHECK: load i32
+        // CHECK: icmp ne i32 {{.*}}, 0
+        && m._11
+        // CHECK: load i32
+        // CHECK: icmp ne i32 {{.*}}, 0
+        && sa[0]
+        // CHECK: load i32
+        // CHECK: icmp ne i32 {{.*}}, 0
+        && va[0].x
+        // CHECK: load i32
+        // CHECK: icmp ne i32 {{.*}}, 0
+        && ma[0]._11) ? 1 : 2;
+}

+ 55 - 0
tools/clang/test/CodeGenHLSL/declarations/constant_buffers/layout.hlsl

@@ -0,0 +1,55 @@
+// RUN: %dxc -T vs_6_0 -E main %s | FileCheck %s
+
+// Tests the printed layout of constant and texture buffers.
+// We don't care in what order they get printed
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 16
+// CHECK: int2 c; ; Offset: 36
+// CHECK: int2 d; ; Offset: 48
+// CHECK: int e; ; Offset: 56
+// CHECK: Size: 60
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 16
+// CHECK: int2 c; ; Offset: 36
+// CHECK: int2 d; ; Offset: 48
+// CHECK: int e; ; Offset: 56
+// CHECK: Size: 60
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 16
+// CHECK: int2 c; ; Offset: 36
+// CHECK: int2 d; ; Offset: 48
+// CHECK: int e; ; Offset: 56
+// CHECK: Size: 60
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 16
+// CHECK: int2 c; ; Offset: 36
+// CHECK: int2 d; ; Offset: 48
+// CHECK: int e; ; Offset: 56
+// CHECK: Size: 60
+
+struct Struct
+{
+    int2 a;
+    struct
+    {
+        int b[2]; // Each element is int4-aligned
+        int2 c; // Fits in b[1].yz
+        int2 d; // Doesn't fit in b[1].w-, so gets its own int4
+    } s;
+    int e; // Fits in d.z
+};
+
+cbuffer _cbl { Struct cbl; };
+ConstantBuffer<Struct> cb;
+
+tbuffer _tbl { Struct tbl; };
+TextureBuffer<Struct> tb;
+
+int main() : OUT
+{
+    return cbl.e + cb.e + tbl.e + tb.e;
+}

+ 50 - 0
tools/clang/test/CodeGenHLSL/declarations/globals/no_initialization.hlsl

@@ -0,0 +1,50 @@
+// RUN: %dxc -E main -T vs_6_0 > %s | FileCheck %s
+
+// Test that no variable initializers are emitted, especially for cbuffers globals.
+
+// CHECK-NOT: {{.*}} = constant
+// CHECK: define void @main()
+
+int var;
+int var_init = 1;
+const int const_var;
+const int const_var_init = 1;
+extern int extern_var;
+extern int extern_var_init = 1;
+extern const int extern_const_var;
+extern const int extern_const_var_init = 1;
+
+// Those get optimized away
+static int static_var;
+static int static_var_init = 1;
+static const int static_const_var;
+static const int static_const_var_init = 1;
+
+struct s
+{
+  // Those get optimized away
+  static int struct_static_var;
+  // static int struct_static_var_init = 1; // error: struct/class members cannot have default values
+  static const int struct_static_const_var;
+  static const int struct_static_const_var_init = 1;
+};
+
+int s::struct_static_var = 1;
+const int s::struct_static_const_var = 1;
+
+int main() : OUT {
+  static int func_static_var;
+  static int func_static_var_init = 1;
+  static const int func_static_const_var;
+  static const int func_static_const_var_init = 1;
+  return var + var_init
+    + const_var + const_var_init
+    + extern_var + extern_var_init
+    + extern_const_var + extern_const_var_init
+    + static_var + static_var_init
+    + static_const_var + static_const_var_init
+    + s::struct_static_var + /*s::struct_static_var_init*/
+    + s::struct_static_const_var + s::struct_static_const_var_init
+    + func_static_var + func_static_var_init
+    + func_static_const_var + func_static_const_var_init;
+}

+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_cb.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/cbuffer_load.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_input_column_major.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/input_column_major.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_input_row_major.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/input_row_major.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_output_param.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/output_param.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_output_return.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/output_return.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_preserved_with_typedef.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/preserved_with_typedef.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_structbuf_load_struct.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_load_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_structbuf_store.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_store.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_structbuf_store_struct.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/structbuf_store_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_transpose_in_function.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/transpose_in_function.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_truncation_column_major.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/truncation_column_major.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_truncation_row_major.hlsl → tools/clang/test/CodeGenHLSL/declarations/matrix_pack/truncation_row_major.hlsl


+ 23 - 0
tools/clang/test/CodeGenHLSL/declarations/structs/anonymous.hlsl

@@ -0,0 +1,23 @@
+// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
+
+// Tests declarations and uses of anonymous structs.
+
+// CHECK: call i32 @dx.op.loadInput.i32
+// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
+// CHECK: add nsw i32
+// CHECK: call void @dx.op.storeOutput.i32
+
+typedef struct { int x; } typedefed;
+
+struct { int x; } global;
+struct Outer
+{
+    struct { int x; } field;
+};
+
+int main(Outer input : IN) : OUT
+{
+    struct { int x; } local = input.field;
+    typedefed retval = local;
+    return retval.x + global.x;
+}

+ 2 - 2
tools/clang/test/CodeGenHLSL/quick-test/bitfields_error.hlsl → tools/clang/test/CodeGenHLSL/declarations/structs/bitfields_error.hlsl

@@ -1,6 +1,6 @@
-// RUN: %dxc /T ps_6_0 /E main %s | FileCheck %s
+// RUN: %dxc /T vs_6_0 /E main %s | FileCheck %s
 
 // CHECK: error: bitfields are not supported in HLSL
 
 struct Struct { uint field : 1; };
-float main() : SV_Target { return 0; }
+void main() {}

+ 4 - 2
tools/clang/test/CodeGenHLSL/quick-test/builtin_types_no_inheritance.hlsl → tools/clang/test/CodeGenHLSL/declarations/structs/builtin_types_no_inheritance.hlsl

@@ -1,9 +1,10 @@
-// RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s
+// RUN: %dxc -T vs_6_0 -E main %s | FileCheck %s
 
 // CHECK: error: base 'vector' is marked 'final'
 // CHECK: error: base 'matrix' is marked 'final'
 // CHECK: error: base 'Texture3D' is marked 'final'
 // CHECK: error: base 'ByteAddressBuffer' is marked 'final'
+// CHECK: error: base 'StructuredBuffer' is marked 'final'
 // CHECK: error: base 'SamplerState' is marked 'final'
 // CHECK: error: base 'TriangleStream' is marked 'final'
 // CHECK: error: base 'InputPatch' is marked 'final'
@@ -17,6 +18,7 @@ struct F2 : float2 {};
 struct F4x4 : float4x4 {};
 struct Tex3D : Texture3D<float> {};
 struct BABuf : ByteAddressBuffer {};
+struct StructBuf : StructuredBuffer<int> {};
 struct Samp : SamplerState {};
 
 struct Vertex { float3 pos : POSITION; };
@@ -29,4 +31,4 @@ struct BITIA : BuiltInTriangleIntersectionAttributes {};
 struct RTAS : RaytracingAccelerationStructure {};
 struct GRS : GlobalRootSignature {};
 
-float main() : SV_Target { return 0; }
+void main() {}

+ 13 - 0
tools/clang/test/CodeGenHLSL/declarations/structs/declaration_in_return_type.hlsl

@@ -0,0 +1,13 @@
+// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
+
+// Tests that struct declarations cannot also declare functions.
+// Note that FXC allows this
+
+// CHECK: error: {{.*}} cannot be defined in the result type of a function
+
+struct Struct { int x; };
+struct { int x; } main() : OUT
+{
+    Struct result;
+    return result;
+}

+ 25 - 0
tools/clang/test/CodeGenHLSL/declarations/structs/empty.hlsl

@@ -0,0 +1,25 @@
+// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
+
+// Test that (nested) empty structs compile away
+
+// CHECK: define void @main()
+// CHECK-NOT: %{{.*}} =
+// CHECK: ret void
+
+struct EmptyStruct {};
+struct OuterStruct { EmptyStruct empty; };
+
+OuterStruct global;
+static OuterStruct staticGlobal;
+cbuffer SomeCBuffer { OuterStruct cbufferField; };
+ConstantBuffer<OuterStruct> cb;
+StructuredBuffer<OuterStruct> sb;
+
+OuterStruct main(OuterStruct input,
+    out OuterStruct output)
+{
+    OuterStruct local = input;
+    staticGlobal = global;
+    output = cbufferField;
+    return local;
+}

+ 37 - 0
tools/clang/test/CodeGenHLSL/declarations/structured_buffers/layout.hlsl

@@ -0,0 +1,37 @@
+// RUN: %dxc -T vs_6_0 -E main %s | FileCheck %s
+
+// Tests the printed layout of structured buffers.
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 8
+// CHECK: int2 c; ; Offset: 16
+// CHECK: int2 d; ; Offset: 24
+// CHECK: int e; ; Offset: 32
+// CHECK: Size: 36
+
+// CHECK: int2 a; ; Offset: 0
+// CHECK: int b[2]; ; Offset: 8
+// CHECK: int2 c; ; Offset: 16
+// CHECK: int2 d; ; Offset: 24
+// CHECK: int e; ; Offset: 32
+// CHECK: Size: 36
+
+struct Struct
+{
+    int2 a;
+    struct
+    {
+        int b[2];
+        int2 c;
+        int2 d;
+    } s;
+    int e;
+};
+
+StructuredBuffer<Struct> sb;
+RWStructuredBuffer<Struct> rwsb;
+
+int main() : OUT
+{
+    return sb[0].e + rwsb[0].e;
+}

+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/array_to_scalar.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_scalar.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/array_to_struct.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/array_to_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/array_to_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/matrix_to_array.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_array.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/matrix_to_array_return_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_array_return_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/matrix_to_scalar.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_scalar.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/matrix_to_struct.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/matrix_to_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/matrix_to_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/scalar_to_array.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_array.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/scalar_to_array_return_scalar.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_array_return_scalar.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/scalar_to_matrix.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_matrix.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/scalar_to_struct.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/scalar_to_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/scalar_to_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/struct_to_array.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_array.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/struct_to_array_return_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_array_return_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/struct_to_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/struct_to_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/vector_to_array.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_array.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/vector_to_array_return_vector.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_array_return_vector.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/vector_to_matrix.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_matrix.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/vector_to_scalar.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_scalar.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/cast_between_type_shapes/vector_to_struct.hlsl → tools/clang/test/CodeGenHLSL/expressions/casts/between_type_shapes/vector_to_struct.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_operators.hlsl → tools/clang/test/CodeGenHLSL/expressions/operators/matrices/arithmetic.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_increment_decrement.hlsl → tools/clang/test/CodeGenHLSL/expressions/operators/matrices/increment_decrement.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_overrides_Zpc.hlsl → tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_Zpc.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_overrides_Zpr.hlsl → tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_Zpr.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_overrides_ast.hlsl → tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/overrides_ast.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_pragma_granularity.hlsl → tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/pragma_granularity.hlsl


+ 0 - 0
tools/clang/test/CodeGenHLSL/quick-test/matrix_orientation_pragma_granularity_template_syntax.hlsl → tools/clang/test/CodeGenHLSL/preprocessor/pragma_matrix_pack/pragma_granularity_template_syntax.hlsl


+ 0 - 12
tools/clang/test/CodeGenHLSL/quick-test/anon_struct.hlsl

@@ -1,12 +0,0 @@
-// RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s
-
-// CHECK: %"$Globals" = type { %struct.anon }
-// CHECK: @dx.op.cbufferLoadLegacy
-
-struct {
-    int X;
-} CB;
-
-float main(int N : A, int C : B) : SV_TARGET {
-    return CB.X;
-}

+ 0 - 9
tools/clang/test/CodeGenHLSL/quick-test/arrays_cast_to_vector.hlsl

@@ -1,9 +0,0 @@
-// RUN: %dxc /T vs_6_0 /E main > %s | FileCheck %s | XFail GitHub #1795
-
-int2 main() : OUT
-{
-    // call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 0, i32 1)
-    // call void @dx.op.storeOutput.i32(i32 5, i32 0, i32 0, i8 1, i32 2)
-    int array[] = { 1, 2 };
-    return (int2)array;
-}

+ 0 - 110
tools/clang/test/CodeGenHLSL/quick-test/bool_loadbuf_storebuf_memrepr.hlsl

@@ -1,110 +0,0 @@
-// RUN: %dxc -E main -T ps_6_0 -O0 %s | FileCheck %s
-
-// Ensure that bools are converted from/to their mem representation when loaded/stored in buffers
-
-// Constant buffer loads
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32
-// CHECK: extractvalue %dx.types.CBufRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-
-// Structured buffer loads
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32
-// CHECK: extractvalue %dx.types.ResRet.i32
-// CHECK: icmp ne i32 {{.*}}, 0
-
-// Structured buffer stores
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: call void @dx.op.bufferStore.i32
-  
-
-struct AllTheBools
-{
-    bool2x2 m;
-    bool2 v;
-    bool s;
-    bool2x2 ma[2];
-    bool2 va[2];
-    bool sa[2];
-};
-
-ConstantBuffer<AllTheBools> cb;
-StructuredBuffer<AllTheBools> sb;
-RWStructuredBuffer<AllTheBools> rwsb;
-
-float main(int i : I) : SV_Target
-{
-    float result = 0;
-
-    // Constant buffer loads
-    if (cb.m._22 && cb.v.y && cb.s
-        && cb.ma[1]._22 && cb.va[1].y && cb.sa[1])
-    {
-        result++;
-    }
-    
-    // Structured buffer loads
-    if (sb[0].m._22 && sb[0].v.y && sb[0].s
-        && sb[0].ma[1]._22 && sb[0].va[1].y && sb[0].sa[1])
-    {
-        result++;
-    }
-
-    // Structured buffer stores
-    if (result >= 1.0f)
-    {
-        rwsb[0].m._22 = i == 42;
-        rwsb[0].v.y = i == 42;
-        rwsb[0].s = i == 42;
-        rwsb[0].ma[1]._22 = i == 42;
-        rwsb[0].va[1].y = i == 42;
-        rwsb[0].sa[1] = i == 42;
-    }
-
-    return 0;
-}

+ 0 - 52
tools/clang/test/CodeGenHLSL/quick-test/bool_memrepr.hlsl

@@ -1,52 +0,0 @@
-// RUN: %dxc -E main -T ps_6_0 -O0 %s | FileCheck %s
-
-// Ensure that bools are converted from/to their memory representation when loaded/stored
-
-// Local variables should never be i1s
-// CHECK-not: alloca {{.*}}i1
-
-// Test stores
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-// CHECK: icmp eq i32 {{.*}}, 42
-// CHECK: zext i1 {{.*}} to i32
-// CHECK: store i32
-
-// Test loads
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-// CHECK: load i32
-// CHECK: icmp ne i32 {{.*}}, 0
-
-float main(int i : I) : SV_Target
-{
-    bool s = i == 42;
-    bool1 v = i == 42;
-    bool1x1 m = i == 42;
-    bool sa[1] = { i == 42 };
-    bool1 va[1] = { i == 42 };
-    bool1x1 ma[1] = { i == 42 };
-
-    return s && v.x && m._11 && sa[0] && va[0].x && ma[0]._11 ? 1.0f : 2.0f;
-}

+ 0 - 61
tools/clang/test/CodeGenHLSL/quick-test/disasm_struct_layout_ctbuffer.hlsl

@@ -1,61 +0,0 @@
-// RUN: %dxc -T ps_6_0 -E main -Od %s | FileCheck %s
-
-// All cbuffer and tbuffer declarations should have the same layout
-// We don't care in what order they get printed
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 16
-// CHECK: float2 c; ; Offset: 36
-// CHECK: float2 d; ; Offset: 48
-// CHECK: float e; ; Offset: 56
-// CHECK: Size: 60
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 16
-// CHECK: float2 c; ; Offset: 36
-// CHECK: float2 d; ; Offset: 48
-// CHECK: float e; ; Offset: 56
-// CHECK: Size: 60
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 16
-// CHECK: float2 c; ; Offset: 36
-// CHECK: float2 d; ; Offset: 48
-// CHECK: float e; ; Offset: 56
-// CHECK: Size: 60
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 16
-// CHECK: float2 c; ; Offset: 36
-// CHECK: float2 d; ; Offset: 48
-// CHECK: float e; ; Offset: 56
-// CHECK: Size: 60
-
-struct Struct
-{
-  float2 a;
-  struct
-  {
-    float b[2]; // Each element is float4-aligned
-    float2 c; // Fits in b[1].yz
-    float2 d; // Doesn't fit in b[1].w-, so gets its own float4
-  } s;
-  float e; // Fits in d.z
-};
-
-cbuffer _cbl
-{
-  Struct cbl;
-};
-ConstantBuffer<Struct> cb;
-
-tbuffer _tbl
-{
-  Struct tbl;
-};
-TextureBuffer<Struct> tb;
-
-float4 main() : SV_Target
-{
-    return cbl.e + cb.e + tbl.e + tb.e;
-}

+ 0 - 37
tools/clang/test/CodeGenHLSL/quick-test/disasm_struct_layout_structbuf.hlsl

@@ -1,37 +0,0 @@
-// RUN: %dxc -T ps_6_0 -E main -Od %s | FileCheck %s
-
-// StructuredBuffer/RWStructuredBuffer should have the same layout
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 8
-// CHECK: float2 c; ; Offset: 16
-// CHECK: float2 d; ; Offset: 24
-// CHECK: float e; ; Offset: 32
-// CHECK: Size: 36
-
-// CHECK: float2 a; ; Offset: 0
-// CHECK: float b[2]; ; Offset: 8
-// CHECK: float2 c; ; Offset: 16
-// CHECK: float2 d; ; Offset: 24
-// CHECK: float e; ; Offset: 32
-// CHECK: Size: 36
-
-struct Struct
-{
-  float2 a;
-  struct
-  {
-    float b[2];
-    float2 c;
-    float2 d;
-  } s;
-  float e;
-};
-
-StructuredBuffer<Struct> sb;
-RWStructuredBuffer<Struct> rwsb;
-
-float4 main() : SV_Target
-{
-    return sb[0].e + rwsb[0].e;
-}

+ 0 - 19
tools/clang/test/CodeGenHLSL/quick-test/empty_struct.hlsl

@@ -1,19 +0,0 @@
-// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
-
-// Make sure nest empty struct works.
-// CHECK: main
-
-struct EmptyStruct
-{
-};
-
-struct OuterStruct
-{
-  EmptyStruct s;
-};
-
-float4 main(float4 pos : POSITION) : SV_POSITION
-{
-  OuterStruct os;
-  return float4(0, 0, 0, 0);
-}

+ 0 - 20
tools/clang/test/CodeGenHLSL/quick-test/empty_struct2.hlsl

@@ -1,20 +0,0 @@
-// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
-
-// Make sure nest empty struct works.
-// CHECK: main
-
-struct KillerStruct {};
-
-struct InnerStruct {
-  KillerStruct s;
-};
-
-struct OuterStruct {
-  InnerStruct s;
-};
-
-cbuffer Params_cbuffer : register(b0) {
-  OuterStruct constants;
-};
-
-float4 main(float4 pos : POSITION) : SV_POSITION { return float4(0, 0, 0, 0); }

+ 0 - 68
tools/clang/test/CodeGenHLSL/quick-test/global-var-no-init.hlsl

@@ -1,68 +0,0 @@
-// RUN: %dxc -E main -T ps_6_0 > %s | FileCheck %s
-
-// CBuffer-promoted global variables should not have initializers
-// CHECK-NOT: {{.*var.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*var_init.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*const_var.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*const_var_init.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*extern_var.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*extern_var_init.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*extern_const_var.*}} = constant float 0.000000e+00, align 4
-// CHECK-NOT: {{.*extern_const_var_init.*}} = constant float 0.000000e+00, align 4
-
-// ... they should only exist in their CBuffer declaration
-// CHECK: cbuffer $Globals
-// CHECK: float var;
-// CHECK: float var_init;
-// CHECK: float const_var;
-// CHECK: float const_var_init;
-// CHECK: float extern_var;
-// CHECK: float extern_var_init;
-// CHECK: float extern_const_var;
-// CHECK: float extern_const_var_init;
-
-Texture2D tex;
-float var;
-float var_init = 1;
-const float const_var;
-const float const_var_init = 1;
-extern float extern_var;
-extern float extern_var_init = 1;
-extern const float extern_const_var;
-extern const float extern_const_var_init = 1;
-
-// Those get optimized away
-static float static_var;
-static float static_var_init = 1;
-static const float static_const_var;
-static const float static_const_var_init = 1;
-
-struct s
-{
-  // Those get optimized away
-  static float struct_static_var;
-  // static float struct_static_var_init = 1; // error: struct/class members cannot have default values
-  static const float struct_static_const_var;
-  static const float struct_static_const_var_init = 1;
-};
-
-float s::struct_static_var = 1;
-const float s::struct_static_const_var = 1;
-
-float main() : SV_Target {
-  static float func_static_var;
-  static float func_static_var_init = 1;
-  static const float func_static_const_var;
-  static const float func_static_const_var_init = 1;
-  return tex.Load((int3)0).x
-    + var + var_init
-    + const_var + const_var_init
-    + extern_var + extern_var_init
-    + extern_const_var + extern_const_var_init
-    + static_var + static_var_init
-    + static_const_var + static_const_var_init
-    + s::struct_static_var + /*s::struct_static_var_init*/
-    + s::struct_static_const_var + s::struct_static_const_var_init
-    + func_static_var + func_static_var_init
-    + func_static_const_var + func_static_const_var_init;
-}

+ 0 - 35
tools/clang/test/CodeGenHLSL/quick-test/pack_matrix.hlsl

@@ -1,35 +0,0 @@
-// RUN: %dxc -E main -T ps_6_0 -ast-dump %s  | FileCheck %s
-
-// CHECK:row_major
-#pragma pack_matrix(row_major)
-
-struct Foo
-{
-  float2x2 a;
-};
-
-// CHECK:column_major
-#pragma pack_matrix(column_major)
-
-struct Bar {
-  float2x2 a;
-};
-
-Foo f;
-Bar b;
-
-// CHECK:row_major
-#pragma pack_matrix(row_major)
-
-float2x2 c;
-
-// CHECK:column_major
-#pragma pack_matrix(column_major)
-float2x2 d;
-
-// CHECK: main 'float4 ()'
-float4 main() : SV_Target
-{
-  float2x2 e = f.a + b.a + c + d;
-  return e;
-}

+ 17 - 0
tools/clang/unittests/HLSL/CompilerTest.cpp

@@ -929,6 +929,11 @@ public:
     TEST_METHOD_PROPERTY(L"Ignore", L"true")
   END_TEST_METHOD()
 
+  // Batch directories
+  TEST_METHOD(CodeGenDeclarations)
+  TEST_METHOD(CodeGenExpressions)
+  TEST_METHOD(CodeGenPreprocessor)
+
   dxc::DxcDllSupport m_dllSupport;
   VersionSupportInfo m_ver;
 
@@ -5807,3 +5812,15 @@ TEST_F(CompilerTest, DISABLED_ManualFileCheckTest) {
     CodeGenTestCheckBatch(path.c_str(), 0);
   }
 }
+
+TEST_F(CompilerTest, CodeGenDeclarations) {
+  CodeGenTestCheckBatchDir(L"..\\CodeGenHLSL\\declarations");
+}
+
+TEST_F(CompilerTest, CodeGenExpressions) {
+  CodeGenTestCheckBatchDir(L"..\\CodeGenHLSL\\expressions");
+}
+
+TEST_F(CompilerTest, CodeGenPreprocessor) {
+  CodeGenTestCheckBatchDir(L"..\\CodeGenHLSL\\preprocessor");
+}