llvm-project/llvm/test/CodeGen/VE/pic_indirect_func_call.ll

35 lines
1.1 KiB
LLVM

; RUN: llc -relocation-model=pic < %s -mtriple=ve-unknown-unknown | FileCheck %s
@ptr = external global void (...)*, align 8
define void @func() {
; CHECK-LABEL: func:
; CHECK: .LBB{{[0-9]+}}_2:
; CHECK-NEXT: lea %s15, _GLOBAL_OFFSET_TABLE_@pc_lo(-24)
; CHECK-NEXT: and %s15, %s15, (32)0
; CHECK-NEXT: sic %s16
; CHECK-NEXT: lea.sl %s15, _GLOBAL_OFFSET_TABLE_@pc_hi(%s16, %s15)
; CHECK-NEXT: lea %s0, function@got_lo
; CHECK-NEXT: and %s0, %s0, (32)0
; CHECK-NEXT: lea.sl %s0, function@got_hi(%s0)
; CHECK-NEXT: adds.l %s0, %s15, %s0
; CHECK-NEXT: ld %s0, (,%s0)
; CHECK-NEXT: lea %s1, ptr@got_lo
; CHECK-NEXT: and %s1, %s1, (32)0
; CHECK-NEXT: lea.sl %s1, ptr@got_hi(%s1)
; CHECK-NEXT: adds.l %s1, %s15, %s1
; CHECK-NEXT: ld %s1, (,%s1)
; CHECK-NEXT: st %s0, (,%s1)
; CHECK-NEXT: or %s12, 0, %s0
; CHECK-NEXT: bsic %lr, (,%s12)
; CHECK-NEXT: or %s11, 0, %s9
store void (...)* @function, void (...)** @ptr, align 8
%1 = load void (...)*, void (...)** @ptr, align 8
%2 = bitcast void (...)* %1 to void ()*
call void %2()
ret void
}
declare void @function(...)