1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - -march=aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s
4 name: extract_from_build_vector
6 tracksRegLiveness: true
13 machineFunctionInfo: {}
18 ; CHECK-LABEL: name: extract_from_build_vector
19 ; CHECK: liveins: $x0, $x1
20 ; CHECK: %arg1:_(s64) = COPY $x0
21 ; CHECK: $x0 = COPY %arg1(s64)
22 ; CHECK: RET_ReallyLR implicit $x0
23 %arg1:_(s64) = COPY $x0
24 %arg2:_(s64) = COPY $x1
25 %zero:_(s32) = G_CONSTANT i32 0
26 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
27 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s32)
28 $x0 = COPY %extract(s64)
29 RET_ReallyLR implicit $x0
33 name: extract_from_build_vector_idx1
35 tracksRegLiveness: true
42 machineFunctionInfo: {}
47 ; CHECK-LABEL: name: extract_from_build_vector_idx1
48 ; CHECK: liveins: $x0, $x1
49 ; CHECK: %arg2:_(s64) = COPY $x1
50 ; CHECK: $x0 = COPY %arg2(s64)
51 ; CHECK: RET_ReallyLR implicit $x0
52 %arg1:_(s64) = COPY $x0
53 %arg2:_(s64) = COPY $x1
54 %one:_(s32) = G_CONSTANT i32 1
55 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
56 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s32)
57 $x0 = COPY %extract(s64)
58 RET_ReallyLR implicit $x0
62 name: extract_from_build_vector_idx_invalid
64 tracksRegLiveness: true
71 machineFunctionInfo: {}
76 ; CHECK-LABEL: name: extract_from_build_vector_idx_invalid
77 ; CHECK: liveins: $x0, $x1
78 ; CHECK: %arg1:_(s64) = COPY $x0
79 ; CHECK: %arg2:_(s64) = COPY $x1
80 ; CHECK: %idx:_(s32) = G_CONSTANT i32 4
81 ; CHECK: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
82 ; CHECK: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s32)
83 ; CHECK: $x0 = COPY %extract(s64)
84 ; CHECK: RET_ReallyLR implicit $x0
85 %arg1:_(s64) = COPY $x0
86 %arg2:_(s64) = COPY $x1
87 %idx:_(s32) = G_CONSTANT i32 4
88 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
89 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s32)
90 $x0 = COPY %extract(s64)
91 RET_ReallyLR implicit $x0
95 name: extract_from_build_vector_trunc
97 tracksRegLiveness: true
104 machineFunctionInfo: {}
109 ; CHECK-LABEL: name: extract_from_build_vector_trunc
110 ; CHECK: liveins: $x0, $x1
111 ; CHECK: %arg1:_(s64) = COPY $x0
112 ; CHECK: %extract:_(s32) = G_TRUNC %arg1(s64)
113 ; CHECK: $w0 = COPY %extract(s32)
114 ; CHECK: RET_ReallyLR implicit $w0
115 %arg1:_(s64) = COPY $x0
116 %arg2:_(s64) = COPY $x1
117 %zero:_(s32) = G_CONSTANT i32 0
118 %bv:_(<2 x s32>) = G_BUILD_VECTOR_TRUNC %arg1(s64), %arg2(s64)
119 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %bv(<2 x s32>), %zero(s32)
120 $w0 = COPY %extract(s32)
121 RET_ReallyLR implicit $w0
125 name: extract_from_build_vector_multiple_uses
127 tracksRegLiveness: true
134 machineFunctionInfo: {}
139 ; CHECK-LABEL: name: extract_from_build_vector_multiple_uses
140 ; CHECK: liveins: $x0, $x1
141 ; CHECK: %arg1:_(s64) = COPY $x0
142 ; CHECK: %arg2:_(s64) = COPY $x1
143 ; CHECK: %zero:_(s32) = G_CONSTANT i32 0
144 ; CHECK: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
145 ; CHECK: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s32)
146 ; CHECK: $x0 = COPY %extract(s64)
147 ; CHECK: $q0 = COPY %bv(<2 x s64>)
148 ; CHECK: RET_ReallyLR implicit $x0
149 %arg1:_(s64) = COPY $x0
150 %arg2:_(s64) = COPY $x1
151 %zero:_(s32) = G_CONSTANT i32 0
152 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
153 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s32)
154 $x0 = COPY %extract(s64)
155 $q0 = COPY %bv(<2 x s64>)
156 RET_ReallyLR implicit $x0
160 name: extract_from_insert
162 tracksRegLiveness: true
171 ; This test checks that this combine runs after the insertvec->build_vector
173 ; CHECK-LABEL: name: extract_from_insert
174 ; CHECK: liveins: $x0, $x1
175 ; CHECK: %arg1:_(s64) = COPY $x0
176 ; CHECK: $x0 = COPY %arg1(s64)
177 ; CHECK: RET_ReallyLR implicit $x0
178 %arg1:_(s64) = COPY $x0
179 %arg2:_(s64) = COPY $x1
180 %undef:_(<2 x s64>) = G_IMPLICIT_DEF
181 %zero:_(s32) = G_CONSTANT i32 0
182 %one:_(s32) = G_CONSTANT i32 1
183 %ins1:_(<2 x s64>) = G_INSERT_VECTOR_ELT %undef, %arg1(s64), %zero(s32)
184 %ins2:_(<2 x s64>) = G_INSERT_VECTOR_ELT %ins1, %arg2(s64), %one(s32)
185 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %ins2(<2 x s64>), %zero(s32)
186 $x0 = COPY %extract(s64)
187 RET_ReallyLR implicit $x0