1 ; RUN: llc -march=hexagon -enable-save-restore-long < %s | FileCheck %s 2 3 ; Check that the -long-calls feature is supported by the backend. 4 5 ; CHECK: call ##foo 6 ; CHECK: jump ##__restore 7 define i64 @test_longcall(i32 %x, i32 %y) #0 { 8 entry: 9 %add = add nsw i32 %x, 5 10 %call = tail call i64 @foo(i32 %add) #6 11 %conv = sext i32 %y to i64 12 %add1 = add nsw i64 %call, %conv 13 ret i64 %add1 14 } 15 16 ; CHECK: jump ##foo 17 define i64 @test_longtailcall(i32 %x, i32 %y) #1 { 18 entry: 19 %add = add nsw i32 %x, 5 20 %call = tail call i64 @foo(i32 %add) #6 21 ret i64 %call 22 } 23 24 ; CHECK: call ##bar 25 define i64 @test_longnoret(i32 %x, i32 %y) #2 { 26 entry: 27 %add = add nsw i32 %x, 5 28 %0 = tail call i64 @bar(i32 %add) #7 29 unreachable 30 } 31 32 ; CHECK: call foo 33 ; CHECK: jump ##__restore 34 ; The restore call will still be long because of the enable-save-restore-long 35 ; option being used. 36 define i64 @test_shortcall(i32 %x, i32 %y) #3 { 37 entry: 38 %add = add nsw i32 %x, 5 39 %call = tail call i64 @foo(i32 %add) #6 40 %conv = sext i32 %y to i64 41 %add1 = add nsw i64 %call, %conv 42 ret i64 %add1 43 } 44 45 ; CHECK: jump foo 46 define i64 @test_shorttailcall(i32 %x, i32 %y) #4 { 47 entry: 48 %add = add nsw i32 %x, 5 49 %call = tail call i64 @foo(i32 %add) #6 50 ret i64 %call 51 } 52 53 ; CHECK: call bar 54 define i64 @test_shortnoret(i32 %x, i32 %y) #5 { 55 entry: 56 %add = add nsw i32 %x, 5 57 %0 = tail call i64 @bar(i32 %add) #7 58 unreachable 59 } 60 61 declare i64 @foo(i32) #6 62 declare i64 @bar(i32) #7 63 64 attributes #0 = { minsize nounwind "target-cpu"="hexagonv60" "target-features"="+long-calls" } 65 attributes #1 = { nounwind "target-cpu"="hexagonv60" "target-features"="+long-calls" } 66 attributes #2 = { noreturn nounwind "target-cpu"="hexagonv60" "target-features"="+long-calls" } 67 68 attributes #3 = { minsize nounwind "target-cpu"="hexagonv60" "target-features"="-long-calls" } 69 attributes #4 = { nounwind "target-cpu"="hexagonv60" "target-features"="-long-calls" } 70 attributes #5 = { noreturn nounwind "target-cpu"="hexagonv60" "target-features"="-long-calls" } 71 72 attributes #6 = { noreturn "target-cpu"="hexagonv60" } 73 attributes #7 = { noreturn nounwind "target-cpu"="hexagonv60" } 74