55 lines
1.3 KiB
ArmAsm
55 lines
1.3 KiB
ArmAsm
.text
|
|
_start:
|
|
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
|
|
|
|
# --------------------------------------------------------------
|
|
# 1. MULW : a * 0
|
|
mulw x31, x2, x3
|
|
# expected: 0000000000000000
|
|
|
|
# 2. MULW : a * 1
|
|
mulw x31, x2, x4
|
|
# expected: 000000000000dead0
|
|
|
|
# 3. MULW : a * a
|
|
mulw x31, x2, x6
|
|
# expected: FFFFFFFFB080E900
|
|
|
|
# 4. MULW : -1 * a
|
|
mulw x31, x5, x2
|
|
# expected: -dead0
|
|
|
|
# 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
|