brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 7632504 Raw
123 lines · plain
1## Check that LDR relaxation will fail since LDR is inside a non-simple2## function and there is no NOP next to it.3 4# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \5# RUN:    --defsym FAIL=1 %s -o %t.o6# RUN: %clang %cflags %t.o -o %t.so -Wl,-q7# RUN: not llvm-bolt %t.so -o %t.bolt 2>&1 | FileCheck %s --check-prefix=FAIL8 9# FAIL: BOLT-ERROR: cannot relax LDR in non-simple function _start10 11.ifdef FAIL12  .text13  .global _start14  .type _start, %function15_start:16  .cfi_startproc17  br x218  ldr x0, _foo19  ret20  .cfi_endproc21.size _start, .-_start22.endif23 24## Check that LDR relaxation is not needed since the reference is not far away.25 26# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \27# RUN:    --defsym NOT_NEEDED=1 %s -o %t.o28# RUN: %clang %cflags %t.o -o %t.so -Wl,-q29# RUN: llvm-bolt %t.so -o %t.bolt30# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=NOT_NEEDED31 32# NOT_NEEDED: <_start>33# NOT_NEEDED-NEXT: ldr34 35.ifdef NOT_NEEDED36  .text37  .global _start38  .type _start, %function39_start:40  .cfi_startproc41  ldr x0, _start42  ret43  .cfi_endproc44.size _start, .-_start45.endif46 47## Check that LDR relaxation is done in a simple function, where NOP will48## be inserted as needed.49 50# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \51# RUN:    --defsym RELAX_SIMPLE=1 %s -o %t.o52# RUN: %clang %cflags %t.o -o %t.so -Wl,-q53# RUN: llvm-bolt %t.so -o %t.bolt54# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAX55 56# RELAX: adrp57# RELAX-NEXT: ldr58 59.ifdef RELAX_SIMPLE60  .text61  .global _start62  .type _start, %function63_start:64  .cfi_startproc65  ldr x0, _foo66  ret67  .cfi_endproc68.size _start, .-_start69.endif70 71## Check that LDR relaxation is done in a non-simple function, where NOP72## exists next to LDR.73 74# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \75# RUN:    --defsym RELAX_NON_SIMPLE=1 %s -o %t.o76# RUN: %clang %cflags %t.o -o %t.so -Wl,-q77# RUN: llvm-bolt %t.so -o %t.bolt78# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAX79 80.ifdef RELAX_NON_SIMPLE81  .text82  .global _start83  .type _start, %function84_start:85  .cfi_startproc86  br x287  ldr x0, _foo88  nop89  ret90  .cfi_endproc91.size _start, .-_start92.endif93 94## Check LDR relaxation works on loading W (low 32-bit of X) registers.95 96# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \97# RUN:    --defsym RELAX_SIMPLE_WREG=1 %s -o %t.o98# RUN: %clang %cflags %t.o -o %t.so -Wl,-q99# RUN: llvm-bolt %t.so -o %t.bolt100# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAXW101 102# RELAXW: adrp x0103# RELAXW-NEXT: ldr w0104 105.ifdef RELAX_SIMPLE_WREG106  .text107  .global _start108  .type _start, %function109_start:110  .cfi_startproc111  ldr w0, _foo112  ret113  .cfi_endproc114.size _start, .-_start115.endif116 117  .section .text_cold118  .global _foo119  .align 3120_foo:121  .long 0x12345678122.size _foo, .-_foo123