brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · df5e1a9 Raw
123 lines · plain
1; RUN: llc -mtriple arm64e-apple-darwin -mattr=+bti              -asm-verbose=false \2; RUN:   -o - %s | FileCheck %s --check-prefixes=DARWIN,CHECK3; RUN: llc -mtriple arm64e-apple-darwin -mattr=+bti -global-isel -asm-verbose=false \4; RUN:   -o - %s | FileCheck %s --check-prefixes=DARWIN,CHECK5; RUN: llc -mtriple arm64e-apple-darwin -mattr=+bti -fast-isel   -asm-verbose=false \6; RUN:   -o - %s | FileCheck %s --check-prefixes=DARWIN,CHECK7; RUN: llc -mtriple aarch64-linux-gnu   -mattr=+bti -mattr=+pauth              -asm-verbose=false \8; RUN:   -o - %s | FileCheck %s --check-prefixes=ELF,CHECK9; RUN: llc -mtriple aarch64-linux-gnu   -mattr=+bti -mattr=+pauth -global-isel -asm-verbose=false \10; RUN:   -o - %s | FileCheck %s --check-prefixes=ELF,CHECK11; RUN: llc -mtriple aarch64-linux-gnu   -mattr=+bti -mattr=+pauth -fast-isel   -asm-verbose=false \12; RUN:   -o - %s | FileCheck %s --check-prefixes=ELF,CHECK13 14; ptrauth tail-calls can only use x16/x17 with BTI.15 16; CHECK-LABEL: test_tailcall_ia_0:17; CHECK-NEXT:  bti c18; CHECK-NEXT:  mov x16, x019; CHECK-NEXT:  braaz x1620define i32 @test_tailcall_ia_0(ptr %arg0) #0 {21  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 0, i64 0) ]22  ret i32 %tmp023}24 25; CHECK-LABEL: test_tailcall_ib_0:26; CHECK-NEXT:  bti c27; CHECK-NEXT:  mov x16, x028; CHECK-NEXT:  brabz x1629define i32 @test_tailcall_ib_0(ptr %arg0) #0 {30  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 1, i64 0) ]31  ret i32 %tmp032}33 34; CHECK-LABEL: test_tailcall_ia_imm:35; CHECK-NEXT:  bti c36; CHECK-NEXT:  mov x16, x037; CHECK-NEXT:  mov x17, #4238; CHECK-NEXT:  braa x16, x1739define i32 @test_tailcall_ia_imm(ptr %arg0) #0 {40  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 0, i64 42) ]41  ret i32 %tmp042}43 44; CHECK-LABEL: test_tailcall_ib_imm:45; CHECK-NEXT:  bti c46; CHECK-NEXT:  mov x16, x047; CHECK-NEXT:  mov x17, #4248; CHECK-NEXT:  brab x16, x1749define i32 @test_tailcall_ib_imm(ptr %arg0) #0 {50  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 1, i64 42) ]51  ret i32 %tmp052}53 54; CHECK-LABEL: test_tailcall_ia_var:55; DARWIN-NEXT: bti c56; DARWIN-NEXT: mov x16, x057; DARWIN-NEXT: ldr x0, [x1]58; DARWIN-NEXT: braa x16, x059; ELF-NEXT:    bti c60; ELF-NEXT:    ldr x1, [x1]61; ELF-NEXT:    mov x16, x062; ELF-NEXT:    braa x16, x163define i32 @test_tailcall_ia_var(ptr %arg0, ptr %arg1) #0 {64  %tmp0 = load i64, ptr %arg165  %tmp1 = tail call i32 %arg0() [ "ptrauth"(i32 0, i64 %tmp0) ]66  ret i32 %tmp167}68 69; CHECK-LABEL: test_tailcall_ib_var:70; DARWIN-NEXT: bti c71; DARWIN-NEXT: mov x16, x072; DARWIN-NEXT: ldr x0, [x1]73; DARWIN-NEXT: brab x16, x074; ELF-NEXT:    bti c75; ELF-NEXT:    ldr x1, [x1]76; ELF-NEXT:    mov x16, x077; ELF-NEXT:    brab x16, x178define i32 @test_tailcall_ib_var(ptr %arg0, ptr %arg1) #0 {79  %tmp0 = load i64, ptr %arg180  %tmp1 = tail call i32 %arg0() [ "ptrauth"(i32 1, i64 %tmp0) ]81  ret i32 %tmp182}83 84; CHECK-LABEL: test_tailcall_ia_arg:85; CHECK-NEXT:  bti c86; CHECK-NEXT:  mov x16, x087; CHECK-NEXT:  braa x16, x188define i32 @test_tailcall_ia_arg(ptr %arg0, i64 %arg1) #0 {89  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 0, i64 %arg1) ]90  ret i32 %tmp091}92 93; CHECK-LABEL: test_tailcall_ib_arg:94; CHECK-NEXT:  bti c95; CHECK-NEXT:  mov x16, x096; CHECK-NEXT:  brab x16, x197define i32 @test_tailcall_ib_arg(ptr %arg0, i64 %arg1) #0 {98  %tmp0 = tail call i32 %arg0() [ "ptrauth"(i32 1, i64 %arg1) ]99  ret i32 %tmp0100}101 102; CHECK-LABEL: test_tailcall_ia_arg_ind:103; CHECK-NEXT:  bti c104; CHECK-NEXT:  ldr x16, [x0]105; CHECK-NEXT:  braa x16, x1106define i32 @test_tailcall_ia_arg_ind(ptr %arg0, i64 %arg1) #0 {107  %tmp0 = load ptr, ptr %arg0108  %tmp1 = tail call i32 %tmp0() [ "ptrauth"(i32 0, i64 %arg1) ]109  ret i32 %tmp1110}111 112; CHECK-LABEL: test_tailcall_ib_arg_ind:113; CHECK-NEXT:  bti c114; CHECK-NEXT:  ldr x16, [x0]115; CHECK-NEXT:  brab x16, x1116define i32 @test_tailcall_ib_arg_ind(ptr %arg0, i64 %arg1) #0 {117  %tmp0 = load ptr, ptr %arg0118  %tmp1 = tail call i32 %tmp0() [ "ptrauth"(i32 1, i64 %arg1) ]119  ret i32 %tmp1120}121 122attributes #0 = { nounwind "branch-target-enforcement"="true" }123