• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -mtriple=aarch64 -interleaved-access -S | FileCheck %s
2
3; CHECK-LABEL: @extract_user_basic(
4; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
5; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0
6; CHECK: extractelement <4 x i32> %[[R]], i64 1
7define void @extract_user_basic(<8 x i32>* %A, i1 %C) {
8entry:
9  %L = load <8 x i32>, <8 x i32>* %A, align 8
10  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
11  br i1 %C, label %if.then, label %if.merge
12
13if.then:
14  %E = extractelement <8 x i32> %L, i32 2
15  br label %if.merge
16
17if.merge:
18  ret void
19}
20
21; CHECK-LABEL: @extract_user_multi(
22; CHECK: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
23; CHECK: %[[R:.+]] = extractvalue { <4 x i32>, <4 x i32> } %ldN, 0
24; CHECK: extractelement <4 x i32> %[[R]], i64 0
25; CHECK: extractelement <4 x i32> %[[R]], i64 1
26define void @extract_user_multi(<8 x i32>* %A, i1 %C) {
27entry:
28  %L = load <8 x i32>, <8 x i32>* %A, align 8
29  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
30  br i1 %C, label %if.then, label %if.merge
31
32if.then:
33  %E1 = extractelement <8 x i32> %L, i32 0
34  br label %if.merge
35
36if.merge:
37  %E2 = extractelement <8 x i32> %L, i32 2
38  ret void
39}
40
41; CHECK-LABEL: @extract_user_multi_no_dom(
42; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
43define void @extract_user_multi_no_dom(<8 x i32>* %A, i1 %C) {
44entry:
45  %L = load <8 x i32>, <8 x i32>* %A, align 8
46  %E1 = extractelement <8 x i32> %L, i32 0
47  br i1 %C, label %if.then, label %if.merge
48
49if.then:
50  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
51  %E2 = extractelement <8 x i32> %L, i32 2
52  br label %if.merge
53
54if.merge:
55  ret void
56}
57
58; CHECK-LABEL: @extract_user_wrong_const_index(
59; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
60define void @extract_user_wrong_const_index(<8 x i32>* %A) {
61entry:
62  %L = load <8 x i32>, <8 x i32>* %A, align 8
63  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
64  %E = extractelement <8 x i32> %L, i32 1
65  ret void
66}
67
68; CHECK-LABEL: @extract_user_undef_index(
69; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
70define void @extract_user_undef_index(<8 x i32>* %A) {
71entry:
72  %L = load <8 x i32>, <8 x i32>* %A, align 8
73  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
74  %E = extractelement <8 x i32> %L, i32 undef
75  ret void
76}
77
78; CHECK-LABEL: @extract_user_var_index(
79; CHECK-NOT: %ldN = call { <4 x i32>, <4 x i32> } @llvm.aarch64.neon.ld2.v4i32.p0v4i32
80define void @extract_user_var_index(<8 x i32>* %A, i32 %I) {
81entry:
82  %L = load <8 x i32>, <8 x i32>* %A, align 8
83  %S = shufflevector <8 x i32> %L, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
84  %E = extractelement <8 x i32> %L, i32 %I
85  ret void
86}
87