81 lines
981 B
ArmAsm
81 lines
981 B
ArmAsm
.section .text
|
|
.global start
|
|
.global sieve
|
|
.global stats
|
|
|
|
#define TEST(n) \
|
|
.global n; .global n ## _ret; \
|
|
jal zero,n; n ## _ret:
|
|
|
|
start:
|
|
TEST(lui)
|
|
TEST(auipc)
|
|
TEST(j)
|
|
TEST(jal)
|
|
TEST(jalr)
|
|
|
|
TEST(beq)
|
|
TEST(bne)
|
|
TEST(blt)
|
|
TEST(bge)
|
|
TEST(bltu)
|
|
TEST(bgeu)
|
|
|
|
TEST(lb)
|
|
TEST(lh)
|
|
TEST(lw)
|
|
TEST(lbu)
|
|
TEST(lhu)
|
|
|
|
TEST(sb)
|
|
TEST(sh)
|
|
TEST(sw)
|
|
|
|
TEST(addi)
|
|
TEST(slti) // also tests sltiu
|
|
TEST(xori)
|
|
TEST(ori)
|
|
TEST(andi)
|
|
TEST(slli)
|
|
TEST(srli)
|
|
TEST(srai)
|
|
|
|
TEST(add)
|
|
TEST(sub)
|
|
TEST(sll)
|
|
TEST(slt) // what is with sltu ?
|
|
TEST(xor)
|
|
TEST(srl)
|
|
TEST(sra)
|
|
TEST(or)
|
|
TEST(and)
|
|
|
|
TEST(fence_i)
|
|
TEST(simple)
|
|
|
|
/* set stack pointer */
|
|
lui sp,(64*1024)>>12
|
|
|
|
/* jump to sieve C code */
|
|
jal ra,sieve
|
|
|
|
/* jump to stats C code */
|
|
jal ra,stats
|
|
|
|
/* print "DONE\n" */
|
|
lui a0,0x10000000>>12
|
|
addi a1,zero,'D'
|
|
addi a2,zero,'O'
|
|
addi a3,zero,'N'
|
|
addi a4,zero,'E'
|
|
addi a5,zero,'\n'
|
|
sw a1,0(a0)
|
|
sw a2,0(a0)
|
|
sw a3,0(a0)
|
|
sw a4,0(a0)
|
|
sw a5,0(a0)
|
|
|
|
/* break */
|
|
sbreak
|
|
|