[Piglit] [PATCH 02/11] mesa_shader_integer_functions: Clone arb_gpu_shader5 built-in-functions tests
Ian Romanick
idr at freedesktop.org
Wed Jun 29 21:23:02 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
cd tests/spec/mesa_shader_integer_functions/execution
cp -a ../../arb_gpu_shader5/execution/built-in-functions .
cd built-in-functions
rm *fma*.shader_test
for i in *; do
sed --in-place -e 's/1[.]50/1.30/g;s/150/130/g' \
-e 's/ARB_gpu_shader5/MESA_shader_integer_functions/g' $i
done
The ldexp tests were then hand-edited to add dependencies on
GL_ARB_shader_bit_encoding.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../built-in-functions/const-bitCount.shader_test | 37 ++++++
.../const-bitfieldExtract.shader_test | 36 ++++++
.../const-bitfieldInsert.shader_test | 34 ++++++
.../const-bitfieldReverse.shader_test | 34 ++++++
.../built-in-functions/const-findLSB.shader_test | 37 ++++++
.../built-in-functions/const-findMSB.shader_test | 38 +++++++
.../built-in-functions/const-ldexp.shader_test | 39 +++++++
.../built-in-functions/fs-bitCount.shader_test | 58 ++++++++++
.../fs-bitfieldExtract.shader_test | 113 +++++++++++++++++++
.../fs-bitfieldInsert.shader_test | 115 +++++++++++++++++++
.../fs-bitfieldReverse.shader_test | 57 ++++++++++
.../built-in-functions/fs-findLSB.shader_test | 59 ++++++++++
.../built-in-functions/fs-findMSB.shader_test | 78 +++++++++++++
.../built-in-functions/fs-frexp.shader_test | 52 +++++++++
.../fs-imulExtended-nonuniform.shader_test | 45 ++++++++
...fs-imulExtended-only-lsb-nonuniform.shader_test | 41 +++++++
.../fs-imulExtended-only-lsb.shader_test | 37 ++++++
...fs-imulExtended-only-msb-nonuniform.shader_test | 41 +++++++
.../fs-imulExtended-only-msb.shader_test | 37 ++++++
.../built-in-functions/fs-imulExtended.shader_test | 41 +++++++
.../built-in-functions/fs-ldexp.shader_test | 75 +++++++++++++
.../fs-uaddCarry-only-add.shader_test | 52 +++++++++
.../fs-uaddCarry-only-carry.shader_test | 52 +++++++++
.../built-in-functions/fs-uaddCarry.shader_test | 55 +++++++++
.../fs-umulExtended-nonuniform.shader_test | 45 ++++++++
...fs-umulExtended-only-lsb-nonuniform.shader_test | 41 +++++++
.../fs-umulExtended-only-lsb.shader_test | 37 ++++++
...fs-umulExtended-only-msb-nonuniform.shader_test | 41 +++++++
.../fs-umulExtended-only-msb.shader_test | 37 ++++++
.../built-in-functions/fs-umulExtended.shader_test | 41 +++++++
.../fs-usubBorrow-only-borrow.shader_test | 46 ++++++++
.../fs-usubBorrow-only-sub.shader_test | 46 ++++++++
.../built-in-functions/fs-usubBorrow.shader_test | 48 ++++++++
.../built-in-functions/vs-bitCount.shader_test | 67 +++++++++++
.../vs-bitfieldExtract.shader_test | 122 ++++++++++++++++++++
.../vs-bitfieldInsert.shader_test | 124 +++++++++++++++++++++
.../vs-bitfieldReverse.shader_test | 66 +++++++++++
.../built-in-functions/vs-findLSB.shader_test | 68 +++++++++++
.../built-in-functions/vs-findMSB.shader_test | 88 +++++++++++++++
.../built-in-functions/vs-frexp.shader_test | 61 ++++++++++
.../vs-imulExtended-nonuniform.shader_test | 55 +++++++++
...vs-imulExtended-only-lsb-nonuniform.shader_test | 51 +++++++++
.../vs-imulExtended-only-lsb.shader_test | 48 ++++++++
...vs-imulExtended-only-msb-nonuniform.shader_test | 51 +++++++++
.../vs-imulExtended-only-msb.shader_test | 48 ++++++++
.../built-in-functions/vs-imulExtended.shader_test | 52 +++++++++
.../built-in-functions/vs-ldexp.shader_test | 85 ++++++++++++++
.../vs-uaddCarry-only-add.shader_test | 62 +++++++++++
.../vs-uaddCarry-only-carry.shader_test | 62 +++++++++++
.../built-in-functions/vs-uaddCarry.shader_test | 65 +++++++++++
.../vs-umulExtended-nonuniform.shader_test | 55 +++++++++
...vs-umulExtended-only-lsb-nonuniform.shader_test | 51 +++++++++
.../vs-umulExtended-only-lsb.shader_test | 47 ++++++++
...vs-umulExtended-only-msb-nonuniform.shader_test | 51 +++++++++
.../vs-umulExtended-only-msb.shader_test | 47 ++++++++
.../built-in-functions/vs-umulExtended.shader_test | 51 +++++++++
.../vs-usubBorrow-only-borrow.shader_test | 56 ++++++++++
.../vs-usubBorrow-only-sub.shader_test | 56 ++++++++++
.../built-in-functions/vs-usubBorrow.shader_test | 58 ++++++++++
59 files changed, 3292 insertions(+)
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitCount.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldExtract.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldInsert.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldReverse.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findLSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-ldexp.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitCount.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldExtract.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldInsert.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldReverse.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findLSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-frexp.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-add.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-carry.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-borrow.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-sub.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitCount.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldExtract.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldInsert.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldReverse.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findLSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-frexp.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-add.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-carry.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb-nonuniform.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-borrow.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-sub.shader_test
create mode 100644 tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow.shader_test
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitCount.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitCount.shader_test
new file mode 100644
index 0000000..33268bf
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitCount.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(0) != bitCount(ivec4(0)));
+ STATIC_ASSERT(ivec4(0) != bitCount(uvec4(0u)));
+
+ STATIC_ASSERT(ivec4(1) != bitCount(ivec4(1, 2, 4, 8)));
+ STATIC_ASSERT(ivec4(1) != bitCount(uvec4(1u, 2u, 4u, 8u)));
+
+ STATIC_ASSERT(ivec4(1, 2, 3, 4) != bitCount(ivec4(1, 3, 7, 15)));
+ STATIC_ASSERT(ivec4(1, 2, 3, 4) != bitCount(uvec4(1u, 3u, 7u, 15u)));
+
+ STATIC_ASSERT(ivec4(6, 6, 3, 5) != bitCount(ivec4(783, 111, 385, 484)));
+ STATIC_ASSERT(ivec4(6, 6, 3, 5) != bitCount(uvec4(783u, 111u, 385u, 484u)));
+
+ STATIC_ASSERT(ivec4(32, 31, 31, 30) != bitCount(ivec4(-1, -2, -3, -4)));
+ STATIC_ASSERT(ivec4(32, 31, 31, 30) != bitCount(uvec4(0xFFFFFFFFu, 0xFFFFFFFEu, 0xFFFFFFFDu, 0xFFFFFFFCu)));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldExtract.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldExtract.shader_test
new file mode 100644
index 0000000..36ff8e6
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldExtract.shader_test
@@ -0,0 +1,36 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(0) != bitfieldExtract(ivec4(2147483647, 15, 7, 3), 0, 0));
+
+ STATIC_ASSERT(uvec4(0u) != bitfieldExtract(uvec4(0xFFFFFFFFu, 15u, 7u, 3u), 0, 0));
+
+ STATIC_ASSERT(ivec4(-1) != bitfieldExtract(ivec4(1), 0, 1));
+
+ STATIC_ASSERT(uvec4(1u) != bitfieldExtract(uvec4(1u), 0, 1));
+
+ STATIC_ASSERT(ivec4(1, -1, -1, 1) != bitfieldExtract(ivec4(1, 3, 3, 1), 0, 2));
+
+ STATIC_ASSERT(ivec4(-1, 0, 1, 3) != bitfieldExtract(ivec4(983040, 61440, 114688, 229376), 16, 4));
+
+ STATIC_ASSERT(uvec4(0xFu, 0x0u, 0x1u, 0x3u) != bitfieldExtract(uvec4(0x000F0000u, 0x0000F000u, 0x0001C000u, 0x00038000u), 16, 4));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldInsert.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldInsert.shader_test
new file mode 100644
index 0000000..9e0b446
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldInsert.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(42, 56, 72, 97) != bitfieldInsert(ivec4(42, 56, 72, 97), ivec4(2147483647, 15, 7, 3), 0, 0));
+
+ STATIC_ASSERT(uvec4(42u, 56u, 72u, 97u) != bitfieldInsert(uvec4(42u, 56u, 72u, 97u), uvec4(0xFFFFFFFFu, 15u, 7u, 3u), 0, 0));
+
+ STATIC_ASSERT(ivec4(589839, 262159, 65551, 15) != bitfieldInsert(ivec4(983055), ivec4(9, 4, 1, 0), 16, 4));
+
+ STATIC_ASSERT(uvec4(0x0009000Fu, 0x0004000Fu, 0x0001000Fu, 0x0000000Fu) != bitfieldInsert(uvec4(0x000F000Fu), uvec4(0x9u, 0x4u, 0x1u, 0x0u), 16, 4));
+
+ STATIC_ASSERT(ivec4(917519, 589839, 262159, 65551) != bitfieldInsert(ivec4(15), ivec4(14, 9, 4, 1), 16, 4));
+
+ STATIC_ASSERT(uvec4(0x000E000Fu, 0x0009000Fu, 0x0004000Fu, 0x0001000Fu) != bitfieldInsert(uvec4(0xFu), uvec4(0xEu, 0x9u, 0x4u, 0x1u), 16, 4));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldReverse.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldReverse.shader_test
new file mode 100644
index 0000000..f3130eb
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-bitfieldReverse.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(0, -1, -1, 0) != bitfieldReverse(ivec4(0, -1, -1, 0)));
+ STATIC_ASSERT(uvec4(0u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0u) != bitfieldReverse(uvec4(0u, 0xFFFFFFFFu, 0xFFFFFFFFu, 0u)));
+
+ STATIC_ASSERT(ivec4(-2147483648, 1073741824, 536870912, 268435456) != bitfieldReverse(ivec4(1, 2, 4, 8)));
+ STATIC_ASSERT(uvec4(0x80000000u, 0x40000000u, 0x20000000u, 0x10000000u) != bitfieldReverse(uvec4(1u, 2u, 4u, 8u)));
+
+ STATIC_ASSERT(ivec4(1, 2, 4, 8) != bitfieldReverse(ivec4(-2147483648, 1073741824, 536870912, 268435456)));
+ STATIC_ASSERT(uvec4(1u, 2u, 4u, 8u) != bitfieldReverse(uvec4(0x80000000u, 0x40000000u, 0x20000000u, 0x10000000u)));
+
+ STATIC_ASSERT(ivec4(783, 15, 65536, 384) != bitfieldReverse(ivec4(-255852544, -268435456, 32768, 25165824)));
+ STATIC_ASSERT(uvec4(0xF0C00000u, 0xF0000000u, 0x00008000u, 0x00000180u) != bitfieldReverse(uvec4(783u, 15u, 0x00010000u, 0x01800000u)));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findLSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findLSB.shader_test
new file mode 100644
index 0000000..9e2dafd
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findLSB.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(-1) != findLSB(ivec4(0)));
+ STATIC_ASSERT(ivec4(-1) != findLSB(uvec4(0u)));
+
+ STATIC_ASSERT(ivec4(0, 1, 0, 2) != findLSB(ivec4(1, 2, 3, 4)));
+ STATIC_ASSERT(ivec4(0, 1, 0, 2) != findLSB(uvec4(1u, 2u, 3u, 4u)));
+
+ STATIC_ASSERT(ivec4(10, 9, 8, 7) != findLSB(ivec4(1024, 512, 256, 128)));
+ STATIC_ASSERT(ivec4(10, 9, 8, 7) != findLSB(uvec4(1024u, 512u, 256u, 128u)));
+
+ STATIC_ASSERT(ivec4(0, 1, 0, 2) != findLSB(ivec4(-1, -2, -3, -4)));
+ STATIC_ASSERT(ivec4(0, 1, 0, 2) != findLSB(uvec4(0xFFFFFFFFu, 0xFFFFFFFEu, 0xFFFFFFFDu, 0xFFFFFFFCu)));
+
+ STATIC_ASSERT(ivec4(31, 30, 29, 28) != findLSB(ivec4(-2147483648, 1073741824, 536870912, 268435456)));
+ STATIC_ASSERT(ivec4(31, 30, 29, 28) != findLSB(uvec4(0x80000000u, 0x40000000u, 0x20000000u, 0x10000000u)));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
new file mode 100644
index 0000000..b792dd8
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
@@ -0,0 +1,38 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ STATIC_ASSERT(ivec4(-1) != findMSB(ivec4(0, -1, -1, 0)));
+
+ STATIC_ASSERT(ivec4(-1) != findMSB(uvec4(0u)));
+
+ STATIC_ASSERT(ivec4(0, 1, 1, 2) != findMSB(ivec4(1, 2, 3, 4)));
+
+ STATIC_ASSERT(ivec4(30, 29, 28, 27) != findMSB(ivec4(2147483647, 1073741823, 536870911, 268435455)));
+
+ STATIC_ASSERT(ivec4(0, 1, 2, 3) != findMSB(ivec4(-2, -3, -5, -9)));
+
+ STATIC_ASSERT(ivec4(30, 30, 29, 28) != findMSB(ivec4(-2147483648, -1879048192, -1073741824, -536870912)));
+
+ STATIC_ASSERT(ivec4(0, 1, 1, 2) != findMSB(uvec4(1u, 2u, 3u, 4u)));
+
+ STATIC_ASSERT(ivec4(31, 30, 29, 28) != findMSB(uvec4(0xFFFFFFFFu, 0x7FFFFFFFu, 0x3FFFFFFFu, 0x1FFFFFFFu)));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-ldexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-ldexp.shader_test
new file mode 100644
index 0000000..c0758dd
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-ldexp.shader_test
@@ -0,0 +1,39 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+GL_ARB_shader_bit_encoding
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+#extension GL_ARB_shader_bit_encoding : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+out vec4 color;
+
+void main()
+{
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Compare the results after going through floatBitsToInt() allows us
+ * to distinguish -0.0f from 0.0f.
+ */
+ STATIC_ASSERT(floatBitsToInt(vec4(0.0, -0.0, 0.5, -0.5)) !=
+ floatBitsToInt(ldexp(vec4(0.0, -0.0, 0.5, -0.5), ivec4(0))));
+ STATIC_ASSERT(floatBitsToInt(vec4(0.49, 1.0, 25.0, 100.0)) !=
+ floatBitsToInt(ldexp(vec4(0.98, 0.5, 0.78125, 0.78125), ivec4(-1, 1, 5, 7))));
+ STATIC_ASSERT(floatBitsToInt(vec4(1.1754944e-38, -1.1754944e-38, 3.40282347e38, -3.40282347e38)) !=
+ floatBitsToInt(ldexp(vec4(0.5, -0.5, 0.999999940, -0.999999940), ivec4(-125, -125, 128, 128))));
+ STATIC_ASSERT(floatBitsToInt(vec4(0.5, -0.5, 0.999999940, -0.999999940)) !=
+ floatBitsToInt(ldexp(vec4(1.1754944e-38, -1.1754944e-38, 3.40282347e38, -3.40282347e38), ivec4(125, 125, -128, -128))));
+ STATIC_ASSERT(floatBitsToInt(vec4(0.0, -0.0, 0.0, -0.0)) !=
+ floatBitsToInt(ldexp(vec4(0.0, -0.0, 0.5, -0.5), ivec4(-127))));
+ STATIC_ASSERT(floatBitsToInt(vec4(0.0, -0.0, 0.0, -0.0)) !=
+ floatBitsToInt(ldexp(vec4(1.1754944e-38, -1.1754944e-38, 3.40282347e38, -3.40282347e38), ivec4(-1, -1, -255, -255))));
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitCount.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitCount.shader_test
new file mode 100644
index 0000000..2bbfa65
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitCount.shader_test
@@ -0,0 +1,58 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform ivec4 bits;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (bits != bitCount(iinput))
+ /* Red if bitCount(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (bits != bitCount(uinput))
+ /* Blue if bitCount(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+uniform ivec4 bits 0 0 0 0
+uniform ivec4 iinput 0 0 0 0
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 1 1 1 1
+uniform ivec4 iinput 1 2 4 8
+uniform uvec4 uinput 1 2 4 8
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 1 2 3 4
+uniform ivec4 iinput 1 3 7 15
+uniform uvec4 uinput 1 3 7 15
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 6 6 3 5
+uniform ivec4 iinput 783 111 385 484
+uniform uvec4 uinput 783 111 385 484
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 32 31 31 30
+uniform ivec4 iinput -1 -2 -3 -4
+uniform uvec4 uinput 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD 0xFFFFFFFC
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldExtract.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldExtract.shader_test
new file mode 100644
index 0000000..7953586
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldExtract.shader_test
@@ -0,0 +1,113 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform bool test_signed;
+
+uniform ivec4 iextract;
+uniform ivec4 iinput;
+uniform uvec4 uextract;
+uniform uvec4 uinput;
+
+uniform int offset, bits;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && iextract != bitfieldExtract(iinput, offset, bits))
+ /* Red if bitfieldExtract(ivec4, ...) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && uextract != bitfieldExtract(uinput, offset, bits))
+ /* Blue if bitfieldExtract(uvec4, ...) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+# Corner case: bits == 0 -> result == 0
+uniform int bits 0
+uniform int offset 32
+
+uniform int test_signed 1
+uniform ivec4 iextract 0 0 0 0
+uniform ivec4 iinput 2147483647 15 7 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0 0 0 0
+uniform uvec4 uinput 0xFFFFFFFF 15 7 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test that the most significant bits of the result get the sign extension of
+# the bits extracted from <value>.
+uniform int bits 1
+uniform int offset 0
+
+# Extract a single signed "1"-bit and sign-extend it, yielding 0xFFFFFFFF (-1).
+uniform int test_signed 1
+uniform ivec4 iextract -1 -1 -1 -1
+uniform ivec4 iinput 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Extract a single unsigned "1"-bit and sign-extend it, yielding 0x00000001 (1).
+uniform int test_signed 0
+uniform uvec4 uextract 1 1 1 1
+uniform uvec4 uinput 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Extract two signed bits (01) and sign-extend it, yielding 0x00000001 (1).
+# Extract two signed bits (11) and sign-extend it, yielding 0xFFFFFFFF (1).
+uniform int bits 2
+uniform int test_signed 1
+uniform ivec4 iextract 1 -1 -1 1
+uniform ivec4 iinput 1 3 3 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test some other various values.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iextract -1 0 1 3
+# 983040 is 0x000F0000.
+# 61440 is 0x0000F000.
+# 114688 is 0x0001C000.
+# 229376 is 0x00038000.
+uniform ivec4 iinput 983040 61440 114688 229376
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0xF 0x0 0x1 0x3
+uniform uvec4 uinput 0x000F0000 0x0000F000 0x0001C000 0x00038000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Copy the whole integer
+uniform int bits 32
+uniform int offset 0
+
+uniform int test_signed 1
+uniform ivec4 iextract 3203386110 3735928559 2343432205 3741239934
+uniform ivec4 iinput 3203386110 3735928559 2343432205 3741239934
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+uniform uvec4 uinput 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldInsert.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldInsert.shader_test
new file mode 100644
index 0000000..1b4623f
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldInsert.shader_test
@@ -0,0 +1,115 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform bool test_signed;
+
+uniform ivec4 iinsert;
+uniform ivec4 ibase;
+uniform ivec4 iresult;
+uniform uvec4 uinsert;
+uniform uvec4 ubase;
+uniform uvec4 uresult;
+
+uniform int offset, bits;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && iresult != bitfieldInsert(ibase, iinsert, offset, bits))
+ /* Red if bitfieldInsert(ivec4, ...) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && uresult != bitfieldInsert(ubase, uinsert, offset, bits))
+ /* Blue if bitfieldInsert(uvec4, ...) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+# Corner case: bits == 0 -> result == base
+uniform int bits 0
+uniform int offset 32
+
+uniform int test_signed 1
+uniform ivec4 iinsert 2147483647 15 7 3
+uniform ivec4 ibase 42 56 72 97
+uniform ivec4 iresult 42 56 72 97
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xFFFFFFFF 15 7 3
+uniform uvec4 ubase 42 56 72 97
+uniform uvec4 uresult 42 56 72 97
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+## Test overwriting set bits in <base>.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iinsert 9 4 1 0
+# 983055 is 0x000F000F
+uniform ivec4 ibase 983055 983055 983055 983055
+# 589839 is 0x0009000F.
+# 262159 is 0x0004000F.
+# 65551 is 0x0001000F.
+uniform ivec4 iresult 589839 262159 65551 15
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0x9 0x4 0x1 0x0
+uniform uvec4 ubase 0x000F000F 0x000F000F 0x000F000F 0x000F000F
+uniform uvec4 uresult 0x0009000F 0x0004000F 0x0001000F 0x0000000F
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+## Test various cases.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iinsert 14 9 4 1
+uniform ivec4 ibase 15 15 15 15
+# 917519 is 0x000E000F.
+# 589839 is 0x0009000F.
+# 262159 is 0x0004000F.
+# 65551 is 0x0001000F.
+uniform ivec4 iresult 917519 589839 262159 65551
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xE 0x9 0x4 0x1
+uniform uvec4 ubase 0xF 0xF 0xF 0xF
+uniform uvec4 uresult 0x000E000F 0x0009000F 0x0004000F 0x0001000F
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Copy the whole integer
+uniform int bits 32
+uniform int offset 0
+
+uniform int test_signed 1
+uniform ivec4 iinsert 3203386110 3735928559 2343432205 3741239934
+uniform ivec4 ibase 0 0 0 0
+uniform ivec4 iresult 3203386110 3735928559 2343432205 3741239934
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+uniform uvec4 ubase 0 0 0 0
+uniform uvec4 uresult 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldReverse.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldReverse.shader_test
new file mode 100644
index 0000000..80775a9
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-bitfieldReverse.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform ivec4 ireverse;
+uniform ivec4 iinput;
+uniform uvec4 ureverse;
+uniform uvec4 uinput;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (ireverse != bitfieldReverse(iinput))
+ /* Red if bitfieldReverse(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (ureverse != bitfieldReverse(uinput))
+ /* Blue if bitfieldReverse(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+uniform ivec4 iinput 0 -1 -1 0
+uniform ivec4 ireverse 0 -1 -1 0
+uniform uvec4 uinput 0 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 ureverse 0 0xFFFFFFFF 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput 1 2 4 8
+uniform ivec4 ireverse -2147483648 1073741824 536870912 268435456
+uniform uvec4 uinput 1 2 4 8
+uniform uvec4 ureverse 0x80000000 0x40000000 0x20000000 0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput -2147483648 1073741824 536870912 268435456
+uniform ivec4 ireverse 1 2 4 8
+uniform uvec4 uinput 0x80000000 0x40000000 0x20000000 0x10000000
+uniform uvec4 ureverse 1 2 4 8
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput -255852544 -268435456 32768 25165824
+uniform ivec4 ireverse 783 15 65536 384
+uniform uvec4 uinput 783 15 0x00010000 0x01800000
+uniform uvec4 ureverse 0xF0C00000 0xF0000000 0x00008000 0x00000180
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findLSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findLSB.shader_test
new file mode 100644
index 0000000..fd84c00
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findLSB.shader_test
@@ -0,0 +1,59 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform ivec4 lsb;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (lsb != findLSB(iinput))
+ /* Red if findLSB(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (lsb != findLSB(uinput))
+ /* Blue if findLSB(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+# If value is zero, -1 will be returned.
+uniform ivec4 lsb -1 -1 -1 -1
+uniform ivec4 iinput 0 0 0 0
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 0 1 0 2
+uniform ivec4 iinput 1 2 3 4
+uniform uvec4 uinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 10 9 8 7
+uniform ivec4 iinput 1024 512 256 128
+uniform uvec4 uinput 1024 512 256 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 0 1 0 2
+uniform ivec4 iinput -1 -2 -3 -4
+uniform uvec4 uinput 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD 0xFFFFFFFC
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 31 30 29 28
+uniform ivec4 iinput -2147483648 1073741824 536870912 268435456
+uniform uvec4 uinput 0x80000000 0x40000000 0x20000000 0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
new file mode 100644
index 0000000..6a9c7d2
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
@@ -0,0 +1,78 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform bool test_signed;
+uniform ivec4 msb;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && msb != findMSB(iinput))
+ /* Red if findMSB(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && msb != findMSB(uinput))
+ /* Blue if findMSB(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[test]
+# For a value of zero or negative one, -1 will be returned.
+uniform int test_signed 1
+uniform ivec4 msb -1 -1 -1 -1
+uniform ivec4 iinput 0 -1 -1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform ivec4 msb -1 -1 -1 -1
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Signed inputs
+uniform int test_signed 1
+
+uniform ivec4 msb 0 1 1 2
+uniform ivec4 iinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 2147483647 1073741823 536870911 268435455
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Most significant bit in negative signed integers is actually a zero.
+uniform ivec4 msb 0 1 2 3
+uniform ivec4 iinput -2 -3 -5 -9
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 30 30 29 28
+uniform ivec4 iinput -2147483648 -1879048192 -1073741824 -536870912
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Unsigned inputs
+uniform int test_signed 0
+
+uniform ivec4 msb 0 1 1 2
+uniform uvec4 uinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 31 30 29 28
+uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-frexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-frexp.shader_test
new file mode 100644
index 0000000..fd28041
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-frexp.shader_test
@@ -0,0 +1,52 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 color;
+
+uniform vec4 given_float;
+uniform vec4 expected_mantissa;
+uniform ivec4 expected_exponent;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 exponent;
+ vec4 mantissa;
+
+ mantissa = frexp(given_float, exponent);
+
+ if (mantissa != expected_mantissa) {
+ color.r = 1.0;
+ }
+
+ if (exponent != expected_exponent) {
+ color.b = 1.0;
+ }
+}
+
+[test]
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform vec4 expected_mantissa 0.0 -0.0 0.5 -0.5
+uniform ivec4 expected_exponent 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform vec4 given_float 0.49 1.0 25.0 100
+uniform vec4 expected_mantissa 0.98 0.5 0.78125 0.78125
+uniform ivec4 expected_exponent -1 1 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform vec4 expected_mantissa 0.5 -0.5 0.999999940 -0.999999940
+uniform ivec4 expected_exponent -125 -125 128 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-nonuniform.shader_test
new file mode 100644
index 0000000..38c97a9
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-nonuniform.shader_test
@@ -0,0 +1,45 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_msb, expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb-nonuniform.shader_test
new file mode 100644
index 0000000..ebf7343
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb-nonuniform.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb.shader_test
new file mode 100644
index 0000000..4273ab3
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-lsb.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb-nonuniform.shader_test
new file mode 100644
index 0000000..da536bb
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb-nonuniform.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_msb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb.shader_test
new file mode 100644
index 0000000..52829dd
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended-only-msb.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_msb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended.shader_test
new file mode 100644
index 0000000..4797fdc
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-imulExtended.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_msb, expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
new file mode 100644
index 0000000..3e6e692
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
@@ -0,0 +1,75 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+GL_ARB_shader_bit_encoding
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+#extension GL_ARB_shader_bit_encoding : enable
+
+out vec4 color;
+
+uniform vec4 expected_float;
+uniform vec4 given_float;
+uniform ivec4 given_exponent;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Compare the results after going through floatBitsToInt() allows us
+ * to distinguish -0.0f from 0.0f.
+ */
+ if (floatBitsToInt(expected_float) !=
+ floatBitsToInt(ldexp(given_float, given_exponent))) {
+ color.r = 1.0;
+ }
+}
+
+[test]
+# Basic tests with exponent = 0.
+uniform vec4 expected_float 0.0 -0.0 0.5 -0.5
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform ivec4 given_exponent 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Basic tests with x = 0.
+uniform vec4 expected_float 0.0 0.0 0.0 0.0
+uniform vec4 given_float 0.0 0.0 0.0 0.0
+uniform ivec4 given_exponent 1 100 -1 -100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Basic tests.
+uniform vec4 expected_float 0.49 1.0 25.0 100
+uniform vec4 given_float 0.98 0.5 0.78125 0.78125
+uniform ivec4 given_exponent -1 1 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test generating FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38).
+uniform vec4 expected_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform vec4 given_float 0.5 -0.5 0.999999940 -0.999999940
+uniform ivec4 given_exponent -125 -125 128 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38) as inputs.
+uniform vec4 expected_float 0.5 -0.5 0.999999940 -0.999999940
+uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform ivec4 given_exponent 125 125 -128 -128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test underflow generates zero with sign of x.
+uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform ivec4 given_exponent -127 -127 -127 -127
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-add.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-add.shader_test
new file mode 100644
index 0000000..9e96ed4
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-add.shader_test
@@ -0,0 +1,52 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_sum;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the addition if the carry result isn't used.
+ */
+ uvec4 carry;
+ uvec4 sum = uaddCarry(x, y, carry);
+
+ if (sum != expected_sum)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_sum 1 3 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 0xFFFFFFFF 0 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 1 2 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_sum 0 1 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-carry.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-carry.shader_test
new file mode 100644
index 0000000..9383e83
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry-only-carry.shader_test
@@ -0,0 +1,52 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_carry;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the carry if the addition result isn't used.
+ */
+ uvec4 carry;
+ uaddCarry(x, y, carry);
+
+ if (carry != expected_carry)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_carry 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_carry 0 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_carry 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_carry 1 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry.shader_test
new file mode 100644
index 0000000..8e63294
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-uaddCarry.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_sum, expected_carry;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 carry;
+ uvec4 sum = uaddCarry(x, y, carry);
+
+ if (sum != expected_sum)
+ frag_color.r = 1.0;
+ if (carry != expected_carry)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_sum 1 3 5 7
+uniform uvec4 expected_carry 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 0xFFFFFFFF 0 0xFFFFFFFF 0
+uniform uvec4 expected_carry 0 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 1 2 0 1
+uniform uvec4 expected_carry 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_sum 0 1 0xFFFFFFFF 0
+uniform uvec4 expected_carry 1 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-nonuniform.shader_test
new file mode 100644
index 0000000..dbfd808
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-nonuniform.shader_test
@@ -0,0 +1,45 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_msb, expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb-nonuniform.shader_test
new file mode 100644
index 0000000..638047f
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb-nonuniform.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb.shader_test
new file mode 100644
index 0000000..fe17799
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-lsb.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb-nonuniform.shader_test
new file mode 100644
index 0000000..344a220
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb-nonuniform.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_msb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb.shader_test
new file mode 100644
index 0000000..722290e
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended-only-msb.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_msb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended.shader_test
new file mode 100644
index 0000000..f7731c2
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-umulExtended.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_msb, expected_lsb;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ frag_color.r = 1.0;
+ if (lsb != expected_lsb)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-borrow.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-borrow.shader_test
new file mode 100644
index 0000000..baba9c9
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-borrow.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_borrow;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the borrow if the subtraction result isn't used.
+ */
+ uvec4 borrow;
+ usubBorrow(x, y, borrow);
+
+ if (borrow != expected_borrow)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_borrow 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_borrow 0 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_borrow 1 0 1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-sub.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-sub.shader_test
new file mode 100644
index 0000000..f811710
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow-only-sub.shader_test
@@ -0,0 +1,46 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_diff;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the subtraction if the borrow result isn't used.
+ */
+ uvec4 borrow;
+ uvec4 diff = usubBorrow(x, y, borrow);
+
+ if (diff != expected_diff)
+ frag_color.r = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_diff 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_diff 0 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_diff 0xFFFFFFFF 0 0x80000001 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow.shader_test
new file mode 100644
index 0000000..087b972
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-usubBorrow.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+out vec4 frag_color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_diff, expected_borrow;
+
+void main()
+{
+ frag_color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 borrow;
+ uvec4 diff = usubBorrow(x, y, borrow);
+
+ if (diff != expected_diff)
+ frag_color.r = 1.0;
+ if (borrow != expected_borrow)
+ frag_color.b = 1.0;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_diff 1 1 1 1
+uniform uvec4 expected_borrow 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_diff 0 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD
+uniform uvec4 expected_borrow 0 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_diff 0xFFFFFFFF 0 0x80000001 0
+uniform uvec4 expected_borrow 1 0 1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitCount.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitCount.shader_test
new file mode 100644
index 0000000..1d82ce4
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitCount.shader_test
@@ -0,0 +1,67 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 bits;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (bits != bitCount(iinput))
+ /* Red if bitCount(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (bits != bitCount(uinput))
+ /* Blue if bitCount(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform ivec4 bits 0 0 0 0
+uniform ivec4 iinput 0 0 0 0
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 1 1 1 1
+uniform ivec4 iinput 1 2 4 8
+uniform uvec4 uinput 1 2 4 8
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 1 2 3 4
+uniform ivec4 iinput 1 3 7 15
+uniform uvec4 uinput 1 3 7 15
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 6 6 3 5
+uniform ivec4 iinput 783 111 385 484
+uniform uvec4 uinput 783 111 385 484
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 bits 32 31 31 30
+uniform ivec4 iinput -1 -2 -3 -4
+uniform uvec4 uinput 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD 0xFFFFFFFC
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldExtract.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldExtract.shader_test
new file mode 100644
index 0000000..dbffc89
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldExtract.shader_test
@@ -0,0 +1,122 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform bool test_signed;
+
+uniform ivec4 iextract;
+uniform ivec4 iinput;
+uniform uvec4 uextract;
+uniform uvec4 uinput;
+
+uniform int offset, bits;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && iextract != bitfieldExtract(iinput, offset, bits))
+ /* Red if bitfieldExtract(ivec4, ...) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && uextract != bitfieldExtract(uinput, offset, bits))
+ /* Blue if bitfieldExtract(uvec4, ...) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+# Corner case: bits == 0 -> result == 0
+uniform int bits 0
+uniform int offset 32
+
+uniform int test_signed 1
+uniform ivec4 iextract 0 0 0 0
+uniform ivec4 iinput 2147483647 15 7 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0 0 0 0
+uniform uvec4 uinput 0xFFFFFFFF 15 7 3
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test that the most significant bits of the result get the sign extension of
+# the bits extracted from <value>.
+uniform int bits 1
+uniform int offset 0
+
+# Extract a single signed "1"-bit and sign-extend it, yielding 0xFFFFFFFF (-1).
+uniform int test_signed 1
+uniform ivec4 iextract -1 -1 -1 -1
+uniform ivec4 iinput 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Extract a single unsigned "1"-bit and sign-extend it, yielding 0x00000001 (1).
+uniform int test_signed 0
+uniform uvec4 uextract 1 1 1 1
+uniform uvec4 uinput 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Extract two signed bits (01) and sign-extend it, yielding 0x00000001 (1).
+# Extract two signed bits (11) and sign-extend it, yielding 0xFFFFFFFF (1).
+uniform int bits 2
+uniform int test_signed 1
+uniform ivec4 iextract 1 -1 -1 1
+uniform ivec4 iinput 1 3 3 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test some other various values.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iextract -1 0 1 3
+# 983040 is 0x000F0000.
+# 61440 is 0x0000F000.
+# 114688 is 0x0001C000.
+# 229376 is 0x00038000.
+uniform ivec4 iinput 983040 61440 114688 229376
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0xF 0x0 0x1 0x3
+uniform uvec4 uinput 0x000F0000 0x0000F000 0x0001C000 0x00038000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Copy the whole integer
+uniform int bits 32
+uniform int offset 0
+
+uniform int test_signed 1
+uniform ivec4 iextract 3203386110 3735928559 2343432205 3741239934
+uniform ivec4 iinput 3203386110 3735928559 2343432205 3741239934
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uextract 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+uniform uvec4 uinput 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldInsert.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldInsert.shader_test
new file mode 100644
index 0000000..7107f98
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldInsert.shader_test
@@ -0,0 +1,124 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform bool test_signed;
+
+uniform ivec4 iinsert;
+uniform ivec4 ibase;
+uniform ivec4 iresult;
+uniform uvec4 uinsert;
+uniform uvec4 ubase;
+uniform uvec4 uresult;
+
+uniform int offset, bits;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && iresult != bitfieldInsert(ibase, iinsert, offset, bits))
+ /* Red if bitfieldInsert(ivec4, ...) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && uresult != bitfieldInsert(ubase, uinsert, offset, bits))
+ /* Blue if bitfieldInsert(uvec4, ...) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+# Corner case: bits == 0 -> result == base
+uniform int bits 0
+uniform int offset 32
+
+uniform int test_signed 1
+uniform ivec4 iinsert 2147483647 15 7 3
+uniform ivec4 ibase 42 56 72 97
+uniform ivec4 iresult 42 56 72 97
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xFFFFFFFF 15 7 3
+uniform uvec4 ubase 42 56 72 97
+uniform uvec4 uresult 42 56 72 97
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test overwriting set bits in <base>.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iinsert 9 4 1 0
+# 983055 is 0x000F000F
+uniform ivec4 ibase 983055 983055 983055 983055
+# 589839 is 0x0009000F.
+# 262159 is 0x0004000F.
+# 65551 is 0x0001000F.
+uniform ivec4 iresult 589839 262159 65551 15
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0x9 0x4 0x1 0x0
+uniform uvec4 ubase 0x000F000F 0x000F000F 0x000F000F 0x000F000F
+uniform uvec4 uresult 0x0009000F 0x0004000F 0x0001000F 0x0000000F
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+## Test various cases.
+uniform int bits 4
+uniform int offset 16
+
+uniform int test_signed 1
+uniform ivec4 iinsert 14 9 4 1
+uniform ivec4 ibase 15 15 15 15
+# 917519 is 0x000E000F.
+# 589839 is 0x0009000F.
+# 262159 is 0x0004000F.
+# 65551 is 0x0001000F.
+uniform ivec4 iresult 917519 589839 262159 65551
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xE 0x9 0x4 0x1
+uniform uvec4 ubase 0xF 0xF 0xF 0xF
+uniform uvec4 uresult 0x000E000F 0x0009000F 0x0004000F 0x0001000F
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Copy the whole integer
+uniform int bits 32
+uniform int offset 0
+
+uniform int test_signed 1
+uniform ivec4 iinsert 3203386110 3735928559 2343432205 3741239934
+uniform ivec4 ibase 0 0 0 0
+uniform ivec4 iresult 3203386110 3735928559 2343432205 3741239934
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform uvec4 uinsert 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+uniform uvec4 ubase 0 0 0 0
+uniform uvec4 uresult 0xBEEFCAFE 0xDEADBEEF 0x8BADF00D 0xDEFECA7E
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldReverse.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldReverse.shader_test
new file mode 100644
index 0000000..dd7f011
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-bitfieldReverse.shader_test
@@ -0,0 +1,66 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 ireverse;
+uniform ivec4 iinput;
+uniform uvec4 ureverse;
+uniform uvec4 uinput;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (ireverse != bitfieldReverse(iinput))
+ /* Red if bitfieldReverse(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (ureverse != bitfieldReverse(uinput))
+ /* Blue if bitfieldReverse(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform ivec4 iinput 0 -1 -1 0
+uniform ivec4 ireverse 0 -1 -1 0
+uniform uvec4 uinput 0 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 ureverse 0 0xFFFFFFFF 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput 1 2 4 8
+uniform ivec4 ireverse -2147483648 1073741824 536870912 268435456
+uniform uvec4 uinput 1 2 4 8
+uniform uvec4 ureverse 0x80000000 0x40000000 0x20000000 0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput -2147483648 1073741824 536870912 268435456
+uniform ivec4 ireverse 1 2 4 8
+uniform uvec4 uinput 0x80000000 0x40000000 0x20000000 0x10000000
+uniform uvec4 ureverse 1 2 4 8
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 iinput -255852544 -268435456 32768 25165824
+uniform ivec4 ireverse 783 15 65536 384
+uniform uvec4 uinput 783 15 0x00010000 0x01800000
+uniform uvec4 ureverse 0xF0C00000 0xF0000000 0x00008000 0x00000180
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findLSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findLSB.shader_test
new file mode 100644
index 0000000..45928f4
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findLSB.shader_test
@@ -0,0 +1,68 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 lsb;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (lsb != findLSB(iinput))
+ /* Red if findLSB(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (lsb != findLSB(uinput))
+ /* Blue if findLSB(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+# If value is zero, -1 will be returned.
+uniform ivec4 lsb -1 -1 -1 -1
+uniform ivec4 iinput 0 0 0 0
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 0 1 0 2
+uniform ivec4 iinput 1 2 3 4
+uniform uvec4 uinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 10 9 8 7
+uniform ivec4 iinput 1024 512 256 128
+uniform uvec4 uinput 1024 512 256 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 0 1 0 2
+uniform ivec4 iinput -1 -2 -3 -4
+uniform uvec4 uinput 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD 0xFFFFFFFC
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 lsb 31 30 29 28
+uniform ivec4 iinput -2147483648 1073741824 536870912 268435456
+uniform uvec4 uinput 0x80000000 0x40000000 0x20000000 0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
new file mode 100644
index 0000000..0ef77e9
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
@@ -0,0 +1,88 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform bool test_signed;
+uniform ivec4 msb;
+uniform ivec4 iinput;
+uniform uvec4 uinput;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (test_signed && msb != findMSB(iinput))
+ /* Red if findMSB(ivec4) fails. */
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (!test_signed && msb != findMSB(uinput))
+ /* Blue if findMSB(uvec4) fails. */
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+# For a value of zero or negative one, -1 will be returned.
+uniform int test_signed 1
+uniform ivec4 msb -1 -1 -1 -1
+uniform ivec4 iinput 0 -1 -1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int test_signed 0
+uniform ivec4 msb -1 -1 -1 -1
+uniform uvec4 uinput 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Signed inputs
+uniform int test_signed 1
+
+uniform ivec4 msb 0 1 1 2
+uniform ivec4 iinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 2147483647 1073741823 536870911 268435455
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Most significant bit in negative signed integers is actually a zero.
+uniform ivec4 msb 0 1 2 3
+uniform ivec4 iinput -2 -3 -5 -9
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 30 30 29 28
+uniform ivec4 iinput -2147483648 -1879048192 -1073741824 -536870912
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Unsigned inputs
+uniform int test_signed 0
+
+uniform ivec4 msb 0 1 1 2
+uniform uvec4 uinput 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 31 30 29 28
+uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-frexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-frexp.shader_test
new file mode 100644
index 0000000..e410f81
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-frexp.shader_test
@@ -0,0 +1,61 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform vec4 given_float;
+uniform vec4 expected_mantissa;
+uniform ivec4 expected_exponent;
+
+void main() {
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 exponent;
+ vec4 mantissa;
+
+ mantissa = frexp(given_float, exponent);
+
+ if (mantissa != expected_mantissa) {
+ color.r = 1.0;
+ }
+
+ if (exponent != expected_exponent) {
+ color.b = 1.0;
+ }
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform vec4 expected_mantissa 0.0 -0.0 0.5 -0.5
+uniform ivec4 expected_exponent 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform vec4 given_float 0.49 1.0 25.0 100
+uniform vec4 expected_mantissa 0.98 0.5 0.78125 0.78125
+uniform ivec4 expected_exponent -1 1 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform vec4 expected_mantissa 0.5 -0.5 0.999999940 -0.999999940
+uniform ivec4 expected_exponent -125 -125 128 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-nonuniform.shader_test
new file mode 100644
index 0000000..a531fde
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-nonuniform.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_msb, expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb-nonuniform.shader_test
new file mode 100644
index 0000000..08e08e7
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb-nonuniform.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb.shader_test
new file mode 100644
index 0000000..17c12a9
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-lsb.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_lsb;
+
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb-nonuniform.shader_test
new file mode 100644
index 0000000..4950d95
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb-nonuniform.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform int zero;
+uniform ivec4 x, y;
+uniform ivec4 expected_msb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 xx = x + zero;
+ ivec4 yy = y + zero;
+ ivec4 msb, lsb;
+ imulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform int zero 0
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb.shader_test
new file mode 100644
index 0000000..cb6434f
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended-only-msb.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_msb;
+
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended.shader_test
new file mode 100644
index 0000000..64acf02
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-imulExtended.shader_test
@@ -0,0 +1,52 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform ivec4 x, y;
+uniform ivec4 expected_msb, expected_lsb;
+
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ ivec4 msb, lsb;
+ imulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform ivec4 x 1 1 1 1
+uniform ivec4 y 1 2 3 4
+uniform ivec4 expected_msb 0 0 0 0
+uniform ivec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 x -1 2 -131072 -131073
+uniform ivec4 y 1 -2 131072 131073
+uniform ivec4 expected_msb -1 -1 -4 -5
+uniform ivec4 expected_lsb -1 -4 0 -262145
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
new file mode 100644
index 0000000..c01891c
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
@@ -0,0 +1,85 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+GL_ARB_shader_bit_encoding
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+#extension GL_ARB_shader_bit_encoding : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform vec4 expected_float;
+uniform vec4 given_float;
+uniform ivec4 given_exponent;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Compare the results after going through floatBitsToInt() allows us
+ * to distinguish -0.0f from 0.0f.
+ */
+ if (floatBitsToInt(expected_float) !=
+ floatBitsToInt(ldexp(given_float, given_exponent))) {
+ color.r = 1.0;
+ }
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+# Basic tests with exponent = 0.
+uniform vec4 expected_float 0.0 -0.0 0.5 -0.5
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform ivec4 given_exponent 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Basic tests with x = 0.
+uniform vec4 expected_float 0.0 0.0 0.0 0.0
+uniform vec4 given_float 0.0 0.0 0.0 0.0
+uniform ivec4 given_exponent 1 100 -1 -100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Basic tests.
+uniform vec4 expected_float 0.49 1.0 25.0 100
+uniform vec4 given_float 0.98 0.5 0.78125 0.78125
+uniform ivec4 given_exponent -1 1 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test generating FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38).
+uniform vec4 expected_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform vec4 given_float 0.5 -0.5 0.999999940 -0.999999940
+uniform ivec4 given_exponent -125 -125 128 128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38) as inputs.
+uniform vec4 expected_float 0.5 -0.5 0.999999940 -0.999999940
+uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
+uniform ivec4 given_exponent 125 125 -128 -128
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Test underflow generates zero with sign of x.
+uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
+uniform vec4 given_float 0.0 -0.0 0.5 -0.5
+uniform ivec4 given_exponent -127 -127 -127 -127
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-add.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-add.shader_test
new file mode 100644
index 0000000..853e1af
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-add.shader_test
@@ -0,0 +1,62 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_sum;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the carry if the addition result isn't used.
+ */
+ uvec4 carry;
+ uvec4 sum = uaddCarry(x, y, carry);
+
+ if (sum != expected_sum)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_sum 1 3 5 7
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 0xFFFFFFFF 0 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 1 2 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_sum 0 1 0xFFFFFFFF 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-carry.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-carry.shader_test
new file mode 100644
index 0000000..af6f24c
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry-only-carry.shader_test
@@ -0,0 +1,62 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_carry;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the addition if the carry result isn't used.
+ */
+ uvec4 carry;
+ uaddCarry(x, y, carry);
+
+ if (carry != expected_carry)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_carry 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_carry 0 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_carry 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_carry 1 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry.shader_test
new file mode 100644
index 0000000..1d2cc2e
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-uaddCarry.shader_test
@@ -0,0 +1,65 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_sum, expected_carry;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 carry;
+ uvec4 sum = uaddCarry(x, y, carry);
+
+ if (sum != expected_sum)
+ color.r = 1.0;
+ if (carry != expected_carry)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 0 1 2 3
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_sum 1 3 5 7
+uniform uvec4 expected_carry 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0 1 1 2
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 0xFFFFFFFF 0 0xFFFFFFFF 0
+uniform uvec4 expected_carry 0 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 2 3 2 3
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFE
+uniform uvec4 expected_sum 1 2 0 1
+uniform uvec4 expected_carry 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x80000000 0x80000000 0x80000000 0x80000001
+uniform uvec4 y 0x80000000 0x80000001 0x7FFFFFFF 0x7FFFFFFF
+uniform uvec4 expected_sum 0 1 0xFFFFFFFF 0
+uniform uvec4 expected_carry 1 1 0 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-nonuniform.shader_test
new file mode 100644
index 0000000..ac706dc
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-nonuniform.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_msb, expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb-nonuniform.shader_test
new file mode 100644
index 0000000..86bbcf5
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb-nonuniform.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb.shader_test
new file mode 100644
index 0000000..672991b
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-lsb.shader_test
@@ -0,0 +1,47 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb-nonuniform.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb-nonuniform.shader_test
new file mode 100644
index 0000000..1e95652
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb-nonuniform.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uint zero;
+uniform uvec4 x, y;
+uniform uvec4 expected_msb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 xx = x + zero;
+ uvec4 yy = y + zero;
+ uvec4 msb, lsb;
+ umulExtended(xx, yy, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uint zero 0
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb.shader_test
new file mode 100644
index 0000000..aeb47d5
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended-only-msb.shader_test
@@ -0,0 +1,47 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_msb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended.shader_test
new file mode 100644
index 0000000..c3211f6
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-umulExtended.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_msb, expected_lsb;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 msb, lsb;
+ umulExtended(x, y, msb, lsb);
+
+ if (msb != expected_msb)
+ color.r = 1.0;
+ if (lsb != expected_lsb)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 1 1 1
+uniform uvec4 y 1 2 3 4
+uniform uvec4 expected_msb 0 0 0 0
+uniform uvec4 expected_lsb 1 2 3 4
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0x10000000 0x10000000 0xFFFFFFFF 0xFFFFFFFF
+uniform uvec4 y 0x10 0x11 0x2 0xFFFFFFFF
+uniform uvec4 expected_msb 0x1 0x1 0x1 0xFFFFFFFE
+uniform uvec4 expected_lsb 0 0x10000000 0xFFFFFFFE 0x1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-borrow.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-borrow.shader_test
new file mode 100644
index 0000000..90906b5
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-borrow.shader_test
@@ -0,0 +1,56 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_borrow;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the borrow if the subtraction result isn't used.
+ */
+ uvec4 borrow;
+ usubBorrow(x, y, borrow);
+
+ if (borrow != expected_borrow)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_borrow 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_borrow 0 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_borrow 1 0 1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-sub.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-sub.shader_test
new file mode 100644
index 0000000..01470c3
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow-only-sub.shader_test
@@ -0,0 +1,56 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_diff;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* Test that optimization passes like dead code elimination don't
+ * eliminate the subtraction if the borrow result isn't used.
+ */
+ uvec4 borrow;
+ uvec4 diff = usubBorrow(x, y, borrow);
+
+ if (diff != expected_diff)
+ color.r = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_diff 1 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_diff 0 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_diff 0xFFFFFFFF 0 0x80000001 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow.shader_test
new file mode 100644
index 0000000..930b735
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-usubBorrow.shader_test
@@ -0,0 +1,58 @@
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_functions
+
+[vertex shader]
+#extension GL_MESA_shader_integer_functions : enable
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+uniform uvec4 x, y;
+uniform uvec4 expected_diff, expected_borrow;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ uvec4 borrow;
+ uvec4 diff = usubBorrow(x, y, borrow);
+
+ if (diff != expected_diff)
+ color.r = 1.0;
+ if (borrow != expected_borrow)
+ color.b = 1.0;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = color;
+}
+
+[test]
+uniform uvec4 x 1 2 3 4
+uniform uvec4 y 0 1 2 3
+uniform uvec4 expected_diff 1 1 1 1
+uniform uvec4 expected_borrow 0 0 0 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 4 3 2 1
+uniform uvec4 y 4 4 4 4
+uniform uvec4 expected_diff 0 0xFFFFFFFF 0xFFFFFFFE 0xFFFFFFFD
+uniform uvec4 expected_borrow 0 1 1 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uvec4 x 0xFFFFFFFE 0xFFFFFFFF 0x80000000 0
+uniform uvec4 y 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF 0
+uniform uvec4 expected_diff 0xFFFFFFFF 0 0x80000001 0
+uniform uvec4 expected_borrow 1 0 1 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
--
2.5.5
More information about the Piglit
mailing list