diff options
author | Sagar Ghuge <[email protected]> | 2019-02-14 23:08:39 -0800 |
---|---|---|
committer | Sagar Ghuge <[email protected]> | 2019-03-04 15:50:25 -0800 |
commit | e551040c602d392019e68f54d9a3a310d2a937a3 (patch) | |
tree | d36046c91c6f69f2a8b9fd561add2b1cc9e820b2 /src/compiler/nir/nir_opcodes.py | |
parent | 1d363d440f261fbadc1db3c17acc514b7130d505 (diff) |
nir/glsl: Add another way of doing lower_imul64 for gen8+
On Gen 8 and 9, "mul" instruction supports 64 bit destination type. We
can reduce our 64x64 int multiplication from 4 instructions to 3.
Also instead of emitting two mul instructions, we can emit single mul
instuction and extract low/high 32 bits from 64 bit result for
[i/u]mulExtended
v2: 1) Allow lower_mul_high64 to use new opcode (Jason Ekstrand)
2) Add lower_mul_2x32_64 flag (Matt Turner)
3) Remove associative property as bit size is different (Connor
Abbott)
v3: Fix indentation and variable naming convention (Jason Ekstrand)
Signed-off-by: Sagar Ghuge <[email protected]>
Reviewed-by: 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, 6 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 499deb947e8..42f8662352e 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -475,6 +475,12 @@ binop("fmul", tfloat, commutative + associative, "src0 * src1") # low 32-bits of signed/unsigned integer multiply binop("imul", tint, commutative + associative, "src0 * src1") +# Generate 64 bit result from 2 32 bits quantity +binop_convert("imul_2x32_64", tint64, tint32, commutative, + "(int64_t)src0 * (int64_t)src1") +binop_convert("umul_2x32_64", tuint64, tuint32, commutative, + "(uint64_t)src0 * (uint64_t)src1") + # high 32-bits of signed integer multiply binop("imul_high", tint, commutative, """ if (bit_size == 64) { |