Reduces LUT needed by mul extension
This commit is contained in:
@@ -1,22 +1,54 @@
|
||||
# expected: 0000000000000000, 00000000000dead0, c1b080e900, -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, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Mul 0
|
||||
# --------------------------------------------------------------
|
||||
# 1. MUL : a * 0
|
||||
mul x31, x2, x3
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Basic multiplications
|
||||
# 2. MUL : a * 1
|
||||
mul x31, x2, x4
|
||||
# expected: 00000000000dead0
|
||||
|
||||
# 3. MUL : a * a
|
||||
mul x31, x2, x6
|
||||
# expected: 0000000c1b080e900
|
||||
|
||||
# Overflow
|
||||
# 4. MUL : -1 * a
|
||||
mul x31, x5, x2
|
||||
# expected: -00000000000dead0
|
||||
|
||||
# Signed * signed
|
||||
# 5. MUL : negative * negative
|
||||
mul x31, x7, x7
|
||||
# expected: 000000000054a029
|
||||
|
||||
# 6. MUL : negative * positive
|
||||
mul x31, x7, x8
|
||||
# expected: -00000000115452c0
|
||||
|
||||
# 7. MUL : positive * negative
|
||||
mul x31, x8, x9
|
||||
# expected: -0000001600786e00
|
||||
|
||||
# 8. MUL : overflow example (max * 2)
|
||||
li x12, 2
|
||||
mul x31, x10, x12
|
||||
# expected: fffffffffffffffe
|
||||
|
||||
# 9. MUL : max * max
|
||||
mul x31, x10, x10
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 10. MUL : min * min
|
||||
mul x31, x11, x11
|
||||
# expected: 0000000000000000
|
||||
|
||||
Reference in New Issue
Block a user