Skip to content
  • Ian Romanick's avatar
    nir: Shift count for shift opcodes is always 32-bits · fda33e09
    Ian Romanick authored
    
    
    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: default avatarIan Romanick <ian.d.romanick@intel.com>
    Suggested-by: default avatarConnor Abbott <cwabbott0@gmail.com>
    Reviewed-by: default avatarConnor Abbott <cwabbott0@gmail.com>
    Cc: Jason Ekstrand <jason@jlekstrand.net>
    fda33e09