Browse Source

Support %dxilver in filerun commands for CodeGenHLSL tests. (#2174)

Several tests could not be added to the batch run folder because they had a SkipDxilVersion test. This change allows this test to be performed in a // RUN: line, so that the tests can be moved to the batch folder. It also includes a small refactoring of FileRunCommandPart
Tristan Labelle 6 năm trước cách đây
mục cha
commit
7dace2aa44
62 tập tin đã thay đổi với 300 bổ sung434 xóa
  1. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid01.hlsl
  2. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid02.hlsl
  3. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid03.hlsl
  4. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid04.hlsl
  5. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid05.hlsl
  6. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid06.hlsl
  7. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid07.hlsl
  8. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid08.hlsl
  9. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid09.hlsl
  10. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid10.hlsl
  11. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid11.hlsl
  12. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid12.hlsl
  13. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid13.hlsl
  14. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid14.hlsl
  15. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid15.hlsl
  16. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid16.hlsl
  17. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid17.hlsl
  18. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid18.hlsl
  19. 1 1
      tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid19.hlsl
  20. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/attributeAtVertex.hlsl
  21. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/attributeAtVertexNoOpt.hlsl
  22. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/barycentrics.hlsl
  23. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/barycentrics1.hlsl
  24. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/barycentricsThreeSV.hlsl
  25. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/bitcast_16bits.hlsl
  26. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/cbuffer64Types.hlsl
  27. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/cbufferHalf-struct.hlsl
  28. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/cbufferHalf.hlsl
  29. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/cbufferInt16-struct.hlsl
  30. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/cbufferInt16.hlsl
  31. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/dataLayoutHalf.hlsl
  32. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/enum3.hlsl
  33. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/fixedWidth.hlsl
  34. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/fixedWidth16Bit.hlsl
  35. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/functionAttribute.hlsl
  36. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/int16Op.hlsl
  37. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/int16OpBits.hlsl
  38. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/literals_exact_precision_Mod.hlsl
  39. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad2.hlsl
  40. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad4.hlsl
  41. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad5.hlsl
  42. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad6.hlsl
  43. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad7.hlsl
  44. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/raw_buf2.hlsl
  45. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/raw_buf4.hlsl
  46. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/raw_buf5.hlsl
  47. 53 0
      tools/clang/test/CodeGenHLSL/batch/misc/signature_packing_by_width.hlsl
  48. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf2.hlsl
  49. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf3.hlsl
  50. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf4.hlsl
  51. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf5.hlsl
  52. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf6.hlsl
  53. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/struct_buf_new_layout.hlsl
  54. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/typed_buffer_half.hlsl
  55. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/uav_typed_load_store3.hlsl
  56. 1 1
      tools/clang/test/CodeGenHLSL/batch/misc/uint64_2.hlsl
  57. 0 2
      tools/clang/test/CodeGenHLSL/validation/signature_packing_by_width.hlsl
  58. 1 230
      tools/clang/unittests/HLSL/CompilerTest.cpp
  59. 43 15
      tools/clang/unittests/HLSL/DxcTestUtils.h
  60. 3 3
      tools/clang/unittests/HLSL/DxilContainerTest.cpp
  61. 144 128
      tools/clang/unittests/HLSL/FileCheckerTest.cpp
  62. 1 1
      tools/clang/unittests/HLSL/ValidationTest.cpp

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid01.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid01.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 4, outputs: 4
 // CHECK: Number of inputs: 4, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 1 }
 // CHECK: Outputs dependent on ViewId: { 1 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid02.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid02.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 0, 3 }
 // CHECK: Outputs dependent on ViewId: { 0, 3 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid03.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid03.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 0 }
 // CHECK: Outputs dependent on ViewId: { 0 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid04.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid04.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Number of inputs: 8, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 0 }
 // CHECK: Outputs dependent on ViewId: { 0 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid05.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid05.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 12, outputs: 4
 // CHECK: Number of inputs: 12, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 0 }
 // CHECK: Outputs dependent on ViewId: { 0 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid06.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid06.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: -------------------- ----- ---------------------- ------
 // CHECK: -------------------- ----- ---------------------- ------

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid07.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid07.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 4, outputs: 4
 // CHECK: Number of inputs: 4, outputs: 4
 // CHECK: Outputs dependent on ViewId: { 2 }
 // CHECK: Outputs dependent on ViewId: { 2 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid08.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid08.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: -------------------- ----- ---------------------- ------
 // CHECK: -------------------- ----- ---------------------- ------

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid09.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid09.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: -------------------- ----- ---------------------- ------
 // CHECK: -------------------- ----- ---------------------- ------

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid10.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid10.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: -------------------- ----- ---------------------- ------
 // CHECK: -------------------- ----- ---------------------- ------

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid11.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid11.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: Name                 Index             InterpMode DynIdx
 // CHECK: -------------------- ----- ---------------------- ------
 // CHECK: -------------------- ----- ---------------------- ------

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid12.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid12.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T gs_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T gs_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 12, outputs per stream: { 4, 4, 0, 0 }
 // CHECK: Number of inputs: 12, outputs per stream: { 4, 4, 0, 0 }
 // CHECK: Outputs for Stream 0 dependent on ViewId: { 1, 2, 3 }
 // CHECK: Outputs for Stream 0 dependent on ViewId: { 1, 2, 3 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid13.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid13.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Buffer Definitions:
 // CHECK: Buffer Definitions:
 // CHECK: Resource Bindings:
 // CHECK: Resource Bindings:

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid14.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid14.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 1, outputs: 0
 // CHECK: Number of inputs: 1, outputs: 0
 // CHECK: Outputs dependent on ViewId: {  }
 // CHECK: Outputs dependent on ViewId: {  }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid15.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid15.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T hs_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T hs_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 3, outputs: 3, patchconst: 24
 // CHECK: Number of inputs: 3, outputs: 3, patchconst: 24
 // CHECK: Outputs dependent on ViewId: {  }
 // CHECK: Outputs dependent on ViewId: {  }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid16.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid16.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T hs_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T hs_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 3, outputs: 3, patchconst: 24
 // CHECK: Number of inputs: 3, outputs: 3, patchconst: 24
 // CHECK: Outputs dependent on ViewId: { 0, 2 }
 // CHECK: Outputs dependent on ViewId: { 0, 2 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid17.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid17.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T hs_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T hs_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 4, outputs: 4, patchconst: 28
 // CHECK: Number of inputs: 4, outputs: 4, patchconst: 28
 // CHECK: Outputs dependent on ViewId: { 2 }
 // CHECK: Outputs dependent on ViewId: { 2 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid18.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid18.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ds_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ds_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 3, outputs: 4, patchconst: 28
 // CHECK: Number of inputs: 3, outputs: 4, patchconst: 28
 // CHECK: Outputs dependent on ViewId: { 0 }
 // CHECK: Outputs dependent on ViewId: { 0 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/viewid/viewid19.hlsl → tools/clang/test/CodeGenHLSL/batch/declarations/functions/entrypoints/semantics/viewid/viewid19.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T vs_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T vs_6_1 %s | FileCheck %s
 
 
 // CHECK: Number of inputs: 7, outputs: 7
 // CHECK: Number of inputs: 7, outputs: 7
 // CHECK: Outputs dependent on ViewId: { 4, 5, 6 }
 // CHECK: Outputs dependent on ViewId: { 4, 5, 6 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/attributeAtVertex.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/attributeAtVertex.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 0, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 1, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 0, i32 0, i8 1, i8 0)

+ 1 - 1
tools/clang/test/CodeGenHLSL/attributeAtVertexNoOpt.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/attributeAtVertexNoOpt.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 -O0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 -O0 %s | FileCheck %s
 
 
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 0, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 0)
 // CHECK: call float @dx.op.attributeAtVertex.f32(i32 137, i32 1, i32 0, i8 1, i8 0)

+ 1 - 1
tools/clang/test/CodeGenHLSL/barycentrics.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/barycentrics.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: !"SV_Barycentrics"
 // CHECK: !"SV_Barycentrics"
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/barycentrics1.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/barycentrics1.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: ; SV_Barycentrics
 // CHECK: ; SV_Barycentrics
 // CHECK: ; SV_Barycentrics
 // CHECK: ; SV_Barycentrics

+ 1 - 1
tools/clang/test/CodeGenHLSL/barycentricsThreeSV.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/barycentricsThreeSV.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_1 %s | FileCheck %s
 
 
 // CHECK: There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.
 // CHECK: There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/bitcast_16bits.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/bitcast_16bits.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -HV 2018 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -HV 2018 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: bitcast half %{{.*}} to i16
 // CHECK: bitcast half %{{.*}} to i16
 // CHECK: bitcast i16 %{{.*}} to half
 // CHECK: bitcast i16 %{{.*}} to half

+ 1 - 1
tools/clang/test/CodeGenHLSL/cbuffer64Types.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/cbuffer64Types.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
 
 
 // CHECK: %dx.types.CBufRet.f64 = type { double, double }
 // CHECK: %dx.types.CBufRet.f64 = type { double, double }
 // CHECK: %dx.types.CBufRet.i64 = type { i64, i64 }
 // CHECK: %dx.types.CBufRet.i64 = type { i64, i64 }

+ 1 - 1
tools/clang/test/CodeGenHLSL/cbufferHalf-struct.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/cbufferHalf-struct.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: Use native low precision
 // CHECK: Use native low precision
 // CHECK:   struct struct.Foo
 // CHECK:   struct struct.Foo

+ 1 - 1
tools/clang/test/CodeGenHLSL/cbufferHalf.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/cbufferHalf.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: Use native low precision
 // CHECK: Use native low precision
 // CHECK: cbuffer Foo
 // CHECK: cbuffer Foo

+ 1 - 1
tools/clang/test/CodeGenHLSL/cbufferInt16-struct.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/cbufferInt16-struct.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
 
 
 // CHECK: Use native low precision
 // CHECK: Use native low precision
 // CHECK:   struct struct.Foo
 // CHECK:   struct struct.Foo

+ 1 - 1
tools/clang/test/CodeGenHLSL/cbufferInt16.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/cbufferInt16.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
 
 
 // CHECK: Use native low precision
 // CHECK: Use native low precision
 // CHECK: cbuffer Foo
 // CHECK: cbuffer Foo

+ 1 - 1
tools/clang/test/CodeGenHLSL/dataLayoutHalf.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/dataLayoutHalf.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
 // CHECK: target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/enum3.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/enum3.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_1 -HV 2017 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_1 -HV 2017 %s | FileCheck %s
 
 
 // CHECK: dx.op.attributeAtVertex
 // CHECK: dx.op.attributeAtVertex
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/fixedWidth.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/fixedWidth.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -HV 2017 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -HV 2017 %s | FileCheck %s
 
 
 // CHECK: error: unknown type name 'int16_t'
 // CHECK: error: unknown type name 'int16_t'
 // CHECK: error: unknown type name 'int32_t'
 // CHECK: error: unknown type name 'int32_t'

+ 1 - 1
tools/clang/test/CodeGenHLSL/fixedWidth16Bit.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/fixedWidth16Bit.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -HV 2018 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -HV 2018 %s | FileCheck %s
 
 
 // CHECK: error: unknown type name 'int16_t'
 // CHECK: error: unknown type name 'int16_t'
 // CHECK-NOT: error: unknown type name 'int32_t'
 // CHECK-NOT: error: unknown type name 'int32_t'

+ 1 - 1
tools/clang/test/CodeGenHLSL/functionAttribute.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/functionAttribute.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -denorm ftz %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -denorm ftz %s | FileCheck %s
 
 
 // CHECK: @main
 // CHECK: @main
 // CHECK: attributes #{{.*}} = { "fp32-denorm-mode"="ftz" }
 // CHECK: attributes #{{.*}} = { "fp32-denorm-mode"="ftz" }

+ 1 - 1
tools/clang/test/CodeGenHLSL/int16Op.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/int16Op.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T cs_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: @dx.op.binary.i16
 // CHECK: @dx.op.binary.i16
 // CHECK: @dx.op.unaryBits.i16
 // CHECK: @dx.op.unaryBits.i16

+ 1 - 1
tools/clang/test/CodeGenHLSL/int16OpBits.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/int16OpBits.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T cs_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: @dx.op.unaryBits.i16
 // CHECK: @dx.op.unaryBits.i16
 // CHECK: @dx.op.unaryBits.i16
 // CHECK: @dx.op.unaryBits.i16

+ 1 - 1
tools/clang/test/CodeGenHLSL/literals_exact_precision_Mod.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/literals_exact_precision_Mod.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -enable-16bit-types -E test -T vs_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -enable-16bit-types -E test -T vs_6_2 %s | FileCheck %s
 
 
 // CHECK: @test
 // CHECK: @test
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/multiUAVLoad2.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad2.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T cs_6_0 %s | FileCheck %s
 
 
 // CHECK-NOT: Typed UAV Load Additional Formats
 // CHECK-NOT: Typed UAV Load Additional Formats
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/multiUAVLoad4.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad4.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T ps_6_0 %s | FileCheck %s
 
 
 // CHECK-NOT: Typed UAV Load Additional Formats
 // CHECK-NOT: Typed UAV Load Additional Formats
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/multiUAVLoad5.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad5.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T cs_6_0 %s | FileCheck %s
 
 
 // CHECK-NOT: Typed UAV Load Additional Formats
 // CHECK-NOT: Typed UAV Load Additional Formats
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/multiUAVLoad6.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad6.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T cs_6_0 %s | FileCheck %s
 
 
 // CHECK-NOT: Typed UAV Load Additional Formats
 // CHECK-NOT: Typed UAV Load Additional Formats
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/multiUAVLoad7.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/multiUAVLoad7.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T cs_6_0 %s | FileCheck %s
 
 
 // CHECK-NOT: Typed UAV Load Additional Formats
 // CHECK-NOT: Typed UAV Load Additional Formats
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/raw_buf2.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/raw_buf2.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
 
 
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)

+ 1 - 1
tools/clang/test/CodeGenHLSL/raw_buf4.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/raw_buf4.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -HV 2018 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -HV 2018 %s | FileCheck %s
 
 
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)

+ 1 - 1
tools/clang/test/CodeGenHLSL/raw_buf5.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/raw_buf5.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
 
 
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.f32 @dx.op.rawBufferLoad.f32(i32 139, %dx.types.Handle %buf1_texture_rawbuf, i32 %{{[0-9]+}}, i32 undef, i8 3, i32 4)

+ 53 - 0
tools/clang/test/CodeGenHLSL/batch/misc/signature_packing_by_width.hlsl

@@ -0,0 +1,53 @@
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
+
+// TODO: Update this file when we introduce i8
+
+// Checking if signature elements are packed by interpolation mode and data width with up to 4 elements.
+
+// CHECK: ; Name                 Index   Mask Register SysValue  Format   Used
+// CHECK: ; -------------------- ----- ------ -------- -------- ------- ------
+// CHECK: ; A                        0   xy          0     NONE    fp16
+// CHECK: ; F                        0     zw        0     NONE    fp16
+// CHECK: ; B                        0   xy          1     NONE   float
+// CHECK: ; D                        0     zw        1     NONE   float
+// CHECK: ; C                        0   xyz         2     NONE    fp16
+// CHECK: ; G                        0      w        2     NONE    fp16
+// CHECK: ; SV_PrimitiveID           0   x           3   PRIMID    uint
+// CHECK: ; E                        0   x           4     NONE     int
+// CHECK: ; I                        0    y          4     NONE     int
+// CHECK: ; H                        0   x           5     NONE   int16
+// CHECK: ; J                        0    yzw        5     NONE    fp16
+// CHECK: ; K                        0   xy          6     NONE   int16
+// CHECK: ; N                        0     z         6     NONE    fp16
+// CHECK: ; O                        0      w        6     NONE  uint16
+// CHECK: ; L                        0   xy          7     NONE    fp16
+// CHECK: ; Q                        0     z         7     NONE    fp16
+// CHECK: ; P                        0   xy          8     NONE  uint16
+// CHECK: ; SV_SampleIndex           0    N/A  special   SAMPLE    uint     NO
+
+// CHECK: !{i32 0, !"A", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 2, i32 0, i8 0, null}
+// CHECK: !{i32 1, !"B", i8 9, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 2, i32 1, i8 0, null}
+// CHECK: !{i32 2, !"C", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 3, i32 2, i8 0, null}
+// CHECK: !{i32 3, !"SV_PrimitiveID", i8 5, i8 10, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 3, i8 0, null}
+// CHECK: !{i32 4, !"D", i8 9, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 2, i32 1, i8 2, null}
+// CHECK: !{i32 5, !"E", i8 4, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 4, i8 0, null}
+// CHECK: !{i32 6, !"F", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 2, i32 0, i8 2, null}
+// CHECK: !{i32 7, !"G", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 1, i32 2, i8 3, null}
+// CHECK: !{i32 8, !"H", i8 2, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 5, i8 0, null}
+// CHECK: !{i32 9, !"I", i8 4, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 4, i8 1, null}
+// CHECK: !{i32 10, !"J", i8 8, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 3, i32 5, i8 1, null}
+// CHECK: !{i32 11, !"K", i8 2, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 2, i32 6, i8 0, null}
+// CHECK: !{i32 12, !"L", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 2, i32 7, i8 0, null}
+// CHECK: !{i32 13, !"N", i8 8, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 6, i8 2, null}
+// CHECK: !{i32 14, !"SV_SampleIndex", i8 5, i8 12, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 -1, i8 -1, null}
+// CHECK: !{i32 15, !"O", i8 3, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 1, i32 6, i8 3, null}
+// CHECK: !{i32 16, !"P", i8 3, i8 0, !{{[0-9]+}}, i8 1, i32 1, i8 2, i32 8, i8 0, null}
+// CHECK: !{i32 17, !"Q", i8 8, i8 0, !{{[0-9]+}}, i8 2, i32 1, i8 1, i32 7, i8 2, null}
+
+float4 main(min16float2 a : A, float2 b : B, half3 c : C, uint id : SV_PrimitiveID,
+            float2 d : D, int e : E, half2 f : F, half g : G,
+            min16int h : H, int i : I, nointerpolation min16float3 j : J,
+            min16int2 k : K, half2 l : L, nointerpolation half n : N, uint sample_idx : SV_SampleIndex, uint16_t o : O,
+            vector<uint16_t,2> p : P, half q : Q) : SV_Target {
+  return 1;
+}

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf2.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf2.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 0, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 0, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 4, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 4, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 12, i8 7, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 12, i8 7, i32 4)

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf3.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf3.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
 
 
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32
 // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16
 // CHECK: trunc i32 %{{[a-zA-Z0-9]+}} to i16

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf4.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf4.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 0, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 0, i8 1, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 4, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 4, i8 3, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 12, i8 7, i32 4)
 // CHECK: call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %buf1_texture_structbuf, i32 %{{[a-zA-Z0-9]+}}, i32 12, i8 7, i32 4)

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf5.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf5.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16
 // CHECK: call %dx.types.ResRet.i16 @dx.op.rawBufferLoad.i16

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf6.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf6.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 %s | FileCheck %s
 
 
 // CHECK-NOT: @dx.op.bufferLoad
 // CHECK-NOT: @dx.op.bufferLoad
 // CHECK-NOT: @dx.op.bufferStore
 // CHECK-NOT: @dx.op.bufferStore

+ 1 - 1
tools/clang/test/CodeGenHLSL/struct_buf_new_layout.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/struct_buf_new_layout.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s  | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s  | FileCheck %s
 
 
 struct MyStruct1
 struct MyStruct1
 {
 {

+ 1 - 1
tools/clang/test/CodeGenHLSL/typed_buffer_half.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/typed_buffer_half.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s  | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s  | FileCheck %s
 
 
 // CHECK: call void @dx.op.bufferStore.f16
 // CHECK: call void @dx.op.bufferStore.f16
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/uav_typed_load_store3.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/uav_typed_load_store3.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
+// RUN: %dxilver 1.2 | %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 
 
 // CHECK: call %dx.types.ResRet.f32 @dx.op.textureLoad.f32
 // CHECK: call %dx.types.ResRet.f32 @dx.op.textureLoad.f32
 // CHECK: call i1 @dx.op.checkAccessFullyMapped.i32
 // CHECK: call i1 @dx.op.checkAccessFullyMapped.i32

+ 1 - 1
tools/clang/test/CodeGenHLSL/uint64_2.hlsl → tools/clang/test/CodeGenHLSL/batch/misc/uint64_2.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -E main -T cs_6_0 -not_use_legacy_cbuf_load  %s | FileCheck %s
+// RUN: %dxilver 1.1 | %dxc -E main -T cs_6_0 -not_use_legacy_cbuf_load  %s | FileCheck %s
 
 
 // CHECK: 64-Bit integer
 // CHECK: 64-Bit integer
 // CHECK: dx.op.bufferStore.i32
 // CHECK: dx.op.bufferStore.i32

+ 0 - 2
tools/clang/test/CodeGenHLSL/signature_packing_by_width.hlsl → tools/clang/test/CodeGenHLSL/validation/signature_packing_by_width.hlsl

@@ -1,5 +1,3 @@
-// RUN: %dxc -E main -T ps_6_2 -enable-16bit-types -HV 2018 %s | FileCheck %s
-
 // TODO: Update this file when we introduce i8
 // TODO: Update this file when we introduce i8
 
 
 // Checking if signature elements are packed by interpolation mode and data width with up to 4 elements.
 // Checking if signature elements are packed by interpolation mode and data width with up to 4 elements.

+ 1 - 230
tools/clang/unittests/HLSL/CompilerTest.cpp

@@ -252,26 +252,8 @@ public:
   TEST_METHOD(DiaLoadDebugThenOK)
   TEST_METHOD(DiaLoadDebugThenOK)
   TEST_METHOD(DiaTableIndexThenOK)
   TEST_METHOD(DiaTableIndexThenOK)
 
 
-  TEST_METHOD(CodeGenAttributeAtVertex)
-  TEST_METHOD(CodeGenAttributeAtVertexNoOpt)
-  TEST_METHOD(CodeGenBarycentrics)
-  TEST_METHOD(CodeGenBarycentrics1)
-  TEST_METHOD(CodeGenBarycentricsThreeSV)
-  TEST_METHOD(CodeGenBitCast16Bits)
-  TEST_METHOD(CodeGenCbuffer64Types)
-  TEST_METHOD(CodeGenCbufferHalf)
-  TEST_METHOD(CodeGenCbufferHalfStruct)
-  TEST_METHOD(CodeGenCbufferInt16)
-  TEST_METHOD(CodeGenCbufferInt16Struct)
-  TEST_METHOD(CodeGenDataLayoutHalf)
-  TEST_METHOD(CodeGenEnum3)
   TEST_METHOD(CodeGenFloatingPointEnvironment)
   TEST_METHOD(CodeGenFloatingPointEnvironment)
-  TEST_METHOD(CodeGenFixedWidthTypes)
-  TEST_METHOD(CodeGenFixedWidthTypes16Bit)
-  TEST_METHOD(CodeGenFunctionAttribute)
   TEST_METHOD(CodeGenInclude)
   TEST_METHOD(CodeGenInclude)
-  TEST_METHOD(CodeGenInt16Op)
-  TEST_METHOD(CodeGenInt16OpBits)
   TEST_METHOD(CodeGenLibCsEntry)
   TEST_METHOD(CodeGenLibCsEntry)
   TEST_METHOD(CodeGenLibCsEntry2)
   TEST_METHOD(CodeGenLibCsEntry2)
   TEST_METHOD(CodeGenLibCsEntry3)
   TEST_METHOD(CodeGenLibCsEntry3)
@@ -280,26 +262,7 @@ public:
   TEST_METHOD(CodeGenLibNoAlias)
   TEST_METHOD(CodeGenLibNoAlias)
   TEST_METHOD(CodeGenLibResource)
   TEST_METHOD(CodeGenLibResource)
   TEST_METHOD(CodeGenLibUnusedFunc)
   TEST_METHOD(CodeGenLibUnusedFunc)
-  TEST_METHOD(CodeGenMultiUAVLoad2)
-  TEST_METHOD(CodeGenMultiUAVLoad4)
-  TEST_METHOD(CodeGenMultiUAVLoad5)
-  TEST_METHOD(CodeGenMultiUAVLoad6)
-  TEST_METHOD(CodeGenMultiUAVLoad7)
-  TEST_METHOD(CodeGenRaw_Buf2)
-  TEST_METHOD(CodeGenRaw_Buf4)
-  TEST_METHOD(CodeGenRaw_Buf5)
-  TEST_METHOD(CodeGenSignaturePackingByWidth)
-  TEST_METHOD(CodeGenStruct_Buf2)
-  TEST_METHOD(CodeGenStruct_Buf3)
-  TEST_METHOD(CodeGenStruct_Buf4)
-  TEST_METHOD(CodeGenStruct_Buf5)
-  TEST_METHOD(CodeGenStruct_Buf6)
-  TEST_METHOD(CodeGenStruct_Buf_New_Layout)
-  TEST_METHOD(CodeGenUav_Typed_Load_Store3)
-  TEST_METHOD(CodeGenUint64_2)
-
-  TEST_METHOD(CodeGenLiterals_Exact_Precision_Mod)
-  TEST_METHOD(CodeGenTypedBufferHalf)
+
   TEST_METHOD(CodeGenRootSigProfile)
   TEST_METHOD(CodeGenRootSigProfile)
   TEST_METHOD(CodeGenRootSigProfile2)
   TEST_METHOD(CodeGenRootSigProfile2)
   TEST_METHOD(CodeGenRootSigProfile5)
   TEST_METHOD(CodeGenRootSigProfile5)
@@ -308,7 +271,6 @@ public:
   TEST_METHOD(WhenSigMismatchPCFunctionThenFail)
   TEST_METHOD(WhenSigMismatchPCFunctionThenFail)
 
 
   TEST_METHOD(CodeGenSamples)
   TEST_METHOD(CodeGenSamples)
-  TEST_METHOD(ViewID)
   TEST_METHOD(SubobjectCodeGenErrors)
   TEST_METHOD(SubobjectCodeGenErrors)
   TEST_METHOD(DebugInfo)
   TEST_METHOD(DebugInfo)
   TEST_METHOD(QuickTest)
   TEST_METHOD(QuickTest)
@@ -2318,71 +2280,6 @@ TEST_F(CompilerTest, DiaTableIndexThenOK) {
 }
 }
 #endif // _WIN32 - exclude dia stuff
 #endif // _WIN32 - exclude dia stuff
 
 
-TEST_F(CompilerTest, CodeGenAttributeAtVertex) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"attributeAtVertex.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenAttributeAtVertexNoOpt) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"attributeAtVertexNoOpt.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenBarycentrics) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"barycentrics.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenBarycentrics1) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"barycentrics1.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenBarycentricsThreeSV) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"barycentricsThreeSV.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenBitCast16Bits) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"bitcast_16bits.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenCbuffer64Types) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"cbuffer64Types.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenCbufferHalf) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"cbufferHalf.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenCbufferHalfStruct) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"cbufferHalf-struct.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenCbufferInt16) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"cbufferInt16.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenCbufferInt16Struct) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"cbufferInt16-struct.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenDataLayoutHalf) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"dataLayoutHalf.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenEnum3) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"enum3.hlsl");
-}
-
 #ifdef _WIN32
 #ifdef _WIN32
 
 
 #pragma fenv_access(on)
 #pragma fenv_access(on)
@@ -2468,36 +2365,10 @@ TEST_F(CompilerTest, CodeGenFloatingPointEnvironment) {
 
 
 #endif  // _WIN32
 #endif  // _WIN32
 
 
-
-TEST_F(CompilerTest, CodeGenFixedWidthTypes) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"fixedWidth.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenFixedWidthTypes16Bit) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"fixedWidth16Bit.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenFunctionAttribute) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"functionAttribute.hlsl");
-}
-
 TEST_F(CompilerTest, CodeGenInclude) {
 TEST_F(CompilerTest, CodeGenInclude) {
   CodeGenTestCheck(L"Include.hlsl");
   CodeGenTestCheck(L"Include.hlsl");
 }
 }
 
 
-TEST_F(CompilerTest, CodeGenInt16Op) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"int16Op.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenInt16OpBits) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"int16OpBits.hlsl");
-}
-
 TEST_F(CompilerTest, CodeGenLibCsEntry) {
 TEST_F(CompilerTest, CodeGenLibCsEntry) {
   CodeGenTestCheck(L"lib_cs_entry.hlsl");
   CodeGenTestCheck(L"lib_cs_entry.hlsl");
 }
 }
@@ -2530,101 +2401,6 @@ TEST_F(CompilerTest, CodeGenLibUnusedFunc) {
   CodeGenTestCheck(L"lib_unused_func.hlsl");
   CodeGenTestCheck(L"lib_unused_func.hlsl");
 }
 }
 
 
-TEST_F(CompilerTest, CodeGenMultiUAVLoad2) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"multiUAVLoad2.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenMultiUAVLoad4) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"multiUAVLoad4.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenMultiUAVLoad5) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"multiUAVLoad5.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenMultiUAVLoad6) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"multiUAVLoad6.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenMultiUAVLoad7) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"multiUAVLoad7.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenRaw_Buf2) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"raw_buf2.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenRaw_Buf4) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"raw_buf4.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenRaw_Buf5) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"raw_buf5.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenSignaturePackingByWidth) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"signature_packing_by_width.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf2) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf2.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf3) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf3.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf4) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf4.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf5) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf5.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf6) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf6.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenStruct_Buf_New_Layout) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"struct_buf_new_layout.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenUav_Typed_Load_Store3) {
-  if (m_ver.SkipDxilVersion(1,2)) return;
-  CodeGenTestCheck(L"uav_typed_load_store3.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenUint64_2) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheck(L"uint64_2.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenLiterals_Exact_Precision_Mod) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"literals_exact_precision_Mod.hlsl");
-}
-
-TEST_F(CompilerTest, CodeGenTypedBufferHalf) {
-  if (m_ver.SkipDxilVersion(1, 2)) return;
-  CodeGenTestCheck(L"typed_buffer_half.hlsl");
-}
-
 TEST_F(CompilerTest, CodeGenRootSigProfile) {
 TEST_F(CompilerTest, CodeGenRootSigProfile) {
   CodeGenTest(L"rootSigProfile.hlsl");
   CodeGenTest(L"rootSigProfile.hlsl");
 }
 }
@@ -2769,11 +2545,6 @@ TEST_F(CompilerTest, WhenSigMismatchPCFunctionThenFail) {
     "Signature element SV_Position, referred to by patch constant function, is not found in corresponding hull shader output."));
     "Signature element SV_Position, referred to by patch constant function, is not found in corresponding hull shader output."));
 }
 }
 
 
-TEST_F(CompilerTest, ViewID) {
-  if (m_ver.SkipDxilVersion(1,1)) return;
-  CodeGenTestCheckBatchDir(L"viewid");
-}
-
 TEST_F(CompilerTest, SubobjectCodeGenErrors) {
 TEST_F(CompilerTest, SubobjectCodeGenErrors) {
   struct SubobjectErrorTestCase {
   struct SubobjectErrorTestCase {
     const char *shaderText;
     const char *shaderText;

+ 43 - 15
tools/clang/unittests/HLSL/DxcTestUtils.h

@@ -54,34 +54,62 @@ public:
   int Run();
   int Run();
 };
 };
 
 
+// The result of running a single command in a run pipeline
+struct FileRunCommandResult {
+  CComPtr<IDxcOperationResult> OpResult; // The operation result, if any.
+  std::string StdOut;
+  std::string StdErr;
+  int ExitCode = 0;
+  bool AbortPipeline = false; // True to prevent running subsequent commands
+
+  static inline FileRunCommandResult Success() {
+    FileRunCommandResult result;
+    result.ExitCode = 0;
+    return std::move(result);
+  }
+
+  static inline FileRunCommandResult Success(std::string StdOut) {
+    FileRunCommandResult result;
+    result.ExitCode = 0;
+    result.StdOut = std::move(StdOut);
+    return std::move(result);
+  }
+
+  static inline FileRunCommandResult Error(int ExitCode, std::string StdErr) {
+    FileRunCommandResult result;
+    result.ExitCode = ExitCode;
+    result.StdErr = std::move(StdErr);
+    return std::move(result);
+  }
+
+  static inline FileRunCommandResult Error(std::string StdErr) {
+    return Error(1, StdErr);
+  }
+};
+
 class FileRunCommandPart {
 class FileRunCommandPart {
 public:
 public:
   FileRunCommandPart(const std::string &command, const std::string &arguments, LPCWSTR commandFileName);
   FileRunCommandPart(const std::string &command, const std::string &arguments, LPCWSTR commandFileName);
   FileRunCommandPart(const FileRunCommandPart&) = default;
   FileRunCommandPart(const FileRunCommandPart&) = default;
   FileRunCommandPart(FileRunCommandPart&&) = default;
   FileRunCommandPart(FileRunCommandPart&&) = default;
   
   
-  void Run(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior);
+  FileRunCommandResult Run(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior);
   
   
-  void ReadOptsForDxc(hlsl::options::MainArgs &argStrings, hlsl::options::DxcOpts &Opts);
+  FileRunCommandResult ReadOptsForDxc(hlsl::options::MainArgs &argStrings, hlsl::options::DxcOpts &Opts);
 
 
   std::string Command;      // Command to run, eg %dxc
   std::string Command;      // Command to run, eg %dxc
   std::string Arguments;    // Arguments to command
   std::string Arguments;    // Arguments to command
   LPCWSTR CommandFileName;  // File name replacement for %s
   LPCWSTR CommandFileName;  // File name replacement for %s
 
 
-  // These fields are set after an invocation to Run().
-  CComPtr<IDxcOperationResult> OpResult;  // The operation result, if any.
-  int RunResult;                          // The exit code for the operation.
-  std::string StdOut;                     // Standard output text.
-  std::string StdErr;                     // Standard error text.
-
 private:
 private:
-  void RunFileChecker(const FileRunCommandPart *Prior);
-  void RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior);
-  void RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior);
-  void RunOpt(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior);
-  void RunD3DReflect(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior);
-  void RunTee(const FileRunCommandPart *Prior);
-  void RunXFail(const FileRunCommandPart *Prior);
+  FileRunCommandResult RunFileChecker(const FileRunCommandResult *Prior);
+  FileRunCommandResult RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior);
+  FileRunCommandResult RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior);
+  FileRunCommandResult RunOpt(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior);
+  FileRunCommandResult RunD3DReflect(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior);
+  FileRunCommandResult RunTee(const FileRunCommandResult *Prior);
+  FileRunCommandResult RunXFail(const FileRunCommandResult *Prior);
+  FileRunCommandResult RunDxilVer(dxc::DxcDllSupport& DllSupport, const FileRunCommandResult* Prior);
 };
 };
 
 
 void ParseCommandParts(LPCSTR commands, LPCWSTR fileName, std::vector<FileRunCommandPart> &parts);
 void ParseCommandParts(LPCSTR commands, LPCWSTR fileName, std::vector<FileRunCommandPart> &parts);

+ 3 - 3
tools/clang/unittests/HLSL/DxilContainerTest.cpp

@@ -372,9 +372,9 @@ public:
       IFR(pDxbcBlob.QueryInterface(ppBlob));
       IFR(pDxbcBlob.QueryInterface(ppBlob));
     }
     }
     else {
     else {
-      dxc.Run(m_dllSupport, nullptr);
-      IFRBOOL(dxc.RunResult == 0, E_FAIL);
-      IFR(dxc.OpResult->GetResult(ppBlob));
+      FileRunCommandResult result = dxc.Run(m_dllSupport, nullptr);
+      IFRBOOL(result.ExitCode == 0, E_FAIL);
+      IFR(result.OpResult->GetResult(ppBlob));
     }
     }
     return S_OK;
     return S_OK;
   }
   }

+ 144 - 128
tools/clang/unittests/HLSL/FileCheckerTest.cpp

@@ -16,6 +16,7 @@
 #include <memory>
 #include <memory>
 #include <vector>
 #include <vector>
 #include <string>
 #include <string>
+#include <cctype>
 #include <cassert>
 #include <cassert>
 #include <algorithm>
 #include <algorithm>
 #include "dxc/Support/WinIncludes.h"
 #include "dxc/Support/WinIncludes.h"
@@ -81,61 +82,60 @@ static std::vector<std::string> strtok(const std::string &value, const char *del
 FileRunCommandPart::FileRunCommandPart(const std::string &command, const std::string &arguments, LPCWSTR commandFileName) :
 FileRunCommandPart::FileRunCommandPart(const std::string &command, const std::string &arguments, LPCWSTR commandFileName) :
   Command(command), Arguments(arguments), CommandFileName(commandFileName) { }
   Command(command), Arguments(arguments), CommandFileName(commandFileName) { }
 
 
-void FileRunCommandPart::Run(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::Run(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior) {
   bool isFileCheck =
   bool isFileCheck =
     0 == _stricmp(Command.c_str(), "FileCheck") ||
     0 == _stricmp(Command.c_str(), "FileCheck") ||
     0 == _stricmp(Command.c_str(), "%FileCheck");
     0 == _stricmp(Command.c_str(), "%FileCheck");
   bool isXFail = 0 == _stricmp(Command.c_str(), "xfail");
   bool isXFail = 0 == _stricmp(Command.c_str(), "xfail");
+  bool consumeErrors = isFileCheck || isXFail;
 
 
-  // For now, propagate errors.
-  if (Prior && Prior->RunResult && !isFileCheck && !isXFail) {
-    StdErr = Prior->StdErr;
-    RunResult = Prior->RunResult;
-    return;
+  // Stop the pipeline if on errors unless the command can consume them.
+  if (Prior != nullptr && Prior->ExitCode && !consumeErrors) {
+    FileRunCommandResult result = *Prior;
+    result.AbortPipeline = true;
+    return result;
   }
   }
 
 
   // We would add support for 'not' and 'llc' here.
   // We would add support for 'not' and 'llc' here.
   if (isFileCheck) {
   if (isFileCheck) {
-    RunFileChecker(Prior);
+    return RunFileChecker(Prior);
   }
   }
   else if (isXFail) {
   else if (isXFail) {
-    RunXFail(Prior);
+    return RunXFail(Prior);
   }
   }
   else if (0 == _stricmp(Command.c_str(), "tee")) {
   else if (0 == _stricmp(Command.c_str(), "tee")) {
-    RunTee(Prior);
+    return RunTee(Prior);
+  }
+  else if (0 == _stricmp(Command.c_str(), "%dxilver")) {
+    return RunDxilVer(DllSupport, Prior);
   }
   }
   else if (0 == _stricmp(Command.c_str(), "%dxc")) {
   else if (0 == _stricmp(Command.c_str(), "%dxc")) {
-    RunDxc(DllSupport, Prior);
+    return RunDxc(DllSupport, Prior);
   }
   }
   else if (0 == _stricmp(Command.c_str(), "%dxv")) {
   else if (0 == _stricmp(Command.c_str(), "%dxv")) {
-    RunDxv(DllSupport, Prior);
+    return RunDxv(DllSupport, Prior);
   }
   }
   else if (0 == _stricmp(Command.c_str(), "%opt")) {
   else if (0 == _stricmp(Command.c_str(), "%opt")) {
-    RunOpt(DllSupport, Prior);
+    return RunOpt(DllSupport, Prior);
   }
   }
   else if (0 == _stricmp(Command.c_str(), "%D3DReflect")) {
   else if (0 == _stricmp(Command.c_str(), "%D3DReflect")) {
-    RunD3DReflect(DllSupport, Prior);
+    return RunD3DReflect(DllSupport, Prior);
   }
   }
   else {
   else {
-    RunResult = 1;
-    StdErr = "Unrecognized command ";
-    StdErr += Command;
+    FileRunCommandResult result {};
+    result.ExitCode = 1;
+    result.StdErr = "Unrecognized command ";
+    result.StdErr += Command;
+    return result;
   }
   }
 }
 }
 
 
-void FileRunCommandPart::RunFileChecker(const FileRunCommandPart *Prior) {
-  if (!Prior) {
-    StdErr = "Prior command required to generate stdin";
-    RunResult = 1;
-    return;
-  }
+FileRunCommandResult FileRunCommandPart::RunFileChecker(const FileRunCommandResult *Prior) {
+  if (!Prior) return FileRunCommandResult::Error("Prior command required to generate stdin");
 
 
   FileCheckForTest t;
   FileCheckForTest t;
   t.CheckFilename = CW2A(CommandFileName, CP_UTF8);
   t.CheckFilename = CW2A(CommandFileName, CP_UTF8);
-  if (Prior->RunResult)
-    t.InputForStdin = Prior->StdErr;
-  else
-    t.InputForStdin = Prior->StdOut;
+  t.InputForStdin = Prior->ExitCode ? Prior->StdErr : Prior->StdOut;
 
 
   // Parse command arguments
   // Parse command arguments
   static constexpr char checkPrefixStr[] = "-check-prefix=";
   static constexpr char checkPrefixStr[] = "-check-prefix=";
@@ -145,39 +145,30 @@ void FileRunCommandPart::RunFileChecker(const FileRunCommandPart *Prior) {
     else if (arg == "-input=stderr") t.InputForStdin = Prior->StdErr;
     else if (arg == "-input=stderr") t.InputForStdin = Prior->StdErr;
     else if (strstartswith(arg, checkPrefixStr))
     else if (strstartswith(arg, checkPrefixStr))
       t.CheckPrefixes.emplace_back(arg.substr(sizeof(checkPrefixStr) - 1));
       t.CheckPrefixes.emplace_back(arg.substr(sizeof(checkPrefixStr) - 1));
-    else {
-      StdErr = "Invalid argument";
-      RunResult = 1;
-      return;
-    }
-  }
-  if (!hasInputFilename) {
-    StdErr = "Missing input filename";
-    RunResult = 1;
-    return;
+    else return FileRunCommandResult::Error("Invalid argument");
   }
   }
+  if (!hasInputFilename) return FileRunCommandResult::Error("Missing input filename");
 
 
+  FileRunCommandResult result {};
   // Run
   // Run
-  RunResult = t.Run();
-
-  StdOut = t.test_outs;
-  StdErr = t.test_errs;
+  result.ExitCode = t.Run();
+  result.StdOut = t.test_outs;
+  result.StdErr = t.test_errs;
   // Capture the input as well.
   // Capture the input as well.
-  if (RunResult != 0 && Prior != nullptr) {
-    StdErr += "\n<full input to FileCheck>\n";
-    StdErr += t.InputForStdin;
+  if (result.ExitCode != 0 && Prior != nullptr) {
+    result.StdErr += "\n<full input to FileCheck>\n";
+    result.StdErr += t.InputForStdin;
   }
   }
+
+  return result;
 }
 }
 
 
-void FileRunCommandPart::ReadOptsForDxc(hlsl::options::MainArgs &argStrings,
-                                        hlsl::options::DxcOpts &Opts) {
+FileRunCommandResult FileRunCommandPart::ReadOptsForDxc(
+    hlsl::options::MainArgs &argStrings, hlsl::options::DxcOpts &Opts) {
   std::string args(strtrim(Arguments));
   std::string args(strtrim(Arguments));
   const char *inputPos = strstr(args.c_str(), "%s");
   const char *inputPos = strstr(args.c_str(), "%s");
-  if (inputPos == nullptr) {
-    StdErr = "Only supported pattern includes input file as argument";
-    RunResult = 1;
-    return;
-  }
+  if (inputPos == nullptr)
+    return FileRunCommandResult::Error("Only supported pattern includes input file as argument");
   args.erase(inputPos - args.c_str(), strlen("%s"));
   args.erase(inputPos - args.c_str(), strlen("%s"));
 
 
   llvm::StringRef argsRef = args;
   llvm::StringRef argsRef = args;
@@ -186,20 +177,22 @@ void FileRunCommandPart::ReadOptsForDxc(hlsl::options::MainArgs &argStrings,
   argStrings = hlsl::options::MainArgs(splitArgs);
   argStrings = hlsl::options::MainArgs(splitArgs);
   std::string errorString;
   std::string errorString;
   llvm::raw_string_ostream errorStream(errorString);
   llvm::raw_string_ostream errorStream(errorString);
-  RunResult = ReadDxcOpts(hlsl::options::getHlslOptTable(), /*flagsToInclude*/ 0,
+  int RunResult = ReadDxcOpts(hlsl::options::getHlslOptTable(), /*flagsToInclude*/ 0,
                           argStrings, Opts, errorStream);
                           argStrings, Opts, errorStream);
   errorStream.flush();
   errorStream.flush();
-  if (RunResult) {
-    StdErr = errorString;
-  }
+  if (RunResult)
+    return FileRunCommandResult::Error(RunResult, errorString);
+
+  return FileRunCommandResult::Success("");
 }
 }
 
 
-void FileRunCommandPart::RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior) {
   // Support piping stdin from prior if needed.
   // Support piping stdin from prior if needed.
   UNREFERENCED_PARAMETER(Prior);
   UNREFERENCED_PARAMETER(Prior);
   hlsl::options::MainArgs args;
   hlsl::options::MainArgs args;
   hlsl::options::DxcOpts opts;
   hlsl::options::DxcOpts opts;
-  ReadOptsForDxc(args, opts);
+  FileRunCommandResult readOptsResult = ReadOptsForDxc(args, opts);
+  if (readOptsResult.ExitCode) return readOptsResult;
 
 
   std::wstring entry =
   std::wstring entry =
       Unicode::UTF8ToUTF16StringOrThrow(opts.EntryPoint.str().c_str());
       Unicode::UTF8ToUTF16StringOrThrow(opts.EntryPoint.str().c_str());
@@ -225,9 +218,6 @@ void FileRunCommandPart::RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCom
 
 
   HRESULT resultStatus;
   HRESULT resultStatus;
 
 
-  if (RunResult)  // opt parsing already failed
-    return;
-
   IFT(DllSupport.CreateInstance(CLSID_DxcLibrary, &pLibrary));
   IFT(DllSupport.CreateInstance(CLSID_DxcLibrary, &pLibrary));
   IFT(pLibrary->CreateBlobFromFile(CommandFileName, nullptr, &pSource));
   IFT(pLibrary->CreateBlobFromFile(CommandFileName, nullptr, &pSource));
   IFT(pLibrary->CreateIncludeHandler(&pIncludeHandler));
   IFT(pLibrary->CreateIncludeHandler(&pIncludeHandler));
@@ -235,35 +225,36 @@ void FileRunCommandPart::RunDxc(dxc::DxcDllSupport &DllSupport, const FileRunCom
   IFT(pCompiler->Compile(pSource, CommandFileName, entry.c_str(), profile.c_str(),
   IFT(pCompiler->Compile(pSource, CommandFileName, entry.c_str(), profile.c_str(),
                           flags.data(), flags.size(), nullptr, 0, pIncludeHandler, &pResult));
                           flags.data(), flags.size(), nullptr, 0, pIncludeHandler, &pResult));
   IFT(pResult->GetStatus(&resultStatus));
   IFT(pResult->GetStatus(&resultStatus));
+
+  FileRunCommandResult result = {};
   if (SUCCEEDED(resultStatus)) {
   if (SUCCEEDED(resultStatus)) {
     IFT(pResult->GetResult(&pCompiledBlob));
     IFT(pResult->GetResult(&pCompiledBlob));
     if (!opts.AstDump) {
     if (!opts.AstDump) {
       IFT(pCompiler->Disassemble(pCompiledBlob, &pDisassembly));
       IFT(pCompiler->Disassemble(pCompiledBlob, &pDisassembly));
-      StdOut = BlobToUtf8(pDisassembly);
+      result.StdOut = BlobToUtf8(pDisassembly);
     } else {
     } else {
-      StdOut = BlobToUtf8(pCompiledBlob);
+      result.StdOut = BlobToUtf8(pCompiledBlob);
     }
     }
     CComPtr<IDxcBlobEncoding> pStdErr;
     CComPtr<IDxcBlobEncoding> pStdErr;
     IFT(pResult->GetErrorBuffer(&pStdErr));
     IFT(pResult->GetErrorBuffer(&pStdErr));
-    StdErr = BlobToUtf8(pStdErr);
-    RunResult = 0;
+    result.StdErr = BlobToUtf8(pStdErr);
+    result.ExitCode = 0;
   }
   }
   else {
   else {
     IFT(pResult->GetErrorBuffer(&pDisassembly));
     IFT(pResult->GetErrorBuffer(&pDisassembly));
-    StdErr = BlobToUtf8(pDisassembly);
-    RunResult = resultStatus;
+    result.StdErr = BlobToUtf8(pDisassembly);
+    result.ExitCode = resultStatus;
   }
   }
 
 
-  OpResult = pResult;
+  result.OpResult = pResult;
+  return result;
 }
 }
 
 
-void FileRunCommandPart::RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior) {
   std::string args(strtrim(Arguments));
   std::string args(strtrim(Arguments));
   const char *inputPos = strstr(args.c_str(), "%s");
   const char *inputPos = strstr(args.c_str(), "%s");
   if (inputPos == nullptr) {
   if (inputPos == nullptr) {
-    StdErr = "Only supported pattern includes input file as argument";
-    RunResult = 1;
-    return;
+    return FileRunCommandResult::Error("Only supported pattern includes input file as argument");
   }
   }
   args.erase(inputPos - args.c_str(), strlen("%s"));
   args.erase(inputPos - args.c_str(), strlen("%s"));
 
 
@@ -290,9 +281,7 @@ void FileRunCommandPart::RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCom
   if (FAILED(resultStatus)) {
   if (FAILED(resultStatus)) {
     CComPtr<IDxcBlobEncoding> pAssembleBlob;
     CComPtr<IDxcBlobEncoding> pAssembleBlob;
     IFT(pResult->GetErrorBuffer(&pAssembleBlob));
     IFT(pResult->GetErrorBuffer(&pAssembleBlob));
-    StdErr = BlobToUtf8(pAssembleBlob);
-    RunResult = resultStatus;
-    return;
+    return FileRunCommandResult::Error(resultStatus, BlobToUtf8(pAssembleBlob));
   }
   }
   IFT(pResult->GetResult(&pContainerBlob));
   IFT(pResult->GetResult(&pContainerBlob));
 
 
@@ -301,22 +290,22 @@ void FileRunCommandPart::RunDxv(dxc::DxcDllSupport &DllSupport, const FileRunCom
   IFT(pValidator->Validate(pContainerBlob, DxcValidatorFlags_InPlaceEdit,
   IFT(pValidator->Validate(pContainerBlob, DxcValidatorFlags_InPlaceEdit,
                             &pValidationResult));
                             &pValidationResult));
   IFT(pValidationResult->GetStatus(&resultStatus));
   IFT(pValidationResult->GetStatus(&resultStatus));
-  if (resultStatus) {
+
+  if (FAILED(resultStatus)) {
     CComPtr<IDxcBlobEncoding> pValidateBlob;
     CComPtr<IDxcBlobEncoding> pValidateBlob;
     IFT(pValidationResult->GetErrorBuffer(&pValidateBlob));
     IFT(pValidationResult->GetErrorBuffer(&pValidateBlob));
-    StdOut = BlobToUtf8(pValidateBlob);
+    return FileRunCommandResult::Success(BlobToUtf8(pValidateBlob));
   }
   }
-  RunResult = 0;
+
+  return FileRunCommandResult::Success("");
 }
 }
 
 
-void FileRunCommandPart::RunOpt(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::RunOpt(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior) {
   std::string args(strtrim(Arguments));
   std::string args(strtrim(Arguments));
   const char *inputPos = strstr(args.c_str(), "%s");
   const char *inputPos = strstr(args.c_str(), "%s");
   if (inputPos == nullptr && Prior == nullptr) {
   if (inputPos == nullptr && Prior == nullptr) {
-    StdErr = "Only supported patterns are input file as argument or prior "
-              "command with disassembly";
-    RunResult = 1;
-    return;
+    return FileRunCommandResult::Error("Only supported patterns are input file as argument or prior "
+      "command with disassembly");
   }
   }
 
 
   CComPtr<IDxcLibrary> pLibrary;
   CComPtr<IDxcLibrary> pLibrary;
@@ -358,22 +347,15 @@ void FileRunCommandPart::RunOpt(dxc::DxcDllSupport &DllSupport, const FileRunCom
 
 
   IFT(pOptimizer->RunOptimizer(pSource, options.data(), options.size(),
   IFT(pOptimizer->RunOptimizer(pSource, options.data(), options.size(),
                                 &pOutputModule, &pOutputText));
                                 &pOutputModule, &pOutputText));
-  StdOut = BlobToUtf8(pOutputText);
-  RunResult = 0;
+  return FileRunCommandResult::Success(BlobToUtf8(pOutputText));
 }
 }
 
 
-void FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, const FileRunCommandResult *Prior) {
   std::string args(strtrim(Arguments));
   std::string args(strtrim(Arguments));
-  if (args != "%s") {
-    StdErr = "Only supported pattern is a plain input file";
-    RunResult = 1;
-    return;
-  }
-  if (!Prior) {
-    StdErr = "Prior command required to generate stdin";
-    RunResult = 1;
-    return;
-  }
+  if (args != "%s")
+    return FileRunCommandResult::Error("Only supported pattern is a plain input file");
+  if (!Prior)
+    return FileRunCommandResult::Error("Prior command required to generate stdin");
 
 
   CComPtr<IDxcLibrary> pLibrary;
   CComPtr<IDxcLibrary> pLibrary;
   CComPtr<IDxcBlobEncoding> pSource;
   CComPtr<IDxcBlobEncoding> pSource;
@@ -401,9 +383,7 @@ void FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, const Fil
   if (FAILED(resultStatus)) {
   if (FAILED(resultStatus)) {
     CComPtr<IDxcBlobEncoding> pAssembleBlob;
     CComPtr<IDxcBlobEncoding> pAssembleBlob;
     IFT(pResult->GetErrorBuffer(&pAssembleBlob));
     IFT(pResult->GetErrorBuffer(&pAssembleBlob));
-    StdErr = BlobToUtf8(pAssembleBlob);
-    RunResult = resultStatus;
-    return;
+    return FileRunCommandResult::Error(resultStatus, BlobToUtf8(pAssembleBlob));
   }
   }
   IFT(pResult->GetResult(&pContainerBlob));
   IFT(pResult->GetResult(&pContainerBlob));
 
 
@@ -431,9 +411,7 @@ void FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, const Fil
   }
   }
 
 
   if (!blobFound) {
   if (!blobFound) {
-    StdErr = "Unable to find DXIL part";
-    RunResult = 1;
-    return;
+    return FileRunCommandResult::Error("Unable to find DXIL part");
   } else if (pShaderReflection) {
   } else if (pShaderReflection) {
     dumper.Dump(pShaderReflection);
     dumper.Dump(pShaderReflection);
   } else if (pLibraryReflection) {
   } else if (pLibraryReflection) {
@@ -441,15 +419,13 @@ void FileRunCommandPart::RunD3DReflect(dxc::DxcDllSupport &DllSupport, const Fil
   }
   }
 
 
   ss.flush();
   ss.flush();
-  StdOut = ss.str();
-  RunResult = 0;
+
+  return FileRunCommandResult::Success(ss.str());
 }
 }
 
 
-void FileRunCommandPart::RunTee(const FileRunCommandPart *Prior) {
+FileRunCommandResult FileRunCommandPart::RunTee(const FileRunCommandResult *Prior) {
   if (Prior == nullptr) {
   if (Prior == nullptr) {
-    StdErr = "tee requires a prior command";
-    RunResult = 1;
-    return;
+    return FileRunCommandResult::Error("tee requires a prior command");
   }
   }
 
 
   // Ignore commands for now - simply log out through test framework.
   // Ignore commands for now - simply log out through test framework.
@@ -463,24 +439,60 @@ void FileRunCommandPart::RunTee(const FileRunCommandPart *Prior) {
     WEX::Logging::Log::Comment(errWide.m_psz);
     WEX::Logging::Log::Comment(errWide.m_psz);
   }
   }
 
 
-  StdErr = Prior->StdErr;
-  StdOut = Prior->StdOut;
-  RunResult = Prior->RunResult;
+  return *Prior;
 }
 }
 
 
-void FileRunCommandPart::RunXFail(const FileRunCommandPart *Prior) {
-  if (Prior == nullptr) {
-    StdErr = "XFail requires a prior command";
-    RunResult = 1;
-    return;
-  }
+FileRunCommandResult FileRunCommandPart::RunXFail(const FileRunCommandResult *Prior) {
+  if (Prior == nullptr)
+    return FileRunCommandResult::Error("XFail requires a prior command");
 
 
-  if (Prior->RunResult == 0) {
-    StdErr = "XFail expected a failure from previous command";
-    RunResult = 1;
+  if (Prior->ExitCode == 0) {
+    return FileRunCommandResult::Error("XFail expected a failure from previous command");
   } else {
   } else {
-    RunResult = 0;
+    return FileRunCommandResult::Success("");
+  }
+}
+
+FileRunCommandResult FileRunCommandPart::RunDxilVer(dxc::DxcDllSupport& DllSupport, const FileRunCommandResult* Prior) {
+  Arguments = strtrim(Arguments);
+  if (Arguments.size() != 3 || !std::isdigit(Arguments[0]) || Arguments[1] != '.' || !std::isdigit(Arguments[2])) {
+    return FileRunCommandResult::Error("Invalid dxil version format");
+  }
+
+  unsigned RequiredDxilMajor = Arguments[0] - '0';
+  unsigned RequiredDxilMinor = Arguments[2] - '0';
+  bool Supported = RequiredDxilMajor >= 1;
+  CComPtr<IDxcCompiler> pCompiler;
+
+  // If the following fails, we have Dxil 1.0 compiler
+  if (SUCCEEDED(DllSupport.CreateInstance(CLSID_DxcCompiler, &pCompiler))) {
+    CComPtr<IDxcVersionInfo> pVersionInfo;
+    IFT(pCompiler.QueryInterface(&pVersionInfo));
+    unsigned DxilMajor, DxilMinor;
+    IFT(pVersionInfo->GetVersion(&DxilMajor, &DxilMinor));
+    if (DxilMajor < RequiredDxilMajor || (DxilMajor == RequiredDxilMajor && DxilMinor < RequiredDxilMinor))
+      Supported = false;
+  }
+
+  CComPtr<IDxcValidator> pValidator;
+  if (SUCCEEDED(DllSupport.CreateInstance(CLSID_DxcValidator, &pValidator))) {
+    CComPtr<IDxcVersionInfo> pVersionInfo;
+    IFT(pValidator.QueryInterface(&pVersionInfo));
+    unsigned DxilMajor, DxilMinor;
+    VERIFY_SUCCEEDED(pVersionInfo->GetVersion(&DxilMajor, &DxilMinor));
+    if (DxilMajor < RequiredDxilMajor || (DxilMajor == RequiredDxilMajor && DxilMinor < RequiredDxilMinor))
+      Supported = false;
+  }
+
+  if (!Supported) {
+    FileRunCommandResult result {};
+    result.StdErr = "Skipping test due to unsupported dxil version";
+    result.ExitCode = 0; // Succeed the test
+    result.AbortPipeline = true;
+    return result;
   }
   }
+
+  return FileRunCommandResult::Success();
 }
 }
 
 
 class FileRunTestResultImpl : public FileRunTestResult {
 class FileRunTestResultImpl : public FileRunTestResult {
@@ -489,19 +501,23 @@ class FileRunTestResultImpl : public FileRunTestResult {
   void RunFileCheckFromCommands(LPCSTR commands, LPCWSTR fileName) {
   void RunFileCheckFromCommands(LPCSTR commands, LPCWSTR fileName) {
     std::vector<FileRunCommandPart> parts;
     std::vector<FileRunCommandPart> parts;
     ParseCommandParts(commands, fileName, parts);
     ParseCommandParts(commands, fileName, parts);
-    FileRunCommandPart *prior = nullptr;
-    for (FileRunCommandPart & part : parts) {
-      part.Run(m_support, prior);
-      prior = &part;
-    }
-    if (prior == nullptr) {
+
+    if (parts.empty()) {
       this->RunResult = 1;
       this->RunResult = 1;
       this->ErrorMessage = "FileCheck found no commands to run";
       this->ErrorMessage = "FileCheck found no commands to run";
+      return;
     }
     }
-    else {
-      this->RunResult = prior->RunResult;
-      this->ErrorMessage = prior->StdErr;
+    
+    FileRunCommandResult result;
+    FileRunCommandResult* previousResult = nullptr;
+    for (FileRunCommandPart & part : parts) {
+      result = part.Run(m_support, previousResult);
+      previousResult = &result;
+      if (result.AbortPipeline) break;
     }
     }
+
+    this->RunResult = result.ExitCode;
+    this->ErrorMessage = result.StdErr;
   }
   }
 
 
 public:
 public:

+ 1 - 1
tools/clang/unittests/HLSL/ValidationTest.cpp

@@ -1065,7 +1065,7 @@ TEST_F(ValidationTest, SignatureDataWidth) {
   if (m_ver.SkipDxilVersion(1, 2)) return;
   if (m_ver.SkipDxilVersion(1, 2)) return;
   std::vector<LPCWSTR> pArguments = { L"-enable-16bit-types", L"-HV", L"2018" };
   std::vector<LPCWSTR> pArguments = { L"-enable-16bit-types", L"-HV", L"2018" };
   RewriteAssemblyCheckMsg(
   RewriteAssemblyCheckMsg(
-      L"..\\CodeGenHLSL\\signature_packing_by_width.hlsl", "ps_6_2",
+      L"..\\CodeGenHLSL\\validation\\signature_packing_by_width.hlsl", "ps_6_2",
       pArguments.data(), 3, nullptr, 0,
       pArguments.data(), 3, nullptr, 0,
       {"i8 8, i8 0, (![0-9]+), i8 2, i32 1, i8 2, i32 0, i8 0, null}"},
       {"i8 8, i8 0, (![0-9]+), i8 2, i32 1, i8 2, i32 0, i8 0, null}"},
       {"i8 9, i8 0, \\1, i8 2, i32 1, i8 2, i32 0, i8 0, null}"},
       {"i8 9, i8 0, \\1, i8 2, i32 1, i8 2, i32 0, i8 0, null}"},