diff options
| author | Paschalis Mpeis <Paschalis.Mpeis@arm.com> | 2025-05-12 16:21:48 +0100 |
|---|---|---|
| committer | Paschalis Mpeis <Paschalis.Mpeis@arm.com> | 2025-05-12 16:21:48 +0100 |
| commit | ae0a6abb94357049c9b6a007311ac48a1eeae60e (patch) | |
| tree | 727e073e898e1a3ec90281c77e744407cacbee59 | |
| parent | 2ec13c513fb9de52abd7a3431151fd6bcf02a1c0 (diff) | |
[BOLT][AArch64] Add tests for unsupported conditional tailcallsusers/paschalis-mpeis/cond-tailcalls-aarc64
Tests cover: cbz, cbnz, tbz, tbnz, b.eq, and b.ne
| -rw-r--r-- | bolt/test/AArch64/conditional-tailcall.s | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/bolt/test/AArch64/conditional-tailcall.s b/bolt/test/AArch64/conditional-tailcall.s new file mode 100644 index 000000000000..1e0a13317338 --- /dev/null +++ b/bolt/test/AArch64/conditional-tailcall.s @@ -0,0 +1,93 @@ +# Bolt cannot handle conditional tail calls. + +# Example with CBZ: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym CBZ=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-CBZ + +# Example with CBNZ: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym CBNZ=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-CBNZ + +# Example with TBZ: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym TBZ=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-TBZ + +# Example with TBNZ: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym TBNZ=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-TBNZ + +# Example with B.EQ: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym BEQ=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-BEQ + +# Example with B.NE: +# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o \ +# RUN: --defsym BNE=1 +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q +# RUN: not --crash llvm-bolt %t.exe -o %t.bolt --skip-funcs foo 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-BNE + +# CHECK-CBZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected +# CHECK-CBNZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected +# CHECK-TBZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected +# CHECK-TBNZ: FKI.TargetOffset == 0 && "0-bit relocation offset expected +# CHECK-BEQ: FKI.TargetOffset == 0 && "0-bit relocation offset expected +# CHECK-BNE: FKI.TargetOffset == 0 && "0-bit relocation offset expected + + .text + .globl foo + .type foo, %function +foo: + .cfi_startproc + +.ifdef CBZ + cbz xzr, bar +.endif + +.ifdef CBNZ + cbnz xzr, bar +.endif + +.ifdef TBZ + tbz xzr, #0, bar +.endif + +.ifdef TBNZ + tbnz xzr, #0, bar +.endif + +.ifdef BEQ + cmp wzr, wzr + b.eq bar +.endif + +.ifdef BNE + cmp wzr, wzr + b.ne bar +.endif + + .cfi_endproc +.size foo, .-foo + + .globl bar + .type bar, %function +bar: + .cfi_startproc + ret xzr + .cfi_endproc +.size bar, .-bar |
