1 ; RUN: opt < %s -interleaved-access -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4 target triple = "aarch64--linux-gnu"
6 define void @extract_user_basic(<8 x i32>* %ptr, i1 %c) {
7 ; CHECK-LABEL: @extract_user_basic(
9 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x i32>* %ptr to <4 x i32>*
10 ; CHECK-NEXT: [[LDN:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32(<4 x i32>* [[TMP0]])
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>, <8 x i32>* %ptr, align 8
21 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <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(<8 x i32>* %ptr, i1 %c) {
33 ; CHECK-LABEL: @extract_user_multi(
35 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast <8 x i32>* %ptr to <4 x i32>*
36 ; CHECK-NEXT: [[LDN:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32(<4 x i32>* [[TMP0]])
37 ; CHECK-NEXT: [[TMP1:%.*]] = extractvalue { <4 x i32>, <4 x i32> } [[LDN]], 0
38 ; CHECK-NEXT: br i1 %c, label %if.then, label %if.merge
40 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[TMP1]], i64 0
41 ; CHECK-NEXT: br label %if.merge
43 ; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[TMP1]], i64 1
44 ; CHECK-NEXT: ret void
47 %interleaved.vec = load <8 x i32>, <8 x i32>* %ptr, align 8
48 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
49 br i1 %c, label %if.then, label %if.merge
52 %e0 = extractelement <8 x i32> %interleaved.vec, i32 0
56 %e1 = extractelement <8 x i32> %interleaved.vec, i32 2
60 define void @extract_user_multi_no_dom(<8 x i32>* %ptr, i1 %c) {
61 ; CHECK-LABEL: @extract_user_multi_no_dom(
62 ; CHECK-NOT: @llvm.aarch64.neon
66 %interleaved.vec = load <8 x i32>, <8 x i32>* %ptr, align 8
67 %e0 = extractelement <8 x i32> %interleaved.vec, i32 0
68 br i1 %c, label %if.then, label %if.merge
71 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
72 %e1 = extractelement <8 x i32> %interleaved.vec, i32 2
79 define void @extract_user_wrong_const_index(<8 x i32>* %ptr) {
80 ; CHECK-LABEL: @extract_user_wrong_const_index(
81 ; CHECK-NOT: @llvm.aarch64.neon
85 %interleaved.vec = load <8 x i32>, <8 x i32>* %ptr, align 8
86 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
87 %e0 = extractelement <8 x i32> %interleaved.vec, i32 1
91 define void @extract_user_undef_index(<8 x i32>* %ptr) {
92 ; CHECK-LABEL: @extract_user_undef_index(
93 ; CHECK-NOT: @llvm.aarch64.neon
97 %interleaved.vec = load <8 x i32>, <8 x i32>* %ptr, align 8
98 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
99 %e0 = extractelement <8 x i32> %interleaved.vec, i32 undef
103 define void @extract_user_var_index(<8 x i32>* %ptr, i32 %i) {
104 ; CHECK-LABEL: @extract_user_var_index(
105 ; CHECK-NOT: @llvm.aarch64.neon
109 %interleaved.vec = load <8 x i32>, <8 x i32>* %ptr, align 8
110 %v0 = shufflevector <8 x i32> %interleaved.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
111 %e0 = extractelement <8 x i32> %interleaved.vec, i32 %i