xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/merge_store.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -addr-sink-using-gep=1 | FileCheck %s
3
4define void @merge_store(i32* nocapture %a) {
5; CHECK-LABEL: merge_store:
6; CHECK: movq
7; CHECK: movq
8entry:
9  br label %for.body
10
11  for.body:
12  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
13  %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
14  store i32 1, i32* %arrayidx, align 4
15  %0 = or i64 %indvars.iv, 1
16  %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %0
17  store i32 1, i32* %arrayidx2, align 4
18  %1 = or i64 %indvars.iv, 2
19  %arrayidx5 = getelementptr inbounds i32, i32* %a, i64 %1
20  store i32 1, i32* %arrayidx5, align 4
21  %2 = or i64 %indvars.iv, 3
22  %arrayidx8 = getelementptr inbounds i32, i32* %a, i64 %2
23  store i32 1, i32* %arrayidx8, align 4
24  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
25  %3 = trunc i64 %indvars.iv.next to i32
26  %cmp = icmp slt i32 %3, 1000
27  br i1 %cmp, label %for.body, label %for.end
28
29  for.end:
30  ret void
31}
32