brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 90f1346 Raw
57 lines · plain
1; RUN: llc -mtriple=x86_64-apple-darwin -o - %s | FileCheck %s2 3; Simple case: completely identical returns, even with extensions, shouldn't be4; a barrier to tail calls.5declare zeroext i1 @give_bool()6define zeroext i1 @test_bool() {7; CHECK-LABEL: test_bool:8; CHECK: jmp9  %call = tail call zeroext i1 @give_bool()10  ret i1 %call11}12 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 practice15; 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!17declare zeroext i32 @give_i32()18define zeroext i8 @test_i32() {19; CHECK-LABEL: test_i32:20; CHECK: callq _give_i3221; CHECK: ret22 23  %call = tail call zeroext i32 @give_i32()24  %val = trunc i32 %call to i825  ret i8 %val26}27 28; Here, one function is zeroext and the other is signext. To the extent that29; 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!31declare zeroext i16 @give_unsigned_i16()32define signext i16 @test_incompatible_i16() {33; CHECK-LABEL: test_incompatible_i16:34; CHECK: callq _give_unsigned_i1635; CHECK: ret36 37  %call = tail call zeroext i16 @give_unsigned_i16()38  ret i16 %call39}40 41declare inreg i32 @give_i32_inreg()42define i32 @test_inreg_to_normal() {43; CHECK-LABEL: test_inreg_to_normal:44; CHECK: callq _give_i32_inreg45; CHECK: ret46  %val = tail call inreg i32 @give_i32_inreg()47  ret i32 %val48}49 50define inreg i32 @test_normal_to_inreg() {51; CHECK-LABEL: test_normal_to_inreg:52; CHECK: callq _give_i3253; CHECK: ret54  %val = tail call i32 @give_i32()55  ret i32 %val56}57