x goes like 7 .. 22 .. 11 .. then we break out (as idx >= 3) and in the end 11 % 5 * 0.25 is 0.75 .. LGTM

Reviewed-by: Tapani Pälli <[email protected]>

On 09/28/2016 11:01 PM, Nicolai Hähnle wrote:
From: Nicolai Hähnle <[email protected]>

This is a regression test for a very specific compiler bug in radeonsi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97887
---
 .../execution/fs-loop-cont-else-bug.shader_test    | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 
tests/spec/glsl-1.30/execution/fs-loop-cont-else-bug.shader_test

diff --git a/tests/spec/glsl-1.30/execution/fs-loop-cont-else-bug.shader_test 
b/tests/spec/glsl-1.30/execution/fs-loop-cont-else-bug.shader_test
new file mode 100644
index 0000000..f66c95e
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-loop-cont-else-bug.shader_test
@@ -0,0 +1,44 @@
+# This test used to create bad LLVM IR in radeonsi.
+#
+# Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97887
+
+[require]
+GLSL >= 1.30
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 130
+
+uniform int initial;
+
+void main() {
+       int idx = 0;
+       int x = initial;
+
+       for (;;) {
+               idx++;
+               if (idx >= 3)
+                       break;
+
+               if (x % 2 == 0) {
+                       x = x / 2;
+                       if (x == 18)
+                               break;
+                       continue;
+               } else {
+                       x = x * 3;
+               }
+               x++;
+       }
+
+       gl_FragColor = vec4(0.0, (x % 4) * 0.25, 0.0, 1.0);
+}
+
+[test]
+clear color 1.0 0.0 0.0 1.0
+clear
+
+uniform int initial 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to