[Piglit] [PATCH] builtin tests: Add abs with neg/not tests for logical instructions.

Matt Turner mattst88 at gmail.com
Mon Jul 7 12:00:15 PDT 2014


Obviously the abs(-x) cases shouldn't generate instructions with both
source modifiers, but might as well test them.
---
 generated_tests/builtin_function.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index 9992ccf..7f9fae1 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -1385,6 +1385,42 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
     f('op-bitxor-not', 2, 130, lambda x, y: x ^ (~y), match_simple_binop,
       [ints+ivecs+uints+uvecs, ints+ivecs+uints+uvecs],
       template='({0} ^ (~ {1}))')
+    f('op-bitand-neg-abs', 2, 130, lambda x, y: x & (-abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} & (- abs({1})))')
+    f('op-bitand-not-abs', 2, 130, lambda x, y: x & (~abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} & (~ abs({1})))')
+    f('op-bitor-neg-abs', 2, 130, lambda x, y: x | (-abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} | (- abs({1})))')
+    f('op-bitor-not-abs', 2, 130, lambda x, y: x | (~abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} | (~ abs({1})))')
+    f('op-bitxor-neg-abs', 2, 130, lambda x, y: x ^ (-abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} ^ (- abs({1})))')
+    f('op-bitxor-not-abs', 2, 130, lambda x, y: x ^ (~abs(y)), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} ^ (~ abs({1})))')
+    f('op-bitand-abs-neg', 2, 130, lambda x, y: x & abs(-y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} & abs(- {1}))')
+    f('op-bitand-abs-not', 2, 130, lambda x, y: x & abs(~y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} & abs(~ {1}))')
+    f('op-bitor-abs-neg', 2, 130, lambda x, y: x | abs(-y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} | abs(- {1}))')
+    f('op-bitor-abs-not', 2, 130, lambda x, y: x | abs(~y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} | abs(~ {1}))')
+    f('op-bitxor-abs-neg', 2, 130, lambda x, y: x ^ abs(-y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} ^ abs(- {1}))')
+    f('op-bitxor-abs-not', 2, 130, lambda x, y: x ^ abs(~y), match_simple_binop,
+      [ints+ivecs, ints+ivecs],
+      template='({0} ^ abs(~ {1}))')
     f('length', 1, 110, np.linalg.norm, None, [floats+vecs])
     f('distance', 2, 110, lambda x, y: np.linalg.norm(x-y), match_args(0, 1),
       [floats+vecs, floats+vecs])
-- 
1.8.5.5



More information about the Piglit mailing list