1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 @a = common dso_local local_unnamed_addr global [1 x [10 x i32]] zeroinitializer, align 16
7 @c = common dso_local local_unnamed_addr global i32 0, align 4
8 @b = common dso_local local_unnamed_addr global [1 x [7 x i32]] zeroinitializer, align 16
10 ; Function Attrs: norecurse nounwind uwtable
11 define dso_local void @fn1() local_unnamed_addr #0 {
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: movslq c(%rip), %rax
15 ; CHECK-NEXT: leaq (%rax,%rax,4), %rcx
16 ; CHECK-NEXT: leaq (,%rax,4), %rdx
17 ; CHECK-NEXT: movl a(%rdx,%rcx,8), %ecx
18 ; CHECK-NEXT: leaq (%rax,%rax,8), %rdx
19 ; CHECK-NEXT: leaq (%rdx,%rdx,2), %rdx
20 ; CHECK-NEXT: addq %rax, %rdx
21 ; CHECK-NEXT: movl %ecx, b(%rdx,%rax,4)
24 %0 = load i32, ptr @c, align 4, !tbaa !2
25 %idxprom = sext i32 %0 to i64
26 %arrayidx2 = getelementptr inbounds [1 x [10 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom
27 %1 = load i32, ptr %arrayidx2, align 4, !tbaa !2
28 %arrayidx6 = getelementptr inbounds [1 x [7 x i32]], ptr @b, i64 0, i64 %idxprom, i64 %idxprom
29 store i32 %1, ptr %arrayidx6, align 4, !tbaa !2
33 ; Function Attrs: norecurse nounwind uwtable
34 define dso_local i32 @main() local_unnamed_addr #0 {
36 ; CHECK: # %bb.0: # %entry
37 ; CHECK-NEXT: movslq c(%rip), %rax
38 ; CHECK-NEXT: leaq (%rax,%rax,4), %rcx
39 ; CHECK-NEXT: leaq (,%rax,4), %rdx
40 ; CHECK-NEXT: movl a(%rdx,%rcx,8), %ecx
41 ; CHECK-NEXT: leaq (%rax,%rax,8), %rdx
42 ; CHECK-NEXT: leaq (%rdx,%rdx,2), %rdx
43 ; CHECK-NEXT: addq %rax, %rdx
44 ; CHECK-NEXT: movl %ecx, b(%rdx,%rax,4)
45 ; CHECK-NEXT: xorl %eax, %eax
48 %0 = load i32, ptr @c, align 4, !tbaa !2
49 %idxprom.i = sext i32 %0 to i64
50 %arrayidx2.i = getelementptr inbounds [1 x [10 x i32]], ptr @a, i64 0, i64 %idxprom.i, i64 %idxprom.i
51 %1 = load i32, ptr %arrayidx2.i, align 4, !tbaa !2
52 %arrayidx6.i = getelementptr inbounds [1 x [7 x i32]], ptr @b, i64 0, i64 %idxprom.i, i64 %idxprom.i
53 store i32 %1, ptr %arrayidx6.i, align 4, !tbaa !2
57 attributes #0 = { norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
59 !llvm.module.flags = !{!0}
62 !0 = !{i32 1, !"wchar_size", i32 4}
63 !1 = !{!"clang version 6.0.0 "}
65 !3 = !{!"int", !4, i64 0}
66 !4 = !{!"omnipotent char", !5, i64 0}
67 !5 = !{!"Simple C/C++ TBAA"}