79 lines · plain
1## Test R_RISCV_CALL relaxation for some boundary situations that need multiple2## iterations before symbols fit in a c.j immediate.3 4# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax,+c %s -o %t.rv325# RUN: llvm-jitlink -noexec \6# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \7# RUN: -check %s %t.rv328 9# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax,+c %s -o %t.rv6410# RUN: llvm-jitlink -noexec \11# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \12# RUN: -check %s %t.rv6413 14# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+relax,+zca %s -o %t.rv32zca15# RUN: llvm-jitlink -noexec \16# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \17# RUN: -check %s %t.rv32zca18 19# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax,+zca %s -o %t.rv64zca20# RUN: llvm-jitlink -noexec \21# RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \22# RUN: -check %s %t.rv64zca23 24 .globl main25 .type main,@function26main:27## Relaxed to c.j. This needs 2 iterations: c.j only fits after first relaxing28## to jal29 tail f30 .space 204231 .size main, .-main32 33 .globl f34 .type f,@function35f:36## Relaxed to c.j in the same way as above.37 tail main38 .size f, .-f39 40 .globl g41 .type g,@function42g:43## Relaxed to c.j. This needs 3 iterations: c.j only fits after first relaxing44## both itself and the call to g to jal, and then relaxing the call to g to c.j45 tail h46 tail g47 .space 204048 .size g, .-g49 50 .globl h51 .type h,@function52h:53## Relaxed to c.j in the same way as above.54 tail g55 .size h, .-h56 57## main: c.j f58# jitlink-check: (*{2}(main))[1:0] = 0x159# jitlink-check: (*{2}(main))[15:13] = 0x560# jitlink-check: decode_operand(main, 0)[11:0] = (f - main)[11:0]61 62## f: c.j main63# jitlink-check: (*{2}(f))[1:0] = 0x164# jitlink-check: (*{2}(f))[15:13] = 0x565# jitlink-check: decode_operand(f, 0)[11:0] = (main - f)[11:0]66 67## g: c.j h; c.j g68# jitlink-check: (*{2}(g))[1:0] = 0x169# jitlink-check: (*{2}(g))[15:13] = 0x570# jitlink-check: decode_operand(g, 0)[11:0] = (h - g)[11:0]71# jitlink-check: (*{2}(g+2))[1:0] = 0x172# jitlink-check: (*{2}(g+2))[15:13] = 0x573# jitlink-check: decode_operand(g+2, 0)[11:0] = (g - (g + 2))[11:0]74 75## h: c.j g76# jitlink-check: (*{2}(h))[1:0] = 0x177# jitlink-check: (*{2}(h))[15:13] = 0x578# jitlink-check: decode_operand(h, 0)[11:0] = (g - h)[11:0]79