nir: add amul instruction
Used for address/offset calculation (ie. array derefs), where we can potentially use less than 32b for the multiply of array idx by element size. For backends that support `imul24`, this gives a lowering pass an easy way to find multiplies that potentially can be converted to `imul24`. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
This commit is contained in:
@@ -1047,6 +1047,18 @@ dst.z = src2.x;
|
||||
dst.w = src3.x;
|
||||
""")
|
||||
|
||||
# An integer multiply instruction for address calculation. This is
|
||||
# similar to imul, except that the results are undefined in case of
|
||||
# overflow. Overflow is defined according to the size of the variable
|
||||
# being dereferenced.
|
||||
#
|
||||
# This relaxed definition, compared to imul, allows an optimization
|
||||
# pass to propagate bounds (ie, from an load/store intrinsic) to the
|
||||
# sources, such that lower precision integer multiplies can be used.
|
||||
# This is useful on hw that has 24b or perhaps 16b integer multiply
|
||||
# instructions.
|
||||
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
|
||||
# multiplication (imul) on Freedreno backend..
|
||||
|
||||
Reference in New Issue
Block a user