Skip to content

Commit

Permalink
[lit] convert verify test as lit FileCheck test part1.5 (microsoft#5912)
Browse files Browse the repository at this point in the history
Add non-lib profile RUN line when possible.
  • Loading branch information
python3kgae authored Nov 1, 2023
1 parent 245fd12 commit ae85bb8
Show file tree
Hide file tree
Showing 31 changed files with 69 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -HV 2016 -verify %s
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -HV 2016 -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -HV 2016 -verify %s

void dead()
{
Expand All @@ -10,5 +11,5 @@ void dead()
array[1] = 0;
array[2] = 0; /* expected-warning {{array index 2 is past the end of the array (which contains 2 elements)}} fxc-pass {{}} */
}

[shader("vertex")]
void main() {}
4 changes: 3 additions & 1 deletion tools/clang/test/SemaHLSL/array-index-out-of-bounds.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify %s

[shader("vertex")]
void main()
{
// expected-note@+2 {{array 'array' declared here}}
Expand Down
3 changes: 3 additions & 0 deletions tools/clang/test/SemaHLSL/array-length.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// RUN: %dxc -Tlib_6_3 -verify -HV 2016 %s
// RUN: %dxc -Tps_6_0 -verify -HV 2016 %s

// :FXC_VERIFY_ARGUMENTS: /T ps_5_0 /E main

float4 planes1[8];
Expand All @@ -8,6 +10,7 @@ struct S {
float4 planes[2];
};

[shader("pixel")]
[RootSignature("CBV(b0, space=0, visibility=SHADER_VISIBILITY_ALL)")]
float main(S s:POSITION) : SV_Target {
float4 planes3[] = {{ 1.0, 2.0, 3.0, 4.0 }};
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/atomic-float-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tcs_6_0 -verify %s

// Verify that the first arg determines the overload and the others can be what they will

Expand All @@ -9,6 +10,7 @@ RWBuffer<uint64_t> resBI64;

RWByteAddressBuffer Rres;

[shader("compute")]
[numthreads(1,1,1)]
void main( uint3 gtid : SV_GroupThreadID)
{
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/attributes.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -HV 2018 -verify %s
// RUN: %dxc -Tps_6_0 -HV 2018 -verify %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T ps_5_1 attributes.hlsl
Expand Down Expand Up @@ -696,6 +697,7 @@ void uniform_maxvertexcount2(triangle GSVertex v[3], inout TriangleStream<GSVert
{ stream.Append(v[0]); }


[shader("pixel")]
[earlydepthstencil]
/*verify-ast
HLSLEarlyDepthStencilAttr <col:2>
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/builtin-types-no-inheritance.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify %s

// expected-note@? {{'vector' declared here}}
// expected-note@? {{'matrix' declared here}}
Expand Down Expand Up @@ -31,4 +32,5 @@ struct BITIA : BuiltInTriangleIntersectionAttributes {}; // expected-error {{bas
struct RTAS : RaytracingAccelerationStructure {}; // expected-error {{base 'RaytracingAccelerationStructure' is marked 'final'}} fxc-error {{X3000: syntax error: unexpected token 'RaytracingAccelerationStructure'}}
struct GRS : GlobalRootSignature {}; // expected-error {{base 'GlobalRootSignature' is marked 'final'}} fxc-error {{X3000: syntax error: unexpected token 'GlobalRootSignature'}}

[shader("vertex")]
void main() {}
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/const-assign.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tps_6_0 -Wno-unused-value -verify %s

[shader("pixel")]
float4 main() : SV_TARGET
{
const float c = 2.0; // expected-note {{variable 'c' declared const here}} expected-note {{variable 'c' declared const here}} fxc-pass {{}}
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/const-default.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tps_6_0 -Wno-unused-value -verify %s

float g_float1; /* expected-note {{variable 'g_float1' declared const here}} expected-note {{variable 'g_float1' declared const here}} fxc-pass {{}} */
int4 g_vec1; /* expected-note {{variable 'g_vec1' declared const here}} expected-note {{variable 'g_vec1' declared const here}} fxc-pass {{}} */
Expand Down Expand Up @@ -41,6 +42,7 @@ TextureBuffer<FWDDeclStruct> g_texture_buffer3; /* expected-error {{
ConstantBuffer<FWDDeclClass> g_const_buffer4; /* expected-error {{variable has incomplete type 'FWDDeclClass'}} */
TextureBuffer<FWDDeclClass> g_texture_buffer4; /* expected-error {{variable has incomplete type 'FWDDeclClass'}} */

[shader("pixel")]
float4 main() : SV_TARGET
{
g_float1 = g_float1 + 10.0; /* expected-error {{cannot assign to variable 'g_float1' with const-qualified type 'const float'}} fxc-error {{X3025: global variables are implicitly constant, enable compatibility mode to allow modification}} */
Expand Down
4 changes: 3 additions & 1 deletion tools/clang/test/SemaHLSL/const-expr.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify %s

float overload1(float f) { return 1; } /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
double overload1(double f) { return 2; } /* expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} expected-note {{candidate function}} fxc-pass {{}} */
Expand Down Expand Up @@ -381,5 +382,6 @@ void fn_ice() {
float arr_vc_Two[vc_Two.x]; /* expected-error {{variable length arrays are not supported in HLSL}} fxc-pass {{}} */
}

void cs_main() {
[shader("vertex")]
void main() {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -HV 2021 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -HV 2021 -Wno-unused-value -verify %s

// Tests all implicit conversions and explicit casts between type shapes
// (scalars, vectors, matrices, arrays and structs).
Expand Down Expand Up @@ -122,6 +123,7 @@ void to_s2(S2 s) {}
void to_s4(S4 s) {}
void to_s5(S5 s) {}

[shader("vertex")]
void main()
{
int i = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify -HV 2018 %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify -HV 2018 %s

// Tests all implicit conversions and explicit casts between type shapes
// (scalars, vectors, matrices, arrays and structs).
Expand Down Expand Up @@ -108,6 +109,7 @@ void to_s2(S2 s) {}
void to_s4(S4 s) {}
void to_s5(S5 s) {}

[shader("vertex")]
void main()
{
int i = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify %s

// Tests that conversions between numeric and non-numeric types/aggregates are disallowed.

struct NumStruct { int a; };
struct ObjStruct { Buffer a; };

[shader("vertex")]
void main()
{
(Buffer[1])0; /* expected-error {{cannot convert from 'literal int' to 'Buffer [1]'}} fxc-error {{X3017: cannot convert from 'int' to 'Buffer<float4>[1]'}} */
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/enums.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -HV 2017 -verify %s
// RUN: %dxc -Tps_6_0 -HV 2017 -verify %s

enum MyEnum {
ZERO,
Expand Down Expand Up @@ -121,6 +122,7 @@ int getValueFromInt(int i) { /* expected-note {{c
}
}

[shader("pixel")]
int4 main() : SV_Target {
int v0 = getValueFromInt(ZERO);
int v1 = getValueFromInt(MyEnumClass::ONEC); /* expected-error {{no matching function for call to 'getValueFromInt'}} */
Expand Down
4 changes: 3 additions & 1 deletion tools/clang/test/SemaHLSL/functions.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -HV 2018 -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -HV 2018 -verify %s

// __decltype is the GCC way of saying 'decltype', but doesn't require C++11
// _Static_assert is the C11 way of saying 'static_assert', but doesn't require C++11
Expand Down Expand Up @@ -263,7 +264,8 @@ void inout_calls() {
fn_uint_oload3(f2.x); // this selects the in version over inout or out
}

void cs_main() {
[shader("vertex")]
void main() {
float2 f2 = float2(1, 2);
float arr2[2] = { 1, 2 };
fn_float_arr(f2); // expected-error {{no matching function for call to 'fn_float_arr'}} fxc-error {{X3017: 'fn_float_arr': cannot convert from 'float2' to 'float[2]'}}
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/intrinsic-examples.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ float4 FetchFromIndexMap( uniform Texture2D Tex, uniform SamplerState SS, const
struct S { float f; };

RWByteAddressBuffer uav1 : register(u3);
[shader("pixel")]
float4 RWByteAddressBufferMain(uint2 a : A, uint2 b : B) : SV_Target
{
float4 r = 0;
Expand Down Expand Up @@ -97,6 +98,7 @@ uint64_t4 g_u64;

// TODO: currently compiler is not handling intrinsics correctly after we found overloaded intrinsic function before.
// Uncomment errors below after fixing it.
[shader("pixel")]
float4 BitCastMain() : SV_Target {
float4 f1 = 0;
f1 += asfloat(g_f);
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/invalid-decl-template-arg.hlsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tvs_6_0 -verify %s

struct FOOO_A_B { // expected-note{{'FOOO_A_B' declared here}} expected-note{{definition of 'FOOO_A_B' is not complete until the closing '}'}}
FOOO_A v0; // expected-error{{unknown type name 'FOOO_A'; did you mean 'FOOO_A_B'}} expected-error{{field has incomplete type 'FOOO_A_B}}
};

RWStructuredBuffer<FOOO_A_B> Input;

[shader("vertex")]
void main() {}
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/matrix-assignments.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tps_6_0 -verify %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_2_0 matrix-assignments.hlsl
Expand Down Expand Up @@ -35,6 +36,7 @@ void fn3(inout float3 val)
val.y += 2;
}

[shader("pixel")]
float4 main() : SV_Target {

float2 f2;
Expand Down
3 changes: 2 additions & 1 deletion tools/clang/test/SemaHLSL/matrix-syntax-exact-precision.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %dxc -Tlib_6_3 -enable-16bit-types -verify -HV 2018 %s

// RUN: %dxc -Tvs_6_2 -enable-16bit-types -verify -HV 2018 %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_5_1 matrix-syntax.hlsl
Expand Down Expand Up @@ -80,6 +80,7 @@ void matrix_unsigned() {
unsigned int64_t1x4 uint64_tMatrix1; /* fxc-error {{X3000: syntax error: unexpected token 'int64_t1x4'}} */
}

[shader("vertex")]
void main() {
// Multiple assignments in a chain.
matrix<float, 4, 4> mymatrix;
Expand Down
3 changes: 2 additions & 1 deletion tools/clang/test/SemaHLSL/matrix-syntax.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %dxc -Tlib_6_3 -verify %s

// RUN: %dxc -Tvs_6_0 -verify %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_5_1 matrix-syntax.hlsl
Expand Down Expand Up @@ -77,6 +77,7 @@ void matrix_unsigned() {

}

[shader("vertex")]
void main() {
// Multiple assignments in a chain.
matrix<float, 4, 4> mymatrix;
Expand Down
4 changes: 3 additions & 1 deletion tools/clang/test/SemaHLSL/more-operators.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tps_6_0 -Wno-unused-value -verify %s

// This file includes operator tests that target specific cases that are not
// otherwise covered by the other generated files.
Expand Down Expand Up @@ -491,7 +492,8 @@ float3 fn(float a, float b)
return bar < 1 ? float3(foo) : bar; // expected-error {{use of undeclared identifier 'foo'}} fxc-error {{X3004: undeclared identifier 'bar'}}
}

float4 main2(float2 coord : TEXCOORD) : SV_Target
[shader("pixel")]
float4 main(float2 coord : TEXCOORD) : SV_Target
{
return DoSample(tex12, fn(coord.x, coord.y).xy);
}
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/overloading-new-delete-errors.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify -HV 2021 %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify -HV 2021 %s

// This test checks that when we overload new or delete operator
// dxcompiler generates error and no crashes are observed.
Expand All @@ -14,6 +15,7 @@ struct S
}
};

[shader("vertex")]
void main() {
S *a = new S(); // expected-error {{'new' is a reserved keyword in HLSL}} expected-error {{pointers are unsupported in HLSL}}
delete a; // expected-error {{'delete' is a reserved keyword in HLSL}}
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/packreg.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tps_6_0 -verify %s
// :FXC_VERIFY_ARGUMENTS: /E main /T ps_5_1

// fxc error X3115: Conflicting register semantics: 's0' and 's1'
Expand Down Expand Up @@ -633,6 +634,7 @@ float2 f2() {
return 0;
}

[shader("pixel")]
float4 main(float4 param4 : TEXCOORD0) : SV_Target0 {
float f = OuterItem0 + OuterItem1 + InnerItem0;
return g_txDiffuse.Sample(myVar_s, float2(1, f));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// RUN: %dxc -Tlib_6_3 -enable-16bit-types -verify -HV 2018 %s
// RUN: %dxc -Tvs_6_2 -enable-16bit-types -verify -HV 2018 %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_5_1 scalar-assignments.hlsl
// with vs_2_0 (the default) min16float usage produces a complaint that it's not supported

[shader("vertex")]
void main() {

snorm snorm float ssf; // expected-warning {{attribute 'snorm' is already applied}} fxc-error {{X3000: syntax error: unexpected token 'snorm'}}
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/scalar-assignments.hlsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tvs_6_0 -verify %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_5_1 scalar-assignments.hlsl
// with vs_2_0 (the default) min16float usage produces a complaint that it's not supported

[shader("vertex")]
void main() {

snorm snorm float ssf; // expected-warning {{attribute 'snorm' is already applied}} fxc-error {{X3000: syntax error: unexpected token 'snorm'}}
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/sizeof.hlsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tvs_6_0 -Wno-unused-value -verify %s

// Tests usage of the sizeof operator

struct EmptyStruct {};
struct SimpleStruct { int x; };
struct StructWithResource { Buffer buf; int x; };

[shader("vertex")]
void main()
{
// Type vs expression argument
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/string.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tps_6_0 -Wno-unused-value -verify %s

static const string s_global1 = "my global string 1";
/*verify-ast
Expand Down Expand Up @@ -62,6 +63,7 @@ struct test {
string field; /* expected-error {{string declaration may only appear in global scope}} fxc-pass {{}} */
};

[shader("pixel")]
float4 main() : SV_Target0 { /* */
string str; /* expected-error {{string declaration may only appear in global scope}} fxc-pass {{}} */
str = s_global2; /* expected-error {{use of undeclared identifier 'str'}} fxc-pass {{}} */
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/struct-assignments.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -verify %s
// RUN: %dxc -Tvs_6_0 -verify %s

// To test with the classic compiler, run
// %sdxroot%\tools\x86\fxc.exe /T vs_5_1 struct-assignments.hlsl
Expand Down Expand Up @@ -71,6 +72,7 @@ float3 c_f3::get_inc() {
return f3++;
}

[shader("vertex")]
void main() {

s_f2 zsf2_zero_cast = (s_f2)1;
Expand Down
2 changes: 2 additions & 0 deletions tools/clang/test/SemaHLSL/subobjects-syntax.hlsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %dxc -Tlib_6_3 -Wno-unused-value -verify %s
// RUN: %dxc -Tps_6_0 -Wno-unused-value -verify %s

string globalRs = "CBV(b0)";
string localRs = "UAV(u0, visibility = SHADER_VISIBILITY_GEOMETRY)";
Expand Down Expand Up @@ -99,6 +100,7 @@ TriangleHitGroup trHitGt2_8 = { s1, s4 };
ProceduralPrimitiveHitGroup ppHitGt2_8 = { s1, "", s4 };
ProceduralPrimitiveHitGroup ppHitGt2_9 = { "a", "b", ""};

[shader("pixel")]
int main(int i : INDEX) : SV_Target {
return 1;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// RUN: %dxc -Tlib_6_3 -HV 2021 -verify %s
// RUN: %dxc -Tvs_6_0 -HV 2021 -verify %s

RWStructuredBuffer<float> Output;

// expected-note@+1 {{candidate template ignored: deduced conflicting types for parameter 'T' ('float' vs. 'literal float')}}
template <typename T> T Add(T input, T input2) {
return input + input2;
}

[shader("vertex")]
void main() {
// expected-error@+1 {{no matching function for call to 'Add'}}
Output[0] = Add(Output[0], 1.0)
Expand Down
Loading

0 comments on commit ae85bb8

Please sign in to comment.