binutils-gdb/ld/testsuite/ld-loongarch-elf/jmp_op.s
WANG Xuerui 20f2e2686c opcodes: LoongArch: add "ret" instruction to reduce typing
This syntactic sugar is present in both classical and emerging
architectures, like Alpha, SPARC and RISC-V, and assembler macros
doing the same thing can already be found in the wild e.g. [1], proving
the feature's popularity. It's better to provide support directly in the
assembler so downstream users wouldn't have to re-invent this over and
over again.

[1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/loongarch/sysdep.h;h=c586df819cd90;hb=HEAD#l28
2022-08-01 15:57:32 +08:00

24 lines
314 B
ArmAsm

.L1:
nop
bgtz $r4,.L1
bgez $r4,.L1
blez $r4,.L1
beqz $r4,.L1
bnez $r4,.L1
bceqz $fcc0,.L1
bcnez $fcc0,.L1
jr $r4
b .L1
bl .L1
beq $r4,$r5,.L1
bne $r4,$r5,.L1
blt $r4,$r5,.L1
bgt $r4,$r5,.L1
bge $r4,$r5,.L1
ble $r4,$r5,.L1
bltu $r4,$r5,.L1
bgtu $r4,$r5,.L1
bgeu $r4,$r5,.L1
bleu $r4,$r5,.L1
ret