# Calculate a^b. Where: a0=a, a1=b # # Also, this is a good example of how numeric labels can be used # # Label 1: can be defined and redefined everywhere, and we can use # a suffix when referencing it, to specify if we want to reference # the previous or the next definition of the label, according to the # current position. 'b' for before 'f' for after. # # Ex: # # beqz a1, 1f # refers to the symbol 1 defined after this instruction # .globl _start .section .text pow: mv a2, a0 li a0, 1 1: beqz a1, 1f mul a0, a0, a2 addi a1, a1, -1 j 1b 1: ret _start: li a0, 2 li a1, 3 jal pow # Setup exit ecall # Return value is already in a0 li a7, 93 ecall