Implements (mostly untested) rv64i)

This commit is contained in:
2025-11-12 18:02:14 +01:00
parent 8ac17f20fe
commit 7bb8b993ae
8 changed files with 158 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
# expected: 0000000000000000, FFFFFFFFFFFFFFFF, 0000000000000010
# expected: 0000000000000000, FFFFFFFFFFFFFFFF, 0000000000000010, 0000000000000000
.text
_start:
# This test CANNOT use li as it uses addiw under the hood
@@ -12,3 +12,10 @@ _start:
# simple addition
addi x1, x0, 8
addiw x31, x1, 8
# 32bits trim
lui x1, 0xFFFFF
slli x1, x1, 20
addiw x31, x1, 0

22
bench/tests/op/sraiw.s Normal file
View File

@@ -0,0 +1,22 @@
# expected: 0000000000000000, 000000003fffffff, ffffffffc0000000, ffffffffffffffff, ffffffffffffffff
.text
_start:
# Test 1: 1 >> 1 => 0
li x1, 1
sraiw x31, x1, 1 # x31 = 0
# Test 2: 0x7fffffff >> 1 => 0x3fffffff
li x1, 0x7fffffff
sraiw x31, x1, 1 # x31 = 0x000000003fffffff
# Test 3: 0x80000000 >> 1 => 0xc0000000 (sign-extended)
li x1, 0x80000000
sraiw x31, x1, 1 # x31 = 0xffffffffc0000000
# Test 4: 0x80000000 >> 31 => 0xffffffff (-1)
li x1, 0x80000000
sraiw x31, x1, 31 # x31 = 0xffffffffffffffff
# Test 5: 0xffffffff >> 31 => 0xffffffff (-1)
li x1, -1
sraiw x31, x1, 31 # x31 = 0xffffffffffffffff