xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/tail-call-parameter-attrs-mismatch.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=i686-unknown-linux-gnu -o - %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdeclare void @f(i16 signext)
4*9880d681SAndroid Build Coastguard Workerdeclare void @g(i32 signext)
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @flags_match(i16 signext %x) {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  tail call void @f(i16 signext %x)
10*9880d681SAndroid Build Coastguard Worker  ret void
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; The parameter flags match; do the tail call.
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: flags_match:
14*9880d681SAndroid Build Coastguard Worker; CHECK: jmp f
15*9880d681SAndroid Build Coastguard Worker}
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @flags_mismatch(i16 zeroext %x) {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker  tail call void @f(i16 signext %x)
20*9880d681SAndroid Build Coastguard Worker  ret void
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; The parameter flags mismatch. %x has not been sign-extended,
23*9880d681SAndroid Build Coastguard Worker; so tail call is not possible.
24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: flags_mismatch:
25*9880d681SAndroid Build Coastguard Worker; CHECK: movswl
26*9880d681SAndroid Build Coastguard Worker; CHECK: calll f
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine void @mismatch_doesnt_matter(i32 zeroext %x) {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker  tail call void @g(i32 signext %x)
33*9880d681SAndroid Build Coastguard Worker  ret void
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; The parameter flags mismatch, but the type is wide enough that
36*9880d681SAndroid Build Coastguard Worker; no extension takes place in practice, so do the tail call.
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: mismatch_doesnt_matter:
39*9880d681SAndroid Build Coastguard Worker; CHECK: jmp g
40*9880d681SAndroid Build Coastguard Worker}
41