xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/legalize-unaligned-load.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN:  llc -O3 -code-model=default -mtriple=armv7l-unknown-linux-gnueabihf -mcpu=generic %s -o - | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; Check that we respect the existing chain between loads and stores when we
3*9880d681SAndroid Build Coastguard Worker; legalize unaligned loads.
4*9880d681SAndroid Build Coastguard Worker; Test case from PR24669.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; Make sure the loads happen before the stores.
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: get_set_complex:
8*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: str
9*9880d681SAndroid Build Coastguard Worker; CHECK: ldr
10*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: str
11*9880d681SAndroid Build Coastguard Worker; CHECK: ldr
12*9880d681SAndroid Build Coastguard Worker; CHECK: str
13*9880d681SAndroid Build Coastguard Worker; CHECK: bx
14*9880d681SAndroid Build Coastguard Workerdefine i32 @get_set_complex({ float, float }* noalias nocapture %retptr,
15*9880d681SAndroid Build Coastguard Worker                            { i8*, i32 }** noalias nocapture readnone %excinfo,
16*9880d681SAndroid Build Coastguard Worker                            i8* noalias nocapture readnone %env,
17*9880d681SAndroid Build Coastguard Worker                            [38 x i8]* nocapture %arg.rec,
18*9880d681SAndroid Build Coastguard Worker                            float %arg.val.0, float %arg.val.1)
19*9880d681SAndroid Build Coastguard Worker{
20*9880d681SAndroid Build Coastguard Workerentry:
21*9880d681SAndroid Build Coastguard Worker  %inserted.real = insertvalue { float, float } undef, float %arg.val.0, 0
22*9880d681SAndroid Build Coastguard Worker  %inserted.imag = insertvalue { float, float } %inserted.real, float %arg.val.1, 1
23*9880d681SAndroid Build Coastguard Worker  %.15 = getelementptr inbounds [38 x i8], [38 x i8]* %arg.rec, i32 0, i32 10
24*9880d681SAndroid Build Coastguard Worker  %.16 = bitcast i8* %.15 to { float, float }*
25*9880d681SAndroid Build Coastguard Worker  %.17 = bitcast i8* %.15 to float*
26*9880d681SAndroid Build Coastguard Worker  %.18 = load float, float* %.17, align 1
27*9880d681SAndroid Build Coastguard Worker  %.19 = getelementptr inbounds [38 x i8], [38 x i8]* %arg.rec, i32 0, i32 14
28*9880d681SAndroid Build Coastguard Worker  %tmp = bitcast i8* %.19 to float*
29*9880d681SAndroid Build Coastguard Worker  %.20 = load float, float* %tmp, align 1
30*9880d681SAndroid Build Coastguard Worker  %inserted.real.1 = insertvalue { float, float } undef, float %.18, 0
31*9880d681SAndroid Build Coastguard Worker  %inserted.imag.1 = insertvalue { float, float } %inserted.real.1, float %.20, 1
32*9880d681SAndroid Build Coastguard Worker  store { float, float } %inserted.imag, { float, float }* %.16, align 1
33*9880d681SAndroid Build Coastguard Worker  store { float, float } %inserted.imag.1, { float, float }* %retptr, align 4
34*9880d681SAndroid Build Coastguard Worker  ret i32 0
35*9880d681SAndroid Build Coastguard Worker}
36