parent
de202e25b9
commit
3e110a82f4
@ -0,0 +1,40 @@ |
||||
.include "exit_return.s" |
||||
|
||||
.global _start
|
||||
_start: |
||||
# Set base value of a0 to 'test failed' |
||||
addi a0, zero, 1 |
||||
|
||||
# Multiply 2 * 3 in t0, high bits |
||||
addi t0, zero, 3 |
||||
addi t1, zero, 2 |
||||
mulh t0, t0, t1 |
||||
addi t1, zero, 0 |
||||
beq t0, t1, mulh_low_ok |
||||
exret |
||||
|
||||
mulh_low_ok: |
||||
# Multiply 2<<29 * 8 in t0, high bits |
||||
# Result high should be 2 |
||||
addi t1, zero, 2 |
||||
slli t0, t1, 29 |
||||
addi t1, zero, 8 |
||||
mulh t0, t0, t1 |
||||
addi t1, zero, 2 |
||||
beq t0, t1, mulh_high_ok |
||||
exret |
||||
|
||||
mulh_high_ok: |
||||
# Multiply 2 << 29 * -8 in t0, high bits |
||||
# Result high should be 0xFFFF_FFFE ie -2 signed ? |
||||
addi t1, zero, 2 |
||||
slli t0, t1, 29 |
||||
addi t1, zero, -8 |
||||
mulh t0, t0, t1 |
||||
addi t1, zero, -2 |
||||
beq t0, t1, mulh_neg_ok |
||||
exret |
||||
|
||||
mulh_neg_ok: |
||||
addi a0, zero, 0 |
||||
exret |
Loading…
Reference in new issue