Adding test files demonstrating type confusion for arrays/structs.

Change-Id: Iacd924471971c3c551648f75c1ecf0f1bfd3ed07
Bug: skia:12642
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479061
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Julia Lavrova 2021-12-02 14:57:53 -05:00 committed by SkCQ
parent 20c6a947af
commit 94f726ae62
13 changed files with 1034 additions and 0 deletions

View File

@ -630,6 +630,10 @@ sksl_rte_tests = [
"/sksl/runtime/LoopFloat.rts",
"/sksl/runtime/PrecisionQualifiers.rts",
"/sksl/runtime/QualifierOrder.rts",
"/sksl/runtime/RecursiveComparison_Structs.rts",
"/sksl/runtime/RecursiveComparison_Arrays.rts",
"/sksl/runtime/RecursiveComparison_Types.rts",
"/sksl/runtime/RecursiveComparison_Vectors.rts",
"/sksl/runtime/SampleWithExplicitCoord.rts",
"/sksl/runtime/Switch.rts",
"/sksl/runtime/SwitchDefaultOnly.rts",

View File

@ -0,0 +1,41 @@
/*#pragma settings NoES2Restrictions*/
uniform half4 colorGreen, colorRed;
bool test_same_arrays(bool eq, float f1, float f2, float f3) {
float one = colorGreen.r + 1;
float a[3]; a[0] = f1; a[1] = f2; a[2] = f3;
float b[3]; b[0] = f1 * one; b[1] = f2 * one; b[2] = f3 * one;
return eq ? a == b : a != b;
}
bool test_diff_arrays(bool eq, float f1, float f2, float f3) {
float two = colorGreen.r + 2;
float a[3]; a[0] = f1; a[1] = f2; a[2] = f3;
float b[3]; b[0] = f1 * two; b[1] = f2 * two; b[2] = f3;
return eq ? a == b : a != b;
}
vec4 main(vec2 coords) {
float NAN1 = colorGreen.r/colorGreen.b;
float NAN2 = colorGreen.b/colorGreen.r;
float ZP = +colorGreen.r*colorGreen.b;
float ZM = -colorGreen.r*colorGreen.b;
float F42 = colorGreen.g * 42.0;
float F43 = colorGreen.g * 43.0;
float F44 = colorGreen.g * 44.0;
bool EQ = true; // Tests for ==
bool NE = false; // Tests for !=
return true
&& test_same_arrays(EQ, F42, ZM, ZP) // equal, including -0 and +0 values
&& !test_same_arrays(NE, F42, ZM, ZP) // not (not equal)
&& test_same_arrays(NE, F42, NAN1, NAN2) // NA values always not equal
&& !test_same_arrays(EQ, F42, NAN1, NAN2)
&& test_diff_arrays(NE, F42, F43, F44) // one of the normal values not equal
&& !test_diff_arrays(EQ, F42, F43, F44)
&& test_diff_arrays(NE, NAN1, ZM, ZP) // one of the normal values not equal
&& !test_diff_arrays(EQ, NAN1, ZM, ZP)
? colorGreen : colorRed;
}

View File

@ -0,0 +1,43 @@
uniform half4 colorGreen, colorRed;
struct S {float f1; float f2; float f3; };
bool test_same_structs(bool eq, float f1, float f2, float f3) {
float one = colorGreen.r + 1;
S a; a.f1 = f1; a.f2 = f2; a.f3 = f3;
S b; b.f1 = f1 * one; b.f2 = f2 * one; b.f3 = f3 * one;
return eq ? a == b : a != b;
}
bool test_diff_structs(bool eq, float f1, float f2, float f3) {
float two = colorGreen.r + 2;
S a; a.f1 = f1; a.f2 = f2; a.f3 = f3;
S b; b.f1 = f1 * two; b.f2 = f2 * two; b.f3 = f3;
return eq ? a == b : a != b;
}
vec4 main(vec2 coords) {
float NAN1 = colorGreen.r/colorGreen.b;
float NAN2 = colorGreen.b/colorGreen.r;
float ZP = +colorGreen.r*colorGreen.b;
float ZM = -colorGreen.r*colorGreen.b;
float F42 = colorGreen.g * 42.0;
float F43 = colorGreen.g * 43.0;
float F44 = colorGreen.g * 44.0;
bool EQ = true; // Tests for ==
bool NE = false; // Tests for !=
return true
&& test_same_structs(EQ, F42, ZM, ZP) // equal, including -0 and +0 values
&& !test_same_structs(NE, F42, ZM, ZP) // not (not equal)
&& test_same_structs(NE, F42, NAN1, NAN2) // NA values always not equal
&& !test_same_structs(EQ, F42, NAN1, NAN2)
&& test_diff_structs(NE, F42, F43, F44) // one of the normal values not equal
&& !test_diff_structs(EQ, F42, F43, F44)
&& test_diff_structs(NE, NAN1, ZM, ZP) // one of the normal values not equal
&& !test_diff_structs(EQ, NAN1, ZM, ZP)
? colorGreen : colorRed;
}

View File

@ -0,0 +1,50 @@
/*#pragma settings NoES2Restrictions*/
uniform half4 colorGreen, colorRed;
struct S {float f1; vec2 v2; };
bool test_same_types(bool eq, float f1, float v2, float f3, float f4, float f5, float f6) {
float one = colorGreen.r + 1;
S a[2]; a[0].f1 = f1; a[0].v2 = vec2(v2, f3);
a[1].f1 = f4; a[1].v2 = vec2(f5, f6);
S b[2]; b[0].f1 = f1 * one; b[0].v2 = vec2(v2 * one, f3 * one);
b[1].f1 = f4 * one; b[1].v2 = vec2(f5 * one, f6 * one);
return eq ? a == b : a != b;
}
bool test_diff_types(bool eq, float f1, float v2, float f3, float f4, float f5, float f6) {
float two = colorGreen.r + 2;
S a[2]; a[0].f1 = f1; a[0].v2 = vec2(v2, f3);
a[1].f1 = f4; a[1].v2 = vec2(f5, f6);
S b[2]; b[0].f1 = f1 * two; b[0].v2 = vec2(v2 * two, f3 * two);
b[1].f1 = f4 * two; b[1].v2 = vec2(f5 * two, f6);
return eq ? a == b : a != b;
}
vec4 main(vec2 coords) {
float NAN1 = colorGreen.r/colorGreen.b;
float NAN2 = colorGreen.b/colorGreen.r;
float ZP = +colorGreen.r*colorGreen.b;
float ZM = -colorGreen.r*colorGreen.b;
float F42 = colorGreen.g * 42.0;
float F43 = colorGreen.g * 43.0;
float F44 = colorGreen.g * 44.0;
float F45 = colorGreen.g * 45.0;
float F46 = colorGreen.g * 46.0;
float F47 = colorGreen.g * 47.0;
bool EQ = true; // Tests for ==
bool NE = false; // Tests for !=
return true
&& test_same_types(EQ, F42, ZM, ZP, F43, F44, F45) // equal, including -0 and +0 values
&& !test_same_types(NE, F42, ZM, ZP, F43, F44, F45) // not (not equal)
&& test_same_types(NE, F42, NAN1, NAN2, F43, F44, F45) // NA values always not equal
&& !test_same_types(EQ, F42, NAN1, NAN2, F43, F44, F45)
&& test_diff_types(NE, F42, F43, F44, F45, F46, F47) // one of the normal values not equal
&& !test_diff_types(EQ, F42, F43, F44, F45, F46, F47)
&& test_diff_types(NE, NAN1, ZM, ZP, F42, F43, F44) // one of the normal values not equal
&& !test_diff_types(EQ, NAN1, ZM, ZP, F42, F43, F44)
? colorGreen : colorRed;
}

View File

@ -0,0 +1,42 @@
uniform half4 colorGreen, colorRed;
bool test_same_vectors(bool eq, float f1, float f2, float f3, float f4) {
float one = colorGreen.r + 1;
vec4 a = float4(f1, f2, f3, f4);
vec4 b = float4(f1 * one, f2 * one, f3 * one, f4 * one);
return eq ? a == b : a != b;
}
bool test_diff_vectors(bool eq, float f1, float f2, float f3, float f4) {
float two = colorGreen.r + 2;
vec4 a = float4(f1, f2, f3, f4);
vec4 b = float4(f1 * two, f2 * two, f3 * two, f4 * two);
return eq ? a == b : a != b;
}
vec4 main(vec2 coords) {
float NAN1 = colorGreen.r/colorGreen.b;
float NAN2 = colorGreen.b/colorGreen.r;
float ZP = +colorGreen.r*colorGreen.b;
float ZM = -colorGreen.r*colorGreen.b;
float F42 = colorGreen.g * 42.0;
float F43 = colorGreen.g * 43.0;
float F44 = colorGreen.g * 44.0;
float F45 = colorGreen.g * 45.0;
bool EQ = true; // Tests for ==
bool NE = false; // Tests for !=
return true
&& test_same_vectors(EQ, F42, ZM, ZP, F43) // equal, including -0 and +0 values
&& !test_same_vectors(NE, F42, ZM, ZP, F43) // not (not equal)
&& test_same_vectors(NE, F42, NAN1, NAN2, F43) // NA values always not equal
&& !test_same_vectors(EQ, F42, NAN1, NAN2, F43)
&& test_diff_vectors(NE, F42, F43, F44, F45) // one of the normal values not equal
&& !test_diff_vectors(EQ, F42, F43, F44, F45)
&& test_diff_vectors(NE, NAN1, ZM, ZP, F42) // one of the normal values not equal
&& !test_diff_vectors(EQ, NAN1, ZM, ZP, F42)
? colorGreen : colorRed;
}

View File

@ -0,0 +1,136 @@
25 registers, 134 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 8
2 r2 = uniform32 ptr0 C
3 r3 = uniform32 ptr0 10
4 r4 = uniform32 ptr0 14
5 r5 = uniform32 ptr0 18
6 r6 = uniform32 ptr0 1C
7 r7 = uniform32 ptr0 20
8 r8 = splat 0 (0)
9 r9 = splat FFFFFFFF (nan)
10 r10 = div_f32 r0 r2
11 r11 = div_f32 r2 r0
12 r12 = mul_f32 r0 r2
13 r8 = sub_f32 r8 r0
14 r8 = mul_f32 r2 r8
15 r13 = splat 42280000 (42)
16 r13 = mul_f32 r1 r13
17 r14 = splat 422C0000 (43)
18 r14 = mul_f32 r1 r14
19 r15 = splat 3F800000 (1)
20 r15 = add_f32 r0 r15
21 r16 = mul_f32 r13 r15
22 r17 = mul_f32 r8 r15
23 r18 = mul_f32 r12 r15
24 r19 = eq_i32 r13 r16
25 r20 = eq_i32 r8 r17
26 r21 = eq_i32 r12 r18
27 r20 = bit_and r19 r20
28 r20 = bit_and r21 r20
29 r21 = bit_and r13 r20
30 r19 = bit_and r8 r20
31 r12 = bit_and r12 r20
32 r22 = bit_and r16 r20
33 r17 = bit_and r17 r20
34 r18 = bit_and r18 r20
35 r22 = eq_i32 r21 r22
36 r17 = eq_i32 r19 r17
37 r18 = eq_i32 r12 r18
38 r22 = bit_xor r9 r22
39 r17 = bit_xor r9 r17
40 r18 = bit_xor r9 r18
41 r17 = bit_or r22 r17
42 r17 = bit_or r18 r17
43 r17 = bit_and r20 r17
44 r18 = bit_xor r9 r17
45 r18 = bit_and r20 r18
46 r20 = bit_and r13 r18
47 r22 = bit_and r10 r18
48 r12 = bit_and r11 r18
49 r19 = bit_and r16 r18
50 r21 = mul_f32 r10 r15
51 r23 = bit_and r18 r21
52 r15 = mul_f32 r11 r15
53 r24 = bit_and r18 r15
54 r19 = eq_i32 r20 r19
55 r23 = eq_i32 r22 r23
56 r24 = eq_i32 r12 r24
57 r19 = bit_xor r9 r19
58 r23 = bit_xor r9 r23
59 r24 = bit_xor r9 r24
60 r23 = bit_or r19 r23
61 r23 = bit_or r24 r23
62 r17 = select r18 r23 r17
63 r18 = bit_and r18 r17
64 r23 = bit_and r13 r18
65 r24 = bit_and r10 r18
66 r11 = bit_and r11 r18
67 r16 = bit_and r16 r18
68 r21 = bit_and r21 r18
69 r15 = bit_and r15 r18
70 r16 = eq_i32 r23 r16
71 r21 = eq_i32 r24 r21
72 r15 = eq_i32 r11 r15
73 r21 = bit_and r16 r21
74 r21 = bit_and r15 r21
75 r17 = select r18 r21 r17
76 r17 = bit_xor r9 r17
77 r17 = bit_and r18 r17
78 r18 = splat 40000000 (2)
79 r18 = add_f32 r0 r18
80 r21 = bit_and r13 r17
81 r15 = bit_and r14 r17
82 r16 = mul_f32 r13 r18
83 r11 = bit_and r17 r16
84 r24 = mul_f32 r14 r18
85 r23 = bit_and r17 r24
86 r11 = eq_i32 r21 r11
87 r23 = eq_i32 r15 r23
88 r11 = bit_xor r9 r11
89 r23 = bit_xor r9 r23
90 r23 = bit_or r11 r23
91 r23 = bit_and r17 r23
92 r17 = bit_and r17 r23
93 r13 = bit_and r13 r17
94 r14 = bit_and r14 r17
95 r16 = bit_and r16 r17
96 r24 = bit_and r24 r17
97 r16 = eq_i32 r13 r16
98 r24 = eq_i32 r14 r24
99 r24 = bit_and r16 r24
100 r23 = select r17 r24 r23
101 r24 = bit_xor r9 r23
102 r24 = bit_and r17 r24
103 r17 = bit_and r10 r24
104 r16 = bit_and r8 r24
105 r14 = mul_f32 r10 r18
106 r13 = bit_and r24 r14
107 r18 = mul_f32 r8 r18
108 r11 = bit_and r24 r18
109 r13 = eq_i32 r17 r13
110 r11 = eq_i32 r16 r11
111 r13 = bit_xor r9 r13
112 r11 = bit_xor r9 r11
113 r11 = bit_or r13 r11
114 r23 = select r24 r11 r23
115 r24 = bit_and r24 r23
116 r10 = bit_and r10 r24
117 r8 = bit_and r8 r24
118 r14 = bit_and r14 r24
119 r18 = bit_and r18 r24
120 r14 = eq_i32 r10 r14
121 r18 = eq_i32 r8 r18
122 r18 = bit_and r14 r18
123 r23 = select r24 r18 r23
124 r23 = bit_xor r9 r23
125 r23 = bit_and r24 r23
126 r4 = select r23 r0 r4
127 r5 = select r23 r1 r5
128 r6 = select r23 r2 r6
129 r7 = select r23 r3 r7
loop:
130 store32 ptr1 r4
131 store32 ptr2 r5
132 store32 ptr3 r6
133 store32 ptr4 r7

View File

@ -0,0 +1,52 @@
uniform half4 colorGreen;
uniform half4 colorRed;
bool test_same_arrays_0(bool eq, float f1, float f2, float f3);
bool test_diff_arrays_0(bool eq, float f1, float f2, float f3);
bool test_same_arrays_0(bool eq, float f1, float f2, float f3)
{
float one = float(colorGreen.x + 1.0);
float a[3];
a[0] = f1;
a[1] = f2;
a[2] = f3;
float b[3];
b[0] = f1 * one;
b[1] = f2 * one;
b[2] = f3 * one;
return eq ? a == b : a != b;
}
bool test_diff_arrays_0(bool eq, float f1, float f2, float f3)
{
float two = float(colorGreen.x + 2.0);
float a[3];
a[0] = f1;
a[1] = f2;
a[2] = f3;
float b[3];
b[0] = f1 * two;
b[1] = f2 * two;
b[2] = f3;
return eq ? a == b : a != b;
}
float4 main(float2 coords)
{
float NAN1 = float(colorGreen.x / colorGreen.z);
float NAN2 = float(colorGreen.z / colorGreen.x);
float ZP = float(colorGreen.x * colorGreen.z);
float ZM = float(-colorGreen.x * colorGreen.z);
float F42 = float(colorGreen.y * 42.0);
float F43 = float(colorGreen.y * 43.0);
float F44 = float(colorGreen.y * 44.0);
bool EQ = true;
bool NE = false;
float _0_one = float(colorGreen.x + 1.0);
float _1_a[3];
_1_a[0] = F42;
_1_a[1] = ZM;
_1_a[2] = ZP;
float _2_b[3];
_2_b[0] = F42 * _0_one;
_2_b[1] = ZM * _0_one;
_2_b[2] = ZP * _0_one;
return half4(float4((((((((EQ ? _1_a == _2_b : _1_a != _2_b) && !test_same_arrays_0(NE, F42, ZM, ZP)) && test_same_arrays_0(NE, F42, NAN1, NAN2)) && !test_same_arrays_0(EQ, F42, NAN1, NAN2)) && test_diff_arrays_0(NE, F42, F43, F44)) && !test_diff_arrays_0(EQ, F42, F43, F44)) && test_diff_arrays_0(NE, NAN1, ZM, ZP)) && !test_diff_arrays_0(EQ, NAN1, ZM, ZP) ? colorGreen : colorRed));
}

View File

@ -0,0 +1,136 @@
25 registers, 134 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 8
2 r2 = uniform32 ptr0 C
3 r3 = uniform32 ptr0 10
4 r4 = uniform32 ptr0 14
5 r5 = uniform32 ptr0 18
6 r6 = uniform32 ptr0 1C
7 r7 = uniform32 ptr0 20
8 r8 = splat 0 (0)
9 r9 = splat FFFFFFFF (nan)
10 r10 = div_f32 r0 r2
11 r11 = div_f32 r2 r0
12 r12 = mul_f32 r0 r2
13 r8 = sub_f32 r8 r0
14 r8 = mul_f32 r2 r8
15 r13 = splat 42280000 (42)
16 r13 = mul_f32 r1 r13
17 r14 = splat 422C0000 (43)
18 r14 = mul_f32 r1 r14
19 r15 = splat 3F800000 (1)
20 r15 = add_f32 r0 r15
21 r16 = mul_f32 r13 r15
22 r17 = mul_f32 r8 r15
23 r18 = mul_f32 r12 r15
24 r19 = eq_i32 r13 r16
25 r20 = eq_i32 r8 r17
26 r21 = eq_i32 r12 r18
27 r20 = bit_and r19 r20
28 r20 = bit_and r21 r20
29 r21 = bit_and r13 r20
30 r19 = bit_and r8 r20
31 r12 = bit_and r12 r20
32 r22 = bit_and r16 r20
33 r17 = bit_and r17 r20
34 r18 = bit_and r18 r20
35 r22 = eq_i32 r21 r22
36 r17 = eq_i32 r19 r17
37 r18 = eq_i32 r12 r18
38 r22 = bit_xor r9 r22
39 r17 = bit_xor r9 r17
40 r18 = bit_xor r9 r18
41 r17 = bit_or r22 r17
42 r17 = bit_or r18 r17
43 r17 = bit_and r20 r17
44 r18 = bit_xor r9 r17
45 r18 = bit_and r20 r18
46 r20 = bit_and r13 r18
47 r22 = bit_and r10 r18
48 r12 = bit_and r11 r18
49 r19 = bit_and r16 r18
50 r21 = mul_f32 r10 r15
51 r23 = bit_and r18 r21
52 r15 = mul_f32 r11 r15
53 r24 = bit_and r18 r15
54 r19 = eq_i32 r20 r19
55 r23 = eq_i32 r22 r23
56 r24 = eq_i32 r12 r24
57 r19 = bit_xor r9 r19
58 r23 = bit_xor r9 r23
59 r24 = bit_xor r9 r24
60 r23 = bit_or r19 r23
61 r23 = bit_or r24 r23
62 r17 = select r18 r23 r17
63 r18 = bit_and r18 r17
64 r23 = bit_and r13 r18
65 r24 = bit_and r10 r18
66 r11 = bit_and r11 r18
67 r16 = bit_and r16 r18
68 r21 = bit_and r21 r18
69 r15 = bit_and r15 r18
70 r16 = eq_i32 r23 r16
71 r21 = eq_i32 r24 r21
72 r15 = eq_i32 r11 r15
73 r21 = bit_and r16 r21
74 r21 = bit_and r15 r21
75 r17 = select r18 r21 r17
76 r17 = bit_xor r9 r17
77 r17 = bit_and r18 r17
78 r18 = splat 40000000 (2)
79 r18 = add_f32 r0 r18
80 r21 = bit_and r13 r17
81 r15 = bit_and r14 r17
82 r16 = mul_f32 r13 r18
83 r11 = bit_and r17 r16
84 r24 = mul_f32 r14 r18
85 r23 = bit_and r17 r24
86 r11 = eq_i32 r21 r11
87 r23 = eq_i32 r15 r23
88 r11 = bit_xor r9 r11
89 r23 = bit_xor r9 r23
90 r23 = bit_or r11 r23
91 r23 = bit_and r17 r23
92 r17 = bit_and r17 r23
93 r13 = bit_and r13 r17
94 r14 = bit_and r14 r17
95 r16 = bit_and r16 r17
96 r24 = bit_and r24 r17
97 r16 = eq_i32 r13 r16
98 r24 = eq_i32 r14 r24
99 r24 = bit_and r16 r24
100 r23 = select r17 r24 r23
101 r24 = bit_xor r9 r23
102 r24 = bit_and r17 r24
103 r17 = bit_and r10 r24
104 r16 = bit_and r8 r24
105 r14 = mul_f32 r10 r18
106 r13 = bit_and r24 r14
107 r18 = mul_f32 r8 r18
108 r11 = bit_and r24 r18
109 r13 = eq_i32 r17 r13
110 r11 = eq_i32 r16 r11
111 r13 = bit_xor r9 r13
112 r11 = bit_xor r9 r11
113 r11 = bit_or r13 r11
114 r23 = select r24 r11 r23
115 r24 = bit_and r24 r23
116 r10 = bit_and r10 r24
117 r8 = bit_and r8 r24
118 r14 = bit_and r14 r24
119 r18 = bit_and r18 r24
120 r14 = eq_i32 r10 r14
121 r18 = eq_i32 r8 r18
122 r18 = bit_and r14 r18
123 r23 = select r24 r18 r23
124 r23 = bit_xor r9 r23
125 r23 = bit_and r24 r23
126 r4 = select r23 r0 r4
127 r5 = select r23 r1 r5
128 r6 = select r23 r2 r6
129 r7 = select r23 r3 r7
loop:
130 store32 ptr1 r4
131 store32 ptr2 r5
132 store32 ptr3 r6
133 store32 ptr4 r7

View File

@ -0,0 +1,59 @@
uniform half4 colorGreen;
uniform half4 colorRed;
struct S_0
{
float f1;
float f2;
float f3;
}
;
bool test_same_structs_0(bool eq, float f1, float f2, float f3);
bool test_diff_structs_0(bool eq, float f1, float f2, float f3);
bool test_same_structs_0(bool eq, float f1, float f2, float f3)
{
float one = float(colorGreen.x + 1.0);
S_0 a;
a.f1 = f1;
a.f2 = f2;
a.f3 = f3;
S_0 b;
b.f1 = f1 * one;
b.f2 = f2 * one;
b.f3 = f3 * one;
return eq ? a == b : a != b;
}
bool test_diff_structs_0(bool eq, float f1, float f2, float f3)
{
float two = float(colorGreen.x + 2.0);
S_0 a;
a.f1 = f1;
a.f2 = f2;
a.f3 = f3;
S_0 b;
b.f1 = f1 * two;
b.f2 = f2 * two;
b.f3 = f3;
return eq ? a == b : a != b;
}
float4 main(float2 coords)
{
float NAN1 = float(colorGreen.x / colorGreen.z);
float NAN2 = float(colorGreen.z / colorGreen.x);
float ZP = float(colorGreen.x * colorGreen.z);
float ZM = float(-colorGreen.x * colorGreen.z);
float F42 = float(colorGreen.y * 42.0);
float F43 = float(colorGreen.y * 43.0);
float F44 = float(colorGreen.y * 44.0);
bool EQ = true;
bool NE = false;
float _0_one = float(colorGreen.x + 1.0);
S_0 _1_a;
_1_a.f1 = F42;
_1_a.f2 = ZM;
_1_a.f3 = ZP;
S_0 _2_b;
_2_b.f1 = F42 * _0_one;
_2_b.f2 = ZM * _0_one;
_2_b.f3 = ZP * _0_one;
return half4(float4((((((((EQ ? _1_a == _2_b : _1_a != _2_b) && !test_same_structs_0(NE, F42, ZM, ZP)) && test_same_structs_0(NE, F42, NAN1, NAN2)) && !test_same_structs_0(EQ, F42, NAN1, NAN2)) && test_diff_structs_0(NE, F42, F43, F44)) && !test_diff_structs_0(EQ, F42, F43, F44)) && test_diff_structs_0(NE, NAN1, ZM, ZP)) && !test_diff_structs_0(EQ, NAN1, ZM, ZP) ? colorGreen : colorRed));
}

View File

@ -0,0 +1,251 @@
38 registers, 249 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 8
2 r2 = uniform32 ptr0 C
3 r3 = uniform32 ptr0 10
4 r4 = uniform32 ptr0 14
5 r5 = uniform32 ptr0 18
6 r6 = uniform32 ptr0 1C
7 r7 = uniform32 ptr0 20
8 r8 = splat 0 (0)
9 r9 = splat FFFFFFFF (nan)
10 r10 = div_f32 r0 r2
11 r11 = div_f32 r2 r0
12 r12 = mul_f32 r0 r2
13 r8 = sub_f32 r8 r0
14 r8 = mul_f32 r2 r8
15 r13 = splat 42280000 (42)
16 r13 = mul_f32 r1 r13
17 r14 = splat 422C0000 (43)
18 r14 = mul_f32 r1 r14
19 r15 = splat 42300000 (44)
20 r15 = mul_f32 r1 r15
21 r16 = splat 42340000 (45)
22 r16 = mul_f32 r1 r16
23 r17 = splat 42380000 (46)
24 r17 = mul_f32 r1 r17
25 r18 = splat 3F800000 (1)
26 r18 = add_f32 r0 r18
27 r19 = mul_f32 r13 r18
28 r20 = mul_f32 r8 r18
29 r21 = mul_f32 r12 r18
30 r22 = mul_f32 r14 r18
31 r23 = mul_f32 r15 r18
32 r24 = mul_f32 r16 r18
33 r25 = eq_i32 r13 r19
34 r26 = eq_i32 r8 r20
35 r27 = eq_i32 r12 r21
36 r28 = eq_i32 r14 r22
37 r29 = eq_i32 r15 r23
38 r30 = eq_i32 r16 r24
39 r26 = bit_and r25 r26
40 r26 = bit_and r27 r26
41 r26 = bit_and r28 r26
42 r26 = bit_and r29 r26
43 r26 = bit_and r30 r26
44 r30 = bit_and r13 r26
45 r29 = bit_and r8 r26
46 r28 = bit_and r12 r26
47 r27 = bit_and r14 r26
48 r25 = bit_and r15 r26
49 r31 = bit_and r16 r26
50 r32 = bit_and r19 r26
51 r20 = bit_and r20 r26
52 r21 = bit_and r21 r26
53 r33 = bit_and r22 r26
54 r34 = bit_and r23 r26
55 r35 = bit_and r24 r26
56 r32 = eq_i32 r30 r32
57 r20 = eq_i32 r29 r20
58 r21 = eq_i32 r28 r21
59 r33 = eq_i32 r27 r33
60 r34 = eq_i32 r25 r34
61 r35 = eq_i32 r31 r35
62 r32 = bit_xor r9 r32
63 r20 = bit_xor r9 r20
64 r21 = bit_xor r9 r21
65 r33 = bit_xor r9 r33
66 r34 = bit_xor r9 r34
67 r35 = bit_xor r9 r35
68 r20 = bit_or r32 r20
69 r20 = bit_or r21 r20
70 r20 = bit_or r33 r20
71 r20 = bit_or r34 r20
72 r20 = bit_or r35 r20
73 r20 = bit_and r26 r20
74 r35 = bit_xor r9 r20
75 r35 = bit_and r26 r35
76 r26 = bit_and r13 r35
77 r34 = bit_and r10 r35
78 r33 = bit_and r11 r35
79 r21 = bit_and r14 r35
80 r32 = bit_and r15 r35
81 r31 = bit_and r16 r35
82 r25 = bit_and r19 r35
83 r27 = mul_f32 r10 r18
84 r18 = mul_f32 r11 r18
85 r28 = bit_and r35 r27
86 r29 = bit_and r35 r18
87 r30 = bit_and r22 r35
88 r36 = bit_and r23 r35
89 r37 = bit_and r24 r35
90 r25 = eq_i32 r26 r25
91 r28 = eq_i32 r34 r28
92 r29 = eq_i32 r33 r29
93 r30 = eq_i32 r21 r30
94 r36 = eq_i32 r32 r36
95 r37 = eq_i32 r31 r37
96 r25 = bit_xor r9 r25
97 r28 = bit_xor r9 r28
98 r29 = bit_xor r9 r29
99 r30 = bit_xor r9 r30
100 r36 = bit_xor r9 r36
101 r37 = bit_xor r9 r37
102 r28 = bit_or r25 r28
103 r28 = bit_or r29 r28
104 r28 = bit_or r30 r28
105 r28 = bit_or r36 r28
106 r28 = bit_or r37 r28
107 r20 = select r35 r28 r20
108 r35 = bit_and r35 r20
109 r28 = bit_and r13 r35
110 r37 = bit_and r10 r35
111 r11 = bit_and r11 r35
112 r36 = bit_and r14 r35
113 r30 = bit_and r15 r35
114 r29 = bit_and r16 r35
115 r19 = bit_and r19 r35
116 r27 = bit_and r27 r35
117 r18 = bit_and r18 r35
118 r22 = bit_and r22 r35
119 r23 = bit_and r23 r35
120 r24 = bit_and r24 r35
121 r19 = eq_i32 r28 r19
122 r27 = eq_i32 r37 r27
123 r18 = eq_i32 r11 r18
124 r22 = eq_i32 r36 r22
125 r23 = eq_i32 r30 r23
126 r24 = eq_i32 r29 r24
127 r27 = bit_and r19 r27
128 r27 = bit_and r18 r27
129 r27 = bit_and r22 r27
130 r27 = bit_and r23 r27
131 r27 = bit_and r24 r27
132 r20 = select r35 r27 r20
133 r20 = bit_xor r9 r20
134 r20 = bit_and r35 r20
135 r35 = splat 40000000 (2)
136 r35 = add_f32 r0 r35
137 r27 = bit_and r13 r20
138 r24 = bit_and r14 r20
139 r23 = bit_and r15 r20
140 r22 = bit_and r16 r20
141 r18 = bit_and r17 r20
142 r19 = mul_f32 r13 r35
143 r29 = bit_and r20 r19
144 r30 = mul_f32 r14 r35
145 r36 = mul_f32 r15 r35
146 r11 = bit_and r20 r30
147 r37 = bit_and r20 r36
148 r28 = mul_f32 r16 r35
149 r25 = bit_and r20 r28
150 r31 = mul_f32 r17 r35
151 r32 = bit_and r20 r31
152 r29 = eq_i32 r27 r29
153 r11 = eq_i32 r24 r11
154 r37 = eq_i32 r23 r37
155 r25 = eq_i32 r22 r25
156 r32 = eq_i32 r18 r32
157 r29 = bit_xor r9 r29
158 r11 = bit_xor r9 r11
159 r37 = bit_xor r9 r37
160 r25 = bit_xor r9 r25
161 r32 = bit_xor r9 r32
162 r11 = bit_or r29 r11
163 r11 = bit_or r37 r11
164 r11 = bit_or r25 r11
165 r11 = bit_or r32 r11
166 r11 = bit_and r20 r11
167 r20 = bit_and r20 r11
168 r32 = bit_and r13 r20
169 r25 = bit_and r14 r20
170 r15 = bit_and r15 r20
171 r16 = bit_and r16 r20
172 r17 = bit_and r17 r20
173 r37 = bit_and r19 r20
174 r29 = bit_and r30 r20
175 r36 = bit_and r36 r20
176 r28 = bit_and r28 r20
177 r31 = bit_and r31 r20
178 r37 = eq_i32 r32 r37
179 r29 = eq_i32 r25 r29
180 r36 = eq_i32 r15 r36
181 r28 = eq_i32 r16 r28
182 r31 = eq_i32 r17 r31
183 r29 = bit_and r37 r29
184 r29 = bit_and r36 r29
185 r29 = bit_and r28 r29
186 r29 = bit_and r31 r29
187 r11 = select r20 r29 r11
188 r29 = bit_xor r9 r11
189 r29 = bit_and r20 r29
190 r20 = bit_and r10 r29
191 r31 = bit_and r8 r29
192 r28 = bit_and r12 r29
193 r36 = bit_and r13 r29
194 r37 = bit_and r14 r29
195 r17 = mul_f32 r10 r35
196 r16 = bit_and r29 r17
197 r15 = mul_f32 r8 r35
198 r35 = mul_f32 r12 r35
199 r25 = bit_and r29 r15
200 r32 = bit_and r29 r35
201 r18 = bit_and r19 r29
202 r22 = bit_and r30 r29
203 r16 = eq_i32 r20 r16
204 r25 = eq_i32 r31 r25
205 r32 = eq_i32 r28 r32
206 r18 = eq_i32 r36 r18
207 r22 = eq_i32 r37 r22
208 r16 = bit_xor r9 r16
209 r25 = bit_xor r9 r25
210 r32 = bit_xor r9 r32
211 r18 = bit_xor r9 r18
212 r22 = bit_xor r9 r22
213 r25 = bit_or r16 r25
214 r25 = bit_or r32 r25
215 r25 = bit_or r18 r25
216 r25 = bit_or r22 r25
217 r11 = select r29 r25 r11
218 r29 = bit_and r29 r11
219 r10 = bit_and r10 r29
220 r8 = bit_and r8 r29
221 r12 = bit_and r12 r29
222 r13 = bit_and r13 r29
223 r14 = bit_and r14 r29
224 r17 = bit_and r17 r29
225 r15 = bit_and r15 r29
226 r35 = bit_and r35 r29
227 r19 = bit_and r19 r29
228 r30 = bit_and r30 r29
229 r17 = eq_i32 r10 r17
230 r15 = eq_i32 r8 r15
231 r35 = eq_i32 r12 r35
232 r19 = eq_i32 r13 r19
233 r30 = eq_i32 r14 r30
234 r15 = bit_and r17 r15
235 r15 = bit_and r35 r15
236 r15 = bit_and r19 r15
237 r15 = bit_and r30 r15
238 r11 = select r29 r15 r11
239 r11 = bit_xor r9 r11
240 r11 = bit_and r29 r11
241 r4 = select r11 r0 r4
242 r5 = select r11 r1 r5
243 r6 = select r11 r2 r6
244 r7 = select r11 r3 r7
loop:
245 store32 ptr1 r4
246 store32 ptr2 r5
247 store32 ptr3 r6
248 store32 ptr4 r7

View File

@ -0,0 +1,67 @@
uniform half4 colorGreen;
uniform half4 colorRed;
struct S_0
{
float f1;
float2 v2;
}
;
bool test_same_types_0(bool eq, float f1, float v2, float f3, float f4, float f5, float f6);
bool test_diff_types_0(bool eq, float f1, float v2, float f3, float f4, float f5, float f6);
bool test_same_types_0(bool eq, float f1, float v2, float f3, float f4, float f5, float f6)
{
float one = float(colorGreen.x + 1.0);
S_0 a[2];
a[0].f1 = f1;
a[0].v2 = float2(v2, f3);
a[1].f1 = f4;
a[1].v2 = float2(f5, f6);
S_0 b[2];
b[0].f1 = f1 * one;
b[0].v2 = float2(v2 * one, f3 * one);
b[1].f1 = f4 * one;
b[1].v2 = float2(f5 * one, f6 * one);
return eq ? a == b : a != b;
}
bool test_diff_types_0(bool eq, float f1, float v2, float f3, float f4, float f5, float f6)
{
float two = float(colorGreen.x + 2.0);
S_0 a[2];
a[0].f1 = f1;
a[0].v2 = float2(v2, f3);
a[1].f1 = f4;
a[1].v2 = float2(f5, f6);
S_0 b[2];
b[0].f1 = f1 * two;
b[0].v2 = float2(v2 * two, f3 * two);
b[1].f1 = f4 * two;
b[1].v2 = float2(f5 * two, f6);
return eq ? a == b : a != b;
}
float4 main(float2 coords)
{
float NAN1 = float(colorGreen.x / colorGreen.z);
float NAN2 = float(colorGreen.z / colorGreen.x);
float ZP = float(colorGreen.x * colorGreen.z);
float ZM = float(-colorGreen.x * colorGreen.z);
float F42 = float(colorGreen.y * 42.0);
float F43 = float(colorGreen.y * 43.0);
float F44 = float(colorGreen.y * 44.0);
float F45 = float(colorGreen.y * 45.0);
float F46 = float(colorGreen.y * 46.0);
float F47 = float(colorGreen.y * 47.0);
bool EQ = true;
bool NE = false;
float _0_one = float(colorGreen.x + 1.0);
S_0 _1_a[2];
_1_a[0].f1 = F42;
_1_a[0].v2 = float2(ZM, ZP);
_1_a[1].f1 = F43;
_1_a[1].v2 = float2(F44, F45);
S_0 _2_b[2];
_2_b[0].f1 = F42 * _0_one;
_2_b[0].v2 = float2(ZM * _0_one, ZP * _0_one);
_2_b[1].f1 = F43 * _0_one;
_2_b[1].v2 = float2(F44 * _0_one, F45 * _0_one);
return half4(float4((((((((EQ ? _1_a == _2_b : _1_a != _2_b) && !test_same_types_0(NE, F42, ZM, ZP, F43, F44, F45)) && test_same_types_0(NE, F42, NAN1, NAN2, F43, F44, F45)) && !test_same_types_0(EQ, F42, NAN1, NAN2, F43, F44, F45)) && test_diff_types_0(NE, F42, F43, F44, F45, F46, F47)) && !test_diff_types_0(EQ, F42, F43, F44, F45, F46, F47)) && test_diff_types_0(NE, NAN1, ZM, ZP, F42, F43, F44)) && !test_diff_types_0(EQ, NAN1, ZM, ZP, F42, F43, F44) ? colorGreen : colorRed));
}

View File

@ -0,0 +1,118 @@
27 registers, 116 instructions:
0 r0 = uniform32 ptr0 4
1 r1 = uniform32 ptr0 8
2 r2 = uniform32 ptr0 C
3 r3 = uniform32 ptr0 10
4 r4 = uniform32 ptr0 14
5 r5 = uniform32 ptr0 18
6 r6 = uniform32 ptr0 1C
7 r7 = uniform32 ptr0 20
8 r8 = splat 0 (0)
9 r9 = splat FFFFFFFF (nan)
10 r10 = div_f32 r0 r2
11 r11 = div_f32 r2 r0
12 r12 = mul_f32 r0 r2
13 r8 = sub_f32 r8 r0
14 r8 = mul_f32 r2 r8
15 r13 = splat 42280000 (42)
16 r13 = mul_f32 r1 r13
17 r14 = splat 422C0000 (43)
18 r14 = mul_f32 r1 r14
19 r15 = splat 42300000 (44)
20 r15 = mul_f32 r1 r15
21 r16 = splat 42340000 (45)
22 r16 = mul_f32 r1 r16
23 r17 = splat 3F800000 (1)
24 r17 = add_f32 r0 r17
25 r18 = mul_f32 r13 r17
26 r19 = mul_f32 r8 r17
27 r20 = mul_f32 r12 r17
28 r21 = mul_f32 r14 r17
29 r22 = eq_f32 r13 r18
30 r23 = eq_f32 r8 r19
31 r24 = eq_f32 r12 r20
32 r25 = eq_f32 r14 r21
33 r23 = bit_and r22 r23
34 r23 = bit_and r24 r23
35 r23 = bit_and r25 r23
36 r18 = neq_f32 r13 r18
37 r19 = neq_f32 r8 r19
38 r20 = neq_f32 r12 r20
39 r21 = neq_f32 r14 r21
40 r19 = bit_or r18 r19
41 r19 = bit_or r20 r19
42 r19 = bit_or r21 r19
43 r19 = bit_and r23 r19
44 r20 = bit_xor r9 r19
45 r20 = bit_and r23 r20
46 r23 = mul_f32 r10 r17
47 r17 = mul_f32 r11 r17
48 r24 = eq_f32 r10 r23
49 r26 = eq_f32 r11 r17
50 r24 = bit_and r22 r24
51 r24 = bit_and r26 r24
52 r24 = bit_and r25 r24
53 r23 = neq_f32 r10 r23
54 r17 = neq_f32 r11 r17
55 r23 = bit_or r18 r23
56 r23 = bit_or r17 r23
57 r23 = bit_or r21 r23
58 r19 = select r20 r23 r19
59 r20 = bit_and r20 r19
60 r19 = select r20 r24 r19
61 r19 = bit_xor r9 r19
62 r19 = bit_and r20 r19
63 r20 = splat 40000000 (2)
64 r20 = add_f32 r0 r20
65 r24 = mul_f32 r13 r20
66 r23 = mul_f32 r14 r20
67 r21 = mul_f32 r15 r20
68 r17 = mul_f32 r16 r20
69 r18 = eq_f32 r13 r24
70 r11 = eq_f32 r14 r23
71 r25 = eq_f32 r15 r21
72 r26 = eq_f32 r16 r17
73 r11 = bit_and r18 r11
74 r11 = bit_and r25 r11
75 r11 = bit_and r26 r11
76 r24 = neq_f32 r13 r24
77 r23 = neq_f32 r14 r23
78 r21 = neq_f32 r15 r21
79 r17 = neq_f32 r16 r17
80 r23 = bit_or r24 r23
81 r23 = bit_or r21 r23
82 r23 = bit_or r17 r23
83 r23 = bit_and r19 r23
84 r19 = bit_and r19 r23
85 r23 = select r19 r11 r23
86 r11 = bit_xor r9 r23
87 r11 = bit_and r19 r11
88 r19 = mul_f32 r10 r20
89 r17 = mul_f32 r8 r20
90 r20 = mul_f32 r12 r20
91 r21 = eq_f32 r10 r19
92 r16 = eq_f32 r8 r17
93 r15 = eq_f32 r12 r20
94 r16 = bit_and r21 r16
95 r16 = bit_and r15 r16
96 r16 = bit_and r18 r16
97 r19 = neq_f32 r10 r19
98 r17 = neq_f32 r8 r17
99 r20 = neq_f32 r12 r20
100 r17 = bit_or r19 r17
101 r17 = bit_or r20 r17
102 r17 = bit_or r24 r17
103 r23 = select r11 r17 r23
104 r11 = bit_and r11 r23
105 r23 = select r11 r16 r23
106 r23 = bit_xor r9 r23
107 r23 = bit_and r11 r23
108 r4 = select r23 r0 r4
109 r5 = select r23 r1 r5
110 r6 = select r23 r2 r6
111 r7 = select r23 r3 r7
loop:
112 store32 ptr1 r4
113 store32 ptr2 r5
114 store32 ptr3 r6
115 store32 ptr4 r7

View File

@ -0,0 +1,35 @@
uniform half4 colorGreen;
uniform half4 colorRed;
bool test_same_vectors_0(bool eq, float f1, float f2, float f3, float f4);
bool test_diff_vectors_0(bool eq, float f1, float f2, float f3, float f4);
bool test_same_vectors_0(bool eq, float f1, float f2, float f3, float f4)
{
float one = float(colorGreen.x + 1.0);
float4 a = float4(f1, f2, f3, f4);
float4 b = float4(f1 * one, f2 * one, f3 * one, f4 * one);
return eq ? a == b : a != b;
}
bool test_diff_vectors_0(bool eq, float f1, float f2, float f3, float f4)
{
float two = float(colorGreen.x + 2.0);
float4 a = float4(f1, f2, f3, f4);
float4 b = float4(f1 * two, f2 * two, f3 * two, f4 * two);
return eq ? a == b : a != b;
}
float4 main(float2 coords)
{
float NAN1 = float(colorGreen.x / colorGreen.z);
float NAN2 = float(colorGreen.z / colorGreen.x);
float ZP = float(colorGreen.x * colorGreen.z);
float ZM = float(-colorGreen.x * colorGreen.z);
float F42 = float(colorGreen.y * 42.0);
float F43 = float(colorGreen.y * 43.0);
float F44 = float(colorGreen.y * 44.0);
float F45 = float(colorGreen.y * 45.0);
bool EQ = true;
bool NE = false;
float _0_one = float(colorGreen.x + 1.0);
float4 _1_a = float4(F42, ZM, ZP, F43);
float4 _2_b = float4(F42 * _0_one, ZM * _0_one, ZP * _0_one, F43 * _0_one);
return half4(float4((((((((EQ ? _1_a == _2_b : _1_a != _2_b) && !test_same_vectors_0(NE, F42, ZM, ZP, F43)) && test_same_vectors_0(NE, F42, NAN1, NAN2, F43)) && !test_same_vectors_0(EQ, F42, NAN1, NAN2, F43)) && test_diff_vectors_0(NE, F42, F43, F44, F45)) && !test_diff_vectors_0(EQ, F42, F43, F44, F45)) && test_diff_vectors_0(NE, NAN1, ZM, ZP, F42)) && !test_diff_vectors_0(EQ, NAN1, ZM, ZP, F42) ? colorGreen : colorRed));
}