nir/vtn: SPIR-V bit count opcodes (core and extension) dest size mismatches nir
[mesa.git] / src / panfrost / midgard / midgard_nir_algebraic.py
index fd250c1ba94eacfcfe5c9a0455ff02a1b536b345..ad54757eee7de2a1f0fdba9a4ea80c1480cf3313 100644 (file)
@@ -31,7 +31,10 @@ b = 'b'
 c = 'c'
 
 algebraic = [
-   (('pack_unorm_4x8', a), ('pack_32_4x8', ('f2u8', ('fround_even', ('fmul', ('fsat', a), 255.0)))))
+   (('pack_unorm_4x8', a), ('pack_32_4x8', ('f2u8', ('fround_even', ('fmul', ('fsat', a), 255.0))))),
+
+   # Allows us to schedule as a multiply by 2
+   (('~fadd', ('fadd', a, b), a), ('fadd', ('fadd', a, a), b)),
 ]
 
 algebraic_late = [
@@ -64,6 +67,9 @@ algebraic_late = [
     (('ishl', 'a@8', b), ('u2u8', ('u2u16', ('ishl', ('u2u32', ('u2u16', a)), b)))),
     (('ishr', 'a@8', b), ('i2i8', ('i2i16', ('ishr', ('i2i32', ('i2i16', a)), b)))),
     (('ushr', 'a@8', b), ('u2u8', ('u2u16', ('ushr', ('u2u32', ('u2u16', a)), b)))),
+
+    # Canonical form. The scheduler will convert back if it makes sense.
+    (('fmul', a, 2.0), ('fadd', a, a))
 ]