Reduces LUT needed by mul extension
This commit is contained in:
@@ -1,25 +1,60 @@
|
||||
# expected: ffffffffffffffff, ffffffffffffffff, dead0, 1, 8000000000000000, 7
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x8000000000000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # -123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # -765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # -234567
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Div by 0
|
||||
div x31, x2, x3
|
||||
div x31, x5, x3
|
||||
|
||||
# Basic divisions
|
||||
# 1. DIV : a / 1
|
||||
div x31, x2, x4
|
||||
# expected: 00000000000dead0
|
||||
|
||||
# 2. DIV : a / a
|
||||
div x31, x2, x6
|
||||
# expected: 0000000000000001
|
||||
|
||||
# Overflow
|
||||
div x31, x9, x5
|
||||
# 3. DIV : negative / positive
|
||||
div x31, x5, x8
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
# Signed / signed
|
||||
# 4. DIV : negative / positive
|
||||
div x31, x7, x8
|
||||
# expected: fffffffffffffffa
|
||||
|
||||
# 5. DIV : positive / negative
|
||||
div x31, x8, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 6. DIV : negative / negative
|
||||
div x31, x7, x9
|
||||
# expected: 0000000000000003
|
||||
|
||||
# 7. DIV : max / 2
|
||||
li x12, 2
|
||||
div x31, x10, x12
|
||||
# expected: 3fffffffffffffff
|
||||
|
||||
# 8. DIV : min / -1
|
||||
li x12, -1 # -1
|
||||
div x31, x11, x12
|
||||
# expected: 8000000000000000
|
||||
|
||||
# 9. DIV : min / 1
|
||||
div x31, x11, x4
|
||||
# expected: 8000000000000000
|
||||
|
||||
# 10. DIV : 0 / any
|
||||
div x31, x3, x2
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 11. DIV : any / 0
|
||||
div x31, x2, x0
|
||||
# expected: ffffffffffffffff
|
||||
div x31, x7, x0
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
@@ -1,14 +1,55 @@
|
||||
# expected: ffffffffffffffff, dead0, 1
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x6, 0xdead0
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, 123456 # 123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, 765432 # 765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, 234567 # 234567
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b (treated as unsigned = 0x8000...)
|
||||
|
||||
# Div by 0
|
||||
divu x31, x2, x3
|
||||
|
||||
# Basic divisions
|
||||
# 1. DIVU : a / 1
|
||||
divu x31, x2, x4
|
||||
# expected: 00000000000dead0
|
||||
|
||||
# 2. DIVU : a / a
|
||||
divu x31, x2, x6
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 3. DIVU : smaller / larger
|
||||
divu x31, x5, x8
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 4. DIVU : larger / smaller
|
||||
divu x31, x7, x8
|
||||
# expected: 0000000000000006
|
||||
|
||||
# 5. DIVU : any / any
|
||||
divu x31, x8, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 6. DIVU : larger / larger
|
||||
divu x31, x7, x9
|
||||
# expected: 0000000000000003
|
||||
|
||||
# 7. DIVU : max / 2
|
||||
li x12, 2
|
||||
divu x31, x10, x12
|
||||
# expected: 3fffffffffffffff
|
||||
|
||||
# 8. DIVU : min / 1
|
||||
divu x31, x11, x4
|
||||
# expected: 8000000000000000
|
||||
|
||||
# 9. DIVU : 0 / any
|
||||
divu x31, x3, x2
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 10. DIVU : any / 0
|
||||
divu x31, x2, x0
|
||||
# expected: ffffffffffffffff
|
||||
divu x31, x7, x0
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
@@ -1,14 +1,55 @@
|
||||
# expected: ffffffffffffffff, dead0, 1
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x6, 0xdead0
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # 0xfffe1dc0 (4294843840)
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # 0xffed32b8 (4294201864)
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # 0xfffc7239 (4294732729)
|
||||
li x10, 0xffffffff # max unsigned 32b (4294967295)
|
||||
li x11, 0x80000000 # 2147483648
|
||||
|
||||
# Div by 0
|
||||
divuw x31, x2, x3
|
||||
|
||||
# Basic divisions
|
||||
# 1. DIVUW : a / 1
|
||||
divuw x31, x2, x4
|
||||
# expected: 000000000000dead0
|
||||
|
||||
# 2. DIVUW : a / a
|
||||
divuw x31, x2, x6
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 3. DIVUW : unsigned(0xfffe1dc0) / 123456
|
||||
divuw x31, x5, x8
|
||||
# expected: 00000000000087e4
|
||||
|
||||
# 4. DIVUW : unsigned(0xffed32b8) / 123456
|
||||
divuw x31, x7, x8
|
||||
# expected: 00000000000087df
|
||||
|
||||
# 5. DIVUW : unsigned(123456) / unsigned(0xffed32b8)
|
||||
divuw x31, x8, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 6. DIVUW : unsigned(x7) / unsigned(x9)
|
||||
divuw x31, x7, x9
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 7. DIVUW : max32 / 2
|
||||
li x12, 2
|
||||
divuw x31, x10, x12
|
||||
# expected: 000000007fffffff
|
||||
|
||||
# 8. DIVUW : min32 / 1
|
||||
divuw x31, x11, x4
|
||||
# expected: ffffffff80000000
|
||||
|
||||
# 9. DIVUW : 0 / any
|
||||
divuw x31, x0, x2
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 10. DIVUW : any / 0
|
||||
divuw x31, x2, x0
|
||||
# expected: ffffffffffffffff
|
||||
divuw x31, x7, x0
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
@@ -1,25 +1,60 @@
|
||||
# expected: ffffffffffffffff, ffffffffffffffff, dead0, 1, ffffffff80000000, 7
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x80000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # -123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # -765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # -234567
|
||||
li x10, 0x7fffffff # max positive 32b
|
||||
li x11, 0x80000000 # min negative 32b
|
||||
|
||||
# Div by 0
|
||||
divw x31, x2, x3
|
||||
divw x31, x5, x3
|
||||
|
||||
# Basic divisions
|
||||
# 1. DIVW : a / 1
|
||||
divw x31, x2, x4
|
||||
# expected: 000000000000dead0
|
||||
|
||||
# 2. DIVW : a / a
|
||||
divw x31, x2, x6
|
||||
# expected: 0000000000000001
|
||||
|
||||
# Overflow
|
||||
divw x31, x9, x5
|
||||
# 3. DIVW : negative / positive
|
||||
divw x31, x5, x8
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
# Signed / signed
|
||||
# 4. DIVW : negative / positive
|
||||
divw x31, x7, x8
|
||||
# expected: fffffffffffffffa
|
||||
|
||||
# 5. DIVW : positive / negative
|
||||
divw x31, x8, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 6. DIVW : negative / negative
|
||||
divw x31, x7, x9
|
||||
# expected: 0000000000000003
|
||||
|
||||
# 7. DIVW : max / 2
|
||||
li x12, 2
|
||||
divw x31, x10, x12
|
||||
# expected: 000000003fffffff
|
||||
|
||||
# 8. DIVW : min / -1
|
||||
li x12, -1 # -1
|
||||
divw x31, x11, x12
|
||||
# expected: ffffffff80000000
|
||||
|
||||
# 9. DIVW : min / 1
|
||||
divw x31, x11, x4
|
||||
# expected: ffffffff80000000
|
||||
|
||||
# 10. DIVW : 0 / any
|
||||
divw x31, x0, x2
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 11. DIVW : any / 0
|
||||
divw x31, x2, x0
|
||||
# expected: ffffffffffffffff
|
||||
divw x31, x7, x0
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,19 +1,54 @@
|
||||
# expected: 0000000000000000, 0000000000000000, c1b080e9, ffffffffffffffff
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, 0xdead00000000
|
||||
li x2, 0xdead00000 # +59774074880
|
||||
li x3, 0 # zero
|
||||
li x4, 1 # one
|
||||
li x5, -1 # -1
|
||||
li x6, 0xdead00000 # duplicate of x2
|
||||
li x7, -235555555555 # negative
|
||||
li x8, 123456789 # positive
|
||||
li x9, -765432000000 # negative
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Mul 0
|
||||
# --------------------------------------------------------------
|
||||
# 1. MULH : a * 0
|
||||
mulh x31, x2, x3
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Basic multiplications
|
||||
# 2. MULH : a * 1
|
||||
mulh x31, x2, x4
|
||||
mulh x31, x7, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
# 3. MULH : a * a
|
||||
mulh x31, x2, x6
|
||||
# expected: 00000000000000c1
|
||||
|
||||
# 4. MULH : -1 * a
|
||||
mulh x31, x5, x2
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
# 5. MULH : negative * negative
|
||||
mulh x31, x7, x7
|
||||
# expected: 0000000000000bbf
|
||||
|
||||
# 6. MULH : negative * positive
|
||||
mulh x31, x7, x8
|
||||
# expected: fffffffffffffffe
|
||||
|
||||
# 7. MULH : positive * negative
|
||||
mulh x31, x8, x9
|
||||
# expected: fffffffffffffffa
|
||||
|
||||
# 8. MULH : overflow example (max * 2)
|
||||
li x12, 2
|
||||
mulh x31, x10, x12
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 9. MULH : max * max
|
||||
mulh x31, x10, x10
|
||||
# expected: 3fffffffffffffff
|
||||
|
||||
# 10. MULH : min * min
|
||||
mulh x31, x11, x11
|
||||
# expected: 4000000000000000
|
||||
|
||||
@@ -1,20 +1,54 @@
|
||||
# expected: 0000000000000000, 0000000000000000, c1b080e9, ffffffffffffffff, deacf
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, 0xdead00000000
|
||||
li x2, 0xdead00000 # +59774074880
|
||||
li x3, 0 # zero
|
||||
li x4, 1 # one
|
||||
li x5, -1 # -1
|
||||
li x6, 0xdead00000 # duplicate of x2
|
||||
li x7, -235555555555 # negative
|
||||
li x8, 123456789 # positive
|
||||
li x9, 765432000000 # positive
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Mul 0
|
||||
# --------------------------------------------------------------
|
||||
# 1. MULHSU : a * 0
|
||||
mulhsu x31, x2, x3
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Basic multiplications
|
||||
# 2. MULHSU : a * 1
|
||||
mulhsu x31, x2, x4
|
||||
mulhsu x31, x7, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
# 3. MULHSU : a * a
|
||||
mulhsu x31, x2, x6
|
||||
# expected: 00000000000000c1
|
||||
|
||||
# 4. MULHSU : -1 * a
|
||||
mulhsu x31, x5, x2
|
||||
mulhsu x31, x2, x5
|
||||
# expected: ffffffffffffffff
|
||||
|
||||
# 5. MULHSU : negative * positive
|
||||
mulhsu x31, x7, x8
|
||||
# expected: fffffffffffffffe
|
||||
|
||||
# 6. MULHSU : negative * positive large
|
||||
mulhsu x31, x7, x9
|
||||
# expected: ffffffffffffd9d1
|
||||
|
||||
# 7. MULHSU : positive * positive
|
||||
mulhsu x31, x8, x9
|
||||
# expected: 0000000000000005
|
||||
|
||||
# 8. MULHSU : overflow example (max * 2)
|
||||
li x12, 2
|
||||
mulhsu x31, x10, x12
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 9. MULHSU : max * max
|
||||
mulhsu x31, x10, x10
|
||||
# expected: 3fffffffffffffff
|
||||
|
||||
# 10. MULHSU : min * max
|
||||
mulhsu x31, x11, x10
|
||||
# expected: c000000000000000
|
||||
|
||||
@@ -1,20 +1,54 @@
|
||||
# expected: 0000000000000000, 0000000000000000, c1b080e9, deacf, deacf
|
||||
.text
|
||||
_start:
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, 0xdead00000000
|
||||
li x2, 0xdead00000 # +59774074880
|
||||
li x3, 0 # zero
|
||||
li x4, 1 # one
|
||||
li x5, 123456789 # small positive
|
||||
li x6, 0xdead00000 # duplicate of x2
|
||||
li x7, 765432000000 # large positive
|
||||
li x8, 123456789 # small positive
|
||||
li x9, 234567890000 # large positive
|
||||
li x10, 0xffffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min unsigned = 2^63
|
||||
|
||||
# Mul 0
|
||||
# --------------------------------------------------------------
|
||||
# 1. MULHU : a * 0
|
||||
mulhu x31, x2, x3
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Basic multiplications
|
||||
# 2. MULHU : a * 1
|
||||
mulhu x31, x2, x4
|
||||
mulhu x31, x7, x7
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
mulhu x31, x5, x2
|
||||
mulhu x31, x2, x5
|
||||
# 3. MULHU : a * a
|
||||
mulhu x31, x2, x6
|
||||
# expected: 00000000000000c1
|
||||
|
||||
# 4. MULHU : small * small
|
||||
mulhu x31, x5, x8
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 5. MULHU : small * large
|
||||
mulhu x31, x5, x7
|
||||
# expected: 0000000000000005
|
||||
|
||||
# 6. MULHU : large * small
|
||||
mulhu x31, x7, x8
|
||||
# expected: 0000000000000005
|
||||
|
||||
# 7. MULHU : large * large
|
||||
mulhu x31, x7, x9
|
||||
# expected: 0000000000002605
|
||||
|
||||
# 8. MULHU : max * 2
|
||||
li x12, 2
|
||||
mulhu x31, x10, x12
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 9. MULHU : max * max
|
||||
mulhu x31, x10, x10
|
||||
# expected: fffffffffffffffe
|
||||
|
||||
# 10. MULHU : min * max
|
||||
mulhu x31, x11, x10
|
||||
# expected: 7fffffffffffffff
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,27 +1,60 @@
|
||||
# expected: dead0, ffffffffffffffff, 0, 0, 18, 0, -57
|
||||
.text
|
||||
_start:
|
||||
li x1, 0x0293
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x8000000000000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # -123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # -765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # -234567
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Remainder by 0
|
||||
rem x31, x2, x3
|
||||
rem x31, x5, x3
|
||||
|
||||
# Basic remainders
|
||||
# 1. REM : a % 1
|
||||
rem x31, x2, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 2. REM : a % a
|
||||
rem x31, x2, x6
|
||||
rem x31, x6, x1
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
rem x31, x9, x5
|
||||
# 3. REM : negative % positive
|
||||
rem x31, x5, x8
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Signed / signed
|
||||
# 4. REM : negative % positive
|
||||
rem x31, x7, x8
|
||||
# expected: 00000000000181c8
|
||||
|
||||
# 5. REM : positive % negative
|
||||
rem x31, x8, x7
|
||||
# expected: -9cbb8
|
||||
|
||||
# 6. REM : negative % negative
|
||||
rem x31, x7, x9
|
||||
# expected: -f123
|
||||
|
||||
# 7. REM : max % 2
|
||||
li x12, 2
|
||||
rem x31, x10, x12
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 8. REM : min % -1
|
||||
li x12, -1
|
||||
rem x31, x11, x12
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 9. REM : min % 1
|
||||
rem x31, x11, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 10. REM : 0 % any
|
||||
rem x31, x3, x2
|
||||
# expected: 0000000000001234
|
||||
|
||||
# 11. REM : any % 0
|
||||
rem x31, x2, x0
|
||||
# expected: 00000000000dead0
|
||||
rem x31, x7, x0
|
||||
# expected: -badf8
|
||||
|
||||
@@ -1,27 +1,55 @@
|
||||
# expected: dead0, ffffffffffffffff, 0, 0, 18, 8000000000000000, fffffffffffff6cd
|
||||
.text
|
||||
_start:
|
||||
li x1, 0x0293
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x8000000000000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, 123456 # 123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, 765432 # 765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, 234567 # 234567
|
||||
li x10, 0x7fffffffffffffff # max positive 64b
|
||||
li x11, 0x8000000000000000 # min negative 64b
|
||||
|
||||
# Remainder by 0
|
||||
remu x31, x2, x3
|
||||
remu x31, x5, x3
|
||||
|
||||
# Basic remainders
|
||||
# 1. REMU : a % 1
|
||||
remu x31, x2, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 2. REMU : a % a
|
||||
remu x31, x2, x6
|
||||
remu x31, x6, x1
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
remu x31, x9, x5
|
||||
# 3. REMU : smaller % larger
|
||||
remu x31, x5, x7
|
||||
# expected: 000000000001e240
|
||||
|
||||
# Signed / signed
|
||||
# 4. REMU : larger % smaller
|
||||
remu x31, x7, x8
|
||||
# expected: 0000000000006078
|
||||
|
||||
# 5. REMU : any % any
|
||||
remu x31, x8, x7
|
||||
# expected: 000000000001e240
|
||||
|
||||
# 6. REMU : larger % larger
|
||||
remu x31, x7, x9
|
||||
# expected: 000000000000f123
|
||||
|
||||
# 7. REMU : max % 2
|
||||
li x12, 2
|
||||
remu x31, x10, x12
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 8. REMU : min % 1
|
||||
remu x31, x11, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 9. REMU : 0 % any
|
||||
remu x31, x3, x2
|
||||
# expected: 0000000000001234
|
||||
|
||||
# 10. REMU : any % 0
|
||||
remu x31, x2, x0
|
||||
# expected: 00000000000dead0
|
||||
remu x31, x7, x0
|
||||
# expected: 00000000000badf8
|
||||
|
||||
@@ -1,27 +1,60 @@
|
||||
# expected: dead0, ffffffffffffffff, 0, 0, 18, ffffffff80000000, fffffffffffff6cd
|
||||
.text
|
||||
_start:
|
||||
li x1, 0x0293
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x80000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # 0xfffe1dc0 (4294843840)
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # 0xffed32b8 (4294201864)
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # 0xfffc7239 (4294732729)
|
||||
li x10, 0xffffffff # max unsigned 32b
|
||||
li x11, 0x80000000 # 2147483648
|
||||
|
||||
# Remainder by 0
|
||||
remuw x31, x2, x3
|
||||
remuw x31, x5, x3
|
||||
|
||||
# Basic remainders
|
||||
# 1. REMUW : a % 1
|
||||
remuw x31, x2, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 2. REMUW : a % a
|
||||
remuw x31, x2, x6
|
||||
remuw x31, x6, x1
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
remuw x31, x9, x5
|
||||
# 3. REMUW : unsigned(x5) % x8
|
||||
remuw x31, x5, x8
|
||||
# expected: 000000000000dcc0
|
||||
|
||||
# Signed / signed
|
||||
# 4. REMUW : unsigned(x7) % x8
|
||||
remuw x31, x7, x8
|
||||
# expected: 0000000000007c48
|
||||
|
||||
# 5. REMUW : x8 % unsigned(x7)
|
||||
remuw x31, x8, x7
|
||||
# expected: 000000000001e240
|
||||
|
||||
# 6. REMUW : unsigned(x7) % unsigned(x9)
|
||||
remuw x31, x7, x9
|
||||
# expected: fffffffffff45208
|
||||
|
||||
# 7. REMUW : max32 % 2
|
||||
li x12, 2
|
||||
remuw x31, x10, x12
|
||||
# expected: 0000000000000001
|
||||
|
||||
# 8. REMUW : min32 % -1
|
||||
remuw x31, x11, x12
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 9. REMUW : min32 % 1
|
||||
remuw x31, x11, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 10. REMUW : 0 % any
|
||||
remuw x31, x3, x2
|
||||
# expected: 0000000000001234
|
||||
|
||||
# 11. REMUW : any % 0
|
||||
remuw x31, x2, x0
|
||||
# expected: 00000000000dead0
|
||||
|
||||
remuw x31, x7, x0
|
||||
# expected: FFFFFFFFFFF45208
|
||||
|
||||
@@ -1,27 +1,60 @@
|
||||
# expected: dead0, ffffffffffffffff, 0, 0, 18, 0, -57
|
||||
.text
|
||||
_start:
|
||||
li x1, 0x0293
|
||||
li x2, 0xdead0
|
||||
li x3, 0x0
|
||||
li x4, 0x1
|
||||
li x5, (-1)
|
||||
li x6, 0xdead0
|
||||
li x7, (-2355)
|
||||
li x8, (-324)
|
||||
li x9, 0x80000000
|
||||
li x2, 0xdead0 # 912080
|
||||
li x3, 0x1234 # 4660
|
||||
li x4, 1 # 1
|
||||
li x5, -123456 # -123456
|
||||
li x6, 0xdead0 # duplicate of x2
|
||||
li x7, -765432 # -765432
|
||||
li x8, 123456 # 123456
|
||||
li x9, -234567 # -234567
|
||||
li x10, 0x7fffffff # max positive 32b
|
||||
li x11, 0x80000000 # min negative 32b
|
||||
|
||||
# Remainder by 0
|
||||
remw x31, x2, x3
|
||||
remw x31, x5, x3
|
||||
|
||||
# Basic remainders
|
||||
# 1. REMW : a % 1
|
||||
remw x31, x2, x4
|
||||
# expected: 0000000000000000
|
||||
|
||||
# 2. REMW : a % a
|
||||
remw x31, x2, x6
|
||||
remw x31, x6, x1
|
||||
# expected: 0000000000000000
|
||||
|
||||
# Overflow
|
||||
remw x31, x9, x5
|
||||
# 3. REMW : negative % positive
|
||||
remw x31, x5, x8
|
||||
# expected: 0
|
||||
|
||||
# Signed / signed
|
||||
# 4. REMW : negative % positive
|
||||
remw x31, x7, x8
|
||||
# expected: 181c8
|
||||
|
||||
# 5. REMW : positive % negative
|
||||
remw x31, x8, x7
|
||||
# expected: fffffffffff63448
|
||||
|
||||
# 6. REMW : negative % negative
|
||||
remw x31, x7, x9
|
||||
# expected: ffffffffffff0edd
|
||||
|
||||
# 7. REMW : max % 2
|
||||
li x12, 2
|
||||
remw x31, x10, x12
|
||||
# expected: 00000001
|
||||
|
||||
# 8. REMW : min % -1
|
||||
li x12, -1
|
||||
remw x31, x11, x12
|
||||
# expected: 00000000
|
||||
|
||||
# 9. REMW : min % 1
|
||||
remw x31, x11, x4
|
||||
# expected: 00000000
|
||||
|
||||
# 10. REMW : 0 % any
|
||||
remw x31, x3, x2
|
||||
# expected: 00001234
|
||||
|
||||
# 11. REMW : any % 0
|
||||
remw x31, x2, x0
|
||||
# expected: 000dead0
|
||||
remw x31, x7, x0
|
||||
# expected: -badf8
|
||||
|
||||
Reference in New Issue
Block a user