1 ; RUN: opt < %s -interleaved-access -S | FileCheck %s
2 ; RUN: opt < %s -passes=interleaved-access -S | FileCheck %s
4 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64--linux-gnu"
7 define void @extract_user_basic(ptr %ptr, i1 %c) {
8 ; CHECK-LABEL: @extract_user_basic(
10 ; CHECK-NEXT: [[LDN:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0(ptr %ptr)
11 ; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { <4 x i32>, <4 x i32> } [[LDN]], 0
12 ; CHECK-NEXT: br i1 %c, label %if.then, label %if.merge
14 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[TMP1]], i64 1
15 ; CHECK-NEXT: br label %if.merge
17 ; CHECK-NEXT: ret void
20 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
21 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
22 br i1 %c, label %if.then, label %if.merge
25 %e0 = extractelement <8 x i32> %interleaved.vec, i32 2
32 define void @extract_user_multi(ptr %ptr, i1 %c) {
33 ; CHECK-LABEL: @extract_user_multi(
35 ; CHECK-NEXT: [[LDN:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0(ptr %ptr)
36 ; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { <4 x i32>, <4 x i32> } [[LDN]], 0
37 ; CHECK-NEXT: br i1 %c, label %if.then, label %if.merge
39 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[TMP1]], i64 0
40 ; CHECK-NEXT: br label %if.merge
42 ; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[TMP1]], i64 1
43 ; CHECK-NEXT: ret void
46 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
47 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
48 br i1 %c, label %if.then, label %if.merge
51 %e0 = extractelement <8 x i32> %interleaved.vec, i32 0
55 %e1 = extractelement <8 x i32> %interleaved.vec, i32 2
59 define void @extract_user_multi_no_dom(ptr %ptr, i1 %c) {
60 ; CHECK-LABEL: @extract_user_multi_no_dom(
61 ; CHECK-NOT: @llvm.aarch64.neon
65 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
66 %e0 = extractelement <8 x i32> %interleaved.vec, i32 0
67 br i1 %c, label %if.then, label %if.merge
70 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
71 %e1 = extractelement <8 x i32> %interleaved.vec, i32 2
78 define void @extract_user_wrong_const_index(ptr %ptr) {
79 ; CHECK-LABEL: @extract_user_wrong_const_index(
80 ; CHECK-NOT: @llvm.aarch64.neon
84 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
85 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
86 %e0 = extractelement <8 x i32> %interleaved.vec, i32 1
90 define void @extract_user_undef_index(ptr %ptr) {
91 ; CHECK-LABEL: @extract_user_undef_index(
92 ; CHECK-NOT: @llvm.aarch64.neon
96 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
97 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
98 %e0 = extractelement <8 x i32> %interleaved.vec, i32 undef
102 define void @extract_user_var_index(ptr %ptr, i32 %i) {
103 ; CHECK-LABEL: @extract_user_var_index(
104 ; CHECK-NOT: @llvm.aarch64.neon
108 %interleaved.vec = load <8 x i32>, ptr %ptr, align 8
109 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
110 %e0 = extractelement <8 x i32> %interleaved.vec, i32 %i