xref: /aosp_15_r20/external/llvm/test/CodeGen/Hexagon/restore-single-reg.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=hexagon < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget 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"
4*9880d681SAndroid Build Coastguard Workertarget triple = "hexagon"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Generate the inline restore for single register pair for functions
7*9880d681SAndroid Build Coastguard Worker; with "optsize" attribute.
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL:    fred_os
10*9880d681SAndroid Build Coastguard Worker; CHECK-DAG:      memd{{.*}} = r17:16
11*9880d681SAndroid Build Coastguard Worker; CHECK-DAG:      r17:16 = memd{{.*}}
12*9880d681SAndroid Build Coastguard Worker; CHECK-DAG:      deallocframe
13*9880d681SAndroid Build Coastguard Worker; CHECK-NOT:  call __restore
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine i32 @fred_os(i32 %x) #0 {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @foo(i32 %x) #2
18*9880d681SAndroid Build Coastguard Worker  %call1 = tail call i32 @bar(i32 %x, i32 %call) #2
19*9880d681SAndroid Build Coastguard Worker  ret i32 %call1
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; Generate the restoring call for single register pair for functions
23*9880d681SAndroid Build Coastguard Worker; with "minsize" attribute.
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL:    fred_oz
26*9880d681SAndroid Build Coastguard Worker; CHECK-DAG:      memd{{.*}} = r17:16
27*9880d681SAndroid Build Coastguard Worker; CHECK-NOT:  r17:16 = memd{{.*}}
28*9880d681SAndroid Build Coastguard Worker; CHECK-DAG:      call __restore
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine i32 @fred_oz(i32 %x) #1 {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @foo(i32 %x) #2
33*9880d681SAndroid Build Coastguard Worker  %call1 = tail call i32 @bar(i32 %x, i32 %call) #2
34*9880d681SAndroid Build Coastguard Worker  ret i32 %call1
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdeclare i32 @foo(i32) #2
38*9880d681SAndroid Build Coastguard Workerdeclare i32 @bar(i32, i32) #2
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind optsize "disable-tail-calls"="false" }
41*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind minsize "disable-tail-calls"="false" }
42*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind optsize }
43