xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/x32-function_pointer-1.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-linux-gnux32  | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -fast-isel | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Test for x32 function pointer tail call
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@foo1 = external global void (i8*)*
7*9880d681SAndroid Build Coastguard Worker@foo2 = external global void (i8*)*
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine void @bar(i8* %h) nounwind uwtable {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  %0 = load void (i8*)*, void (i8*)** @foo1, align 4
12*9880d681SAndroid Build Coastguard Worker; CHECK: movl	foo1(%rip), %e{{[^,]*}}
13*9880d681SAndroid Build Coastguard Worker  tail call void %0(i8* %h) nounwind
14*9880d681SAndroid Build Coastguard Worker; CHECK: callq	*%r{{[^,]*}}
15*9880d681SAndroid Build Coastguard Worker  %1 = load void (i8*)*, void (i8*)** @foo2, align 4
16*9880d681SAndroid Build Coastguard Worker; CHECK: movl	foo2(%rip), %e{{[^,]*}}
17*9880d681SAndroid Build Coastguard Worker  tail call void %1(i8* %h) nounwind
18*9880d681SAndroid Build Coastguard Worker; CHECK: jmpq	*%r{{[^,]*}}
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21