1 ; RUN: llc -mtriple=x86_64-apple-darwin -o - %s | FileCheck %s
3 ; Simple case: completely identical returns, even with extensions, shouldn't be
4 ; a barrier to tail calls.
5 declare zeroext i1 @give_bool()
6 define zeroext i1 @test_bool() {
7 ; CHECK-LABEL: test_bool:
9 %call = tail call zeroext i1 @give_bool()
13 ; Here, there's more zero extension to be done between the call and the return,
14 ; so a tail call is impossible (well, according to current Clang practice
15 ; anyway. The AMD64 ABI isn't crystal clear on the matter).
16 ; FIXME: The high 24 bits returned from test_i32 are undefined; do tail call!
17 declare zeroext i32 @give_i32()
18 define zeroext i8 @test_i32() {
19 ; CHECK-LABEL: test_i32:
20 ; CHECK: callq _give_i32
23 %call = tail call zeroext i32 @give_i32()
24 %val = trunc i32 %call to i8
28 ; Here, one function is zeroext and the other is signext. To the extent that
29 ; these both mean something they are incompatible so no tail call is possible.
30 ; FIXME: The high 16 bits returned are undefined; do tail call!
31 declare zeroext i16 @give_unsigned_i16()
32 define signext i16 @test_incompatible_i16() {
33 ; CHECK-LABEL: test_incompatible_i16:
34 ; CHECK: callq _give_unsigned_i16
37 %call = tail call zeroext i16 @give_unsigned_i16()
41 declare inreg i32 @give_i32_inreg()
42 define i32 @test_inreg_to_normal() {
43 ; CHECK-LABEL: test_inreg_to_normal:
44 ; CHECK: callq _give_i32_inreg
46 %val = tail call inreg i32 @give_i32_inreg()
50 define inreg i32 @test_normal_to_inreg() {
51 ; CHECK-LABEL: test_normal_to_inreg:
52 ; CHECK: callq _give_i32
54 %val = tail call i32 @give_i32()