xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/micromips-delay-slot-jr.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
2*9880d681SAndroid Build Coastguard Worker; RUN:   -relocation-model=static -O2 < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@main.L = internal unnamed_addr constant [3 x i8*] [i8* blockaddress(@main, %L1), i8* blockaddress(@main, %L2), i8* null], align 4
5*9880d681SAndroid Build Coastguard Worker@str = private unnamed_addr constant [2 x i8] c"A\00"
6*9880d681SAndroid Build Coastguard Worker@str2 = private unnamed_addr constant [2 x i8] c"B\00"
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  br label %L1
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard WorkerL1:                                               ; preds = %entry, %L1
13*9880d681SAndroid Build Coastguard Worker  %i.0 = phi i32 [ 0, %entry ], [ %inc, %L1 ]
14*9880d681SAndroid Build Coastguard Worker  %puts = tail call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i32 0, i32 0))
15*9880d681SAndroid Build Coastguard Worker  %inc = add i32 %i.0, 1
16*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds [3 x i8*], [3 x i8*]* @main.L, i32 0, i32 %i.0
17*9880d681SAndroid Build Coastguard Worker  %0 = load i8*, i8** %arrayidx, align 4, !tbaa !1
18*9880d681SAndroid Build Coastguard Worker  indirectbr i8* %0, [label %L1, label %L2]
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard WorkerL2:                                               ; preds = %L1
21*9880d681SAndroid Build Coastguard Worker  %puts2 = tail call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str2, i32 0, i32 0))
22*9880d681SAndroid Build Coastguard Worker  ret i32 0
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdeclare i32 @puts(i8* nocapture readonly) #1
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker!1 = !{!2, !2, i64 0}
28*9880d681SAndroid Build Coastguard Worker!2 = !{!"any pointer", !3, i64 0}
29*9880d681SAndroid Build Coastguard Worker!3 = !{!"omnipotent char", !4, i64 0}
30*9880d681SAndroid Build Coastguard Worker!4 = !{!"Simple C/C++ TBAA"}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; CHECK:      jrc
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker%struct.foostruct = type { [3 x float] }
35*9880d681SAndroid Build Coastguard Worker%struct.barstruct = type { %struct.foostruct, float }
36*9880d681SAndroid Build Coastguard Worker@bar_ary = common global [4 x %struct.barstruct] zeroinitializer, align 4
37*9880d681SAndroid Build Coastguard Workerdefine float* @spooky(i32 signext %i) #0 {
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker  %safe = getelementptr inbounds [4 x %struct.barstruct], [4 x %struct.barstruct]* @bar_ary, i32 0, i32 %i, i32 1
40*9880d681SAndroid Build Coastguard Worker  store float 1.420000e+02, float* %safe, align 4, !tbaa !1
41*9880d681SAndroid Build Coastguard Worker  ret float* %safe
42*9880d681SAndroid Build Coastguard Worker}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; CHECK:      spooky:
45*9880d681SAndroid Build Coastguard Worker; CHECK:      jrc $ra
46*9880d681SAndroid Build Coastguard Worker
47