| 1 |
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ |
| 2 |
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s | FileCheck %s |
| 3 |
; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \ |
| 4 |
; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names < %s | FileCheck %s |
| 5 |
|
| 6 |
|
| 7 |
; The test checks the behavior of PC Relative indirect calls. When using |
| 8 |
; PC Relative, TOC save and restore are no longer required. Function pointer |
| 9 |
; is passed as a parameter in this test. |
| 10 |
|
| 11 |
; Function Attrs: noinline |
| 12 |
define dso_local void @IndirectCallExternFuncPtr(ptr nocapture %ptrfunc) { |
| 13 |
; CHECK-LABEL: IndirectCallExternFuncPtr: |
| 14 |
; CHECK: # %bb.0: # %entry |
| 15 |
; CHECK-NEXT: mtctr r3 |
| 16 |
; CHECK-NEXT: mr r12, r3 |
| 17 |
; CHECK-NEXT: bctr |
| 18 |
; CHECK-NEXT: #TC_RETURNr8 ctr |
| 19 |
entry: |
| 20 |
tail call void %ptrfunc() |
| 21 |
ret void |
| 22 |
} |
| 23 |
|
| 24 |
define dso_local void @FuncPtrPassAsParam() { |
| 25 |
entry: |
| 26 |
tail call void @IndirectCallExternFuncPtr(ptr nonnull @Function) |
| 27 |
ret void |
| 28 |
} |
| 29 |
|
| 30 |
declare void @Function() |