Reduces LUT needed by mul extension
This commit is contained in:
@@ -1,22 +1,54 @@
|
||||
# expected: 0000000000000000, 00000000000dead0, ffffffffb080e900, -dead0, 54a029
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x2, 0xdead0 # +912080
|
||||
li x3, 0 # zero
|
||||
li x4, 1 # one
|
||||
li x5, -1 # -1
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -2355 # negative
|
||||
li x8, 123456 # positive
|
||||
li x9, -765432 # negative
|
||||
li x10, 0x7fffffff # max positive 32b
|
||||
li x11, 0x80000000 # min negative 32b
|
||||
|
||||
# Mul 0
|
||||
# --------------------------------------------------------------
|
||||
# 1. MULW : a * 0
|
||||
mulw x31, x2, x3
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Basic multiplications
|
||||
# 2. MULW : a * 1
|
||||
mulw x31, x2, x4
|
||||
# expected: 000000000000dead0
|
||||
|
||||
# 3. MULW : a * a
|
||||
mulw x31, x2, x6
|
||||
# expected: FFFFFFFFB080E900
|
||||
|
||||
# Overflow
|
||||
# 4. MULW : -1 * a
|
||||
mulw x31, x5, x2
|
||||
# expected: -dead0
|
||||
|
||||
# Signed * signed
|
||||
# 5. MULW : negative * negative
|
||||
mulw x31, x7, x7
|
||||
# expected: 000000000054A029
|
||||
|
||||
# 6. MULW : negative * positive
|
||||
mulw x31, x7, x8
|
||||
# expected: FFFFFFFFEEABAD40
|
||||
|
||||
# 7. MULW : positive * negative
|
||||
mulw x31, x8, x9
|
||||
# expected: FFFFFFFFFF879200
|
||||
|
||||
# 8. MULW : overflow example (max * 2)
|
||||
li x12, 2
|
||||
mulw x31, x10, x12
|
||||
# expected: fffffffffffffffe
|
||||
|
||||
# 9. MULW : max * max
|
||||
mulw x31, x10, x10
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 10. MULW : min * min
|
||||
mulw x31, x11, x11
|
||||
# expected: 0000000000000000
|
||||
|
||||
Reference in New Issue
Block a user