1 ; RUN: llc -march=hexagon -enable-save-restore-long -hexagon-initial-cfg-cleanup=0 < %s | FileCheck %s
3 ; Check that the -long-calls feature is supported by the backend.
6 ; CHECK: jump ##__restore
7 define i64 @test_longcall(i32 %x, i32 %y) #0 {
9 %add = add nsw i32 %x, 5
10 %call = tail call i64 @foo(i32 %add) #1
11 %conv = sext i32 %y to i64
12 %add1 = add nsw i64 %call, %conv
17 define i64 @test_longtailcall(i32 %x, i32 %y) #1 {
19 %add = add nsw i32 %x, 5
20 %call = tail call i64 @foo(i32 %add) #1
25 define i64 @test_longnoret(i32 %x, i32 %y) #2 {
27 %add = add nsw i32 %x, 5
28 %0 = tail call i64 @bar(i32 %add) #6
33 ; CHECK: jump ##__restore
34 ; The restore call will still be long because of the enable-save-restore-long
36 define i64 @test_shortcall(i32 %x, i32 %y) #3 {
38 %add = add nsw i32 %x, 5
39 %call = tail call i64 @foo(i32 %add) #1
40 %conv = sext i32 %y to i64
41 %add1 = add nsw i64 %call, %conv
46 define i64 @test_shorttailcall(i32 %x, i32 %y) #4 {
48 %add = add nsw i32 %x, 5
49 %call = tail call i64 @foo(i32 %add) #1
54 define i64 @test_shortnoret(i32 %x, i32 %y) #5 {
56 %add = add nsw i32 %x, 5
57 %0 = tail call i64 @bar(i32 %add) #6
61 declare i64 @foo(i32) #1
62 declare i64 @bar(i32) #6
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" }
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" }
72 attributes #6 = { noreturn nounwind "target-cpu"="hexagonv60" }