diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 7bd7a776b11..b04c2f363ef 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -1248,11 +1248,11 @@ dst.p = src15.x; binop("amul", tint, _2src_commutative + associative, "src0 * src1") # ir3-specific instruction that maps directly to mul-add shift high mix, -# (IMADSH_MIX16 i.e. ah * bl << 16 + c). It is used for lowering integer +# (IMADSH_MIX16 i.e. al * bh << 16 + c). It is used for lowering integer # multiplication (imul) on Freedreno backend.. opcode("imadsh_mix16", 0, tint32, [0, 0, 0], [tint32, tint32, tint32], False, "", """ -dst = ((((src0 & 0xffff0000) >> 16) * (src1 & 0x0000ffff)) << 16) + src2; +dst = ((((src0 & 0x0000ffff) << 16) * (src1 & 0xffff0000)) >> 16) + src2; """) # ir3-specific instruction that maps directly to ir3 mad.s24. diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 20e3836ff58..6446c4915b7 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2751,7 +2751,7 @@ for op in ['fddx', 'fddx_fine', 'fddx_coarse', optimizations += [ # 'al * bl': If either 'al' or 'bl' is zero, return zero. (('umul_low', '#a(is_lower_half_zero)', 'b'), (0)), - # '(ah * bl) << 16 + c': If either 'ah' or 'bl' is zero, return 'c'. + # '(al * bh) << 16 + c': If either 'al' or 'bh' is zero, return 'c'. (('imadsh_mix16', '#a@32(is_lower_half_zero)', 'b@32', 'c@32'), ('c')), (('imadsh_mix16', 'a@32', '#b@32(is_upper_half_zero)', 'c@32'), ('c')), ]