diff options
author | Ian Romanick <[email protected]> | 2016-10-27 03:02:58 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2017-01-20 15:41:23 -0800 |
commit | fda33e09d8eb2a92f294a0433addfcf3527c1544 (patch) | |
tree | 2ead5293e3a07ae793e23a9c3ef3e1590e368154 /src/compiler/nir/nir_opcodes.py | |
parent | 8ad74a2745162f8f5dcf6d0d2ec1e17fedb4b0d2 (diff) |
nir: Shift count for shift opcodes is always 32-bits
Previously both sources were unsized. This caused problems when the
thing being shifted was 64-bit but the shift count was 32-bit. The
expectation in NIR is that all unsized sources (and destination) will
ultimately have the same size.
The changes in nir_opt_algebraic.py are to prevent errors like:
Failed to parse transformation:
03:12:25 (('extract_i8', 'a', 'b'), ('ishr', ('ishl', 'a', ('imul', ('isub', 3, 'b'), 8)), 24), 'options->lower_extract_byte')
03:12:25 Traceback (most recent call last):
03:12:25 File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 610, in __init__
03:12:25 xform = SearchAndReplace(xform)
03:12:25 File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 495, in __init__
03:12:25 BitSizeValidator(varset).validate(self.search, self.replace)
03:12:25 File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 311, in validate
03:12:25 validate_dst_class = self._validate_bit_class_up(replace)
03:12:25 File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 414, in _validate_bit_class_up
03:12:25 src_class = self._validate_bit_class_up(val.sources[i])
03:12:25 File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 420, in _validate_bit_class_up
03:12:25 assert src_class == src_type_bits
03:12:25 AssertionError
Signed-off-by: Ian Romanick <[email protected]>
Suggested-by: Connor Abbott <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Cc: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opcodes.py')
-rw-r--r-- | src/compiler/nir/nir_opcodes.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 2e5a665fb39..0f6dd0add83 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -492,9 +492,9 @@ binop("seq", tfloat32, commutative, "(src0 == src1) ? 1.0f : 0.0f") # Set on Equ binop("sne", tfloat32, commutative, "(src0 != src1) ? 1.0f : 0.0f") # Set on Not Equal -binop("ishl", tint, "", "src0 << src1") -binop("ishr", tint, "", "src0 >> src1") -binop("ushr", tuint, "", "src0 >> src1") +opcode("ishl", 0, tint, [0, 0], [tint, tuint32], "", "src0 << src1") +opcode("ishr", 0, tint, [0, 0], [tint, tuint32], "", "src0 >> src1") +opcode("ushr", 0, tuint, [0, 0], [tuint, tuint32], "", "src0 >> src1") # bitwise logic operators # |