1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
4target triple = "hexagon"
5
6; Generate the inline restore for single register pair for functions
7; with "optsize" attribute.
8
9; CHECK-LABEL:    fred_os
10; CHECK-DAG:      memd{{.*}} = r17:16
11; CHECK-DAG:      r17:16 = memd{{.*}}
12; CHECK-DAG:      deallocframe
13; CHECK-NOT:  call __restore
14
15define i32 @fred_os(i32 %x) #0 {
16entry:
17  %call = tail call i32 @foo(i32 %x) #2
18  %call1 = tail call i32 @bar(i32 %x, i32 %call) #2
19  ret i32 %call1
20}
21
22; Generate the restoring call for single register pair for functions
23; with "minsize" attribute.
24
25; CHECK-LABEL:    fred_oz
26; CHECK-DAG:      memd{{.*}} = r17:16
27; CHECK-NOT:  r17:16 = memd{{.*}}
28; CHECK-DAG:      call __restore
29
30define i32 @fred_oz(i32 %x) #1 {
31entry:
32  %call = tail call i32 @foo(i32 %x) #2
33  %call1 = tail call i32 @bar(i32 %x, i32 %call) #2
34  ret i32 %call1
35}
36
37declare i32 @foo(i32) #2
38declare i32 @bar(i32, i32) #2
39
40attributes #0 = { nounwind optsize "disable-tail-calls"="false" }
41attributes #1 = { nounwind minsize "disable-tail-calls"="false" }
42attributes #2 = { nounwind optsize }
43