diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-24 10:01:47 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 10:01:47 -0800 |
| commit | bd6306cdaa4a49344658bd026721b6532e103d09 (patch) | |
| tree | bb7f666d426e6cfc7777a3ccac0a1d628588eb39 /tests/cross-compile | |
| parent | e8c08e7ecb1124f115a1d1042277776193122b57 (diff) | |
More control flow simplifications. (#2673)
* More control flow and Phi param simplifications.
* Fix.
* Fix gcc error.
* Fix.
* More IR cleanup.
* Fix bug in phi param dce + ifelse simplify.
* Propagate and DCE side-effect-free functions.
* Enhance CFG simplifcation to remove loops with no side effects.
* Fix.
* Fixes.
* Fix tests. Add [__AlwaysFoldIntoUseSite] for rayPayloadLocation.
* More cleanup.
* Fixes.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/cross-compile')
| -rw-r--r-- | tests/cross-compile/array-of-buffers.slang.glsl | 20 | ||||
| -rw-r--r-- | tests/cross-compile/array-of-buffers.slang.hlsl | 20 | ||||
| -rw-r--r-- | tests/cross-compile/glsl-generic-in.slang.glsl | 12 | ||||
| -rw-r--r-- | tests/cross-compile/half-conversion.slang.glsl | 29 | ||||
| -rw-r--r-- | tests/cross-compile/sign.slang.glsl | 9 |
5 files changed, 34 insertions, 56 deletions
diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 1f436fad0..21961afd1 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -1,8 +1,6 @@ -//TEST_IGNORE_FILE: #version 450 layout(row_major) uniform; layout(row_major) buffer; - struct SLANG_ParameterGroup_C_0 { uint index_0; @@ -13,7 +11,6 @@ layout(std140) uniform _S1 { SLANG_ParameterGroup_C_0 _data; } C_0; - struct S_0 { vec4 f_0; @@ -24,31 +21,26 @@ layout(std140) uniform _S2 { S_0 _data; } cb_0[3]; - layout(std430, binding = 2) readonly buffer _S3 { S_0 _data[]; } sb1_0[4]; - layout(std430, binding = 3) buffer _S4 { vec4 _data[]; } sb2_0[5]; - layout(std430, binding = 4) readonly buffer _S5 { uint _data[]; } bb_0[6]; - layout(location = 0) out vec4 _S6; void main() { - S_0 _S7 = ((sb1_0[C_0._data.index_0])._data[(C_0._data.index_0)]); - vec4 _S8 = cb_0[C_0._data.index_0]._data.f_0 + _S7.f_0; - vec4 _S9 = _S8 + ((sb2_0[C_0._data.index_0])._data[(C_0._data.index_0)]); - uint _S10 = ((bb_0[C_0._data.index_0])._data[(int(C_0._data.index_0 * 4U))/4]); - - _S6 = _S9 + vec4(float(_S10)); - + vec4 _S7 = cb_0[C_0._data.index_0]._data.f_0; + S_0 _S8 = ((sb1_0[C_0._data.index_0])._data[(C_0._data.index_0)]); + vec4 _S9 = _S7 + _S8.f_0; + vec4 _S10 = _S9 + ((sb2_0[C_0._data.index_0])._data[(C_0._data.index_0)]); + uint _S11 = ((bb_0[C_0._data.index_0])._data[(int(C_0._data.index_0 * 4U))/4]); + _S6 = _S10 + vec4(float(_S11)); return; } diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl index 501b9c6db..960957789 100644 --- a/tests/cross-compile/array-of-buffers.slang.hlsl +++ b/tests/cross-compile/array-of-buffers.slang.hlsl @@ -1,5 +1,3 @@ -//TEST_IGNORE_FILE: - #pragma pack_matrix(column_major) #ifdef SLANG_HLSL_ENABLE_NVAPI #include "nvHLSLExtns.h" @@ -15,24 +13,24 @@ cbuffer C_0 : register(b0) { SLANG_ParameterGroup_C_0 C_0; } - struct S_0 { float4 f_0; }; ConstantBuffer<S_0 > cb_0[int(3)] : register(b1); + StructuredBuffer<S_0 > sb1_0[int(4)] : register(t0); + RWStructuredBuffer<float4 > sb2_0[int(5)] : register(u0); -ByteAddressBuffer bb_0[int(6)] : register(t4); +ByteAddressBuffer bb_0[int(6)] : register(t4); float4 main() : SV_TARGET { - S_0 _S1 = sb1_0[C_0.index_0][C_0.index_0]; - - float4 _S2 = cb_0[C_0.index_0].f_0 + _S1.f_0; - float4 _S3 = _S2 + sb2_0[C_0.index_0][C_0.index_0]; - uint _S4 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); - - return _S3 + (float4)float(_S4); + float4 _S1 = cb_0[C_0.index_0].f_0; + S_0 _S2 = sb1_0[C_0.index_0][C_0.index_0]; + float4 _S3 = _S1 + _S2.f_0; + float4 _S4 = _S3 + sb2_0[C_0.index_0][C_0.index_0]; + uint _S5 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); + return _S4 + (float4)float(_S5); } diff --git a/tests/cross-compile/glsl-generic-in.slang.glsl b/tests/cross-compile/glsl-generic-in.slang.glsl index c8d9b1bd1..4bf0598d0 100644 --- a/tests/cross-compile/glsl-generic-in.slang.glsl +++ b/tests/cross-compile/glsl-generic-in.slang.glsl @@ -1,8 +1,6 @@ -//TEST_IGNORE_FILE: #version 450 layout(row_major) uniform; layout(row_major) buffer; - struct F_0 { vec4 v0_0; @@ -14,10 +12,9 @@ float F_get_0(F_0 this_0) return this_0.v0_0.x + this_0.v1_0.x; } - float E_get_0() { - return 1.00000000000000000000; + return 1.0; } layout(location = 0) @@ -33,14 +30,11 @@ struct VOut_0 { vec4 projPos_0; }; - void main() { F_0 _S4 = { _S2, _S3 }; VOut_0 vout_0; - float _S5 = F_get_0(_S4); - float _S6 = E_get_0(); - vout_0.projPos_0 = vec4(_S1, _S5 + _S6); + vout_0.projPos_0 = vec4(_S1, F_get_0(_S4) + E_get_0()); gl_Position = vout_0.projPos_0; return; -}
\ No newline at end of file +} diff --git a/tests/cross-compile/half-conversion.slang.glsl b/tests/cross-compile/half-conversion.slang.glsl index 58d20b4fc..fb51809b4 100644 --- a/tests/cross-compile/half-conversion.slang.glsl +++ b/tests/cross-compile/half-conversion.slang.glsl @@ -1,8 +1,6 @@ -//half-conversion.slang.glsl -//TEST_IGNORE_FILE: - #version 450 - +layout(row_major) uniform; +layout(row_major) buffer; struct SLANG_ParameterGroup_C_0 { uvec4 u_0; @@ -13,29 +11,30 @@ layout(std140) uniform _S1 { SLANG_ParameterGroup_C_0 _data; } C_0; - vec4 f16tof32_0(uvec4 value_0) { vec4 result_0; - int i_0; - i_0 = 0; + int i_0 = 0; for(;;) { - if(i_0 < 4) {} else break; - - float _S2 = (unpackHalf2x16((value_0[i_0])).x); - result_0[i_0] = _S2; - i_0 = i_0 + int(1); + if(i_0 < 4) + { + } + else + { + break; + } + result_0[i_0] = (unpackHalf2x16((value_0[i_0])).x); + i_0 = i_0 + 1; } return result_0; } layout(location = 0) -out vec4 _S3; +out vec4 _S2; void main() { - vec4 _S4 = f16tof32_0(C_0._data.u_0); - _S3 = _S4; + _S2 = f16tof32_0(C_0._data.u_0); return; } diff --git a/tests/cross-compile/sign.slang.glsl b/tests/cross-compile/sign.slang.glsl index 7a3a37c51..44c015967 100644 --- a/tests/cross-compile/sign.slang.glsl +++ b/tests/cross-compile/sign.slang.glsl @@ -1,17 +1,12 @@ -//TEST_IGNORE_FILE: #version 450 layout(row_major) uniform; layout(row_major) buffer; -#line 8 0 layout(location = 0) out vec4 _S1; - -#line 8 void main() { - ivec4 _S2 = ivec4(sign(vec4(1.50000000000000000000, 1.00000000000000000000, -1.50000000000000000000, -1.00000000000000000000))); - _S1 = vec4(_S2); + _S1 = vec4((ivec4(sign((vec4(1.5, 1.0, -1.5, -1.0)))))); return; -}
\ No newline at end of file +} |
