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