xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/combine-build-vector.mir (revision ac321cbb0350996ceef4e6d9e8a1035880609288)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -o - -mtriple=aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s
3---
4name:            full_extracts_from_build_vector
5alignment:       4
6tracksRegLiveness: true
7liveins:
8  - { reg: '$x0' }
9  - { reg: '$x1' }
10frameInfo:
11  maxAlignment:    1
12  maxCallFrameSize: 0
13machineFunctionInfo: {}
14body:             |
15  bb.0:
16    liveins: $x0, $x1
17
18    ; CHECK-LABEL: name: full_extracts_from_build_vector
19    ; CHECK: liveins: $x0, $x1
20    ; CHECK-NEXT: {{  $}}
21    ; CHECK-NEXT: %arg1:_(s64) = COPY $x0
22    ; CHECK-NEXT: %arg2:_(s64) = COPY $x1
23    ; CHECK-NEXT: $x0 = COPY %arg1(s64)
24    ; CHECK-NEXT: $x1 = COPY %arg2(s64)
25    ; CHECK-NEXT: RET_ReallyLR implicit $x0
26    %arg1:_(s64) = COPY $x0
27    %arg2:_(s64) = COPY $x1
28    %zero:_(s64) = G_CONSTANT i64 0
29    %one:_(s64) = G_CONSTANT i64 1
30    %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
31    %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64)
32    %extract2:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64)
33    $x0 = COPY %extract(s64)
34    $x1 = COPY %extract2(s64)
35    RET_ReallyLR implicit $x0
36
37...
38---
39name:            full_extracts_from_build_vector_other_use
40alignment:       4
41tracksRegLiveness: true
42liveins:
43  - { reg: '$x0' }
44  - { reg: '$x1' }
45frameInfo:
46  maxAlignment:    1
47  maxCallFrameSize: 0
48machineFunctionInfo: {}
49body:             |
50  bb.0:
51    liveins: $x0, $x1
52
53    ; CHECK-LABEL: name: full_extracts_from_build_vector_other_use
54    ; CHECK: liveins: $x0, $x1
55    ; CHECK-NEXT: {{  $}}
56    ; CHECK-NEXT: %arg1:_(s64) = COPY $x0
57    ; CHECK-NEXT: %arg2:_(s64) = COPY $x1
58    ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0
59    ; CHECK-NEXT: %one:_(s64) = G_CONSTANT i64 1
60    ; CHECK-NEXT: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
61    ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64)
62    ; CHECK-NEXT: %extract2:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64)
63    ; CHECK-NEXT: $x0 = COPY %extract(s64)
64    ; CHECK-NEXT: $x1 = COPY %extract2(s64)
65    ; CHECK-NEXT: $q0 = COPY %bv(<2 x s64>)
66    ; CHECK-NEXT: RET_ReallyLR implicit $x0
67    %arg1:_(s64) = COPY $x0
68    %arg2:_(s64) = COPY $x1
69    %zero:_(s64) = G_CONSTANT i64 0
70    %one:_(s64) = G_CONSTANT i64 1
71    %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
72    %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64)
73    %extract2:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64)
74    $x0 = COPY %extract(s64)
75    $x1 = COPY %extract2(s64)
76    $q0 = COPY %bv(<2 x s64>)
77    RET_ReallyLR implicit $x0
78
79...
80---
81name:            partial_extracts_from_build_vector_multiple_per_elt
82alignment:       4
83tracksRegLiveness: true
84liveins:
85  - { reg: '$x0' }
86  - { reg: '$x1' }
87frameInfo:
88  maxAlignment:    1
89  maxCallFrameSize: 0
90machineFunctionInfo: {}
91body:             |
92  bb.0:
93    liveins: $x0, $x1
94
95    ; CHECK-LABEL: name: partial_extracts_from_build_vector_multiple_per_elt
96    ; CHECK: liveins: $x0, $x1
97    ; CHECK-NEXT: {{  $}}
98    ; CHECK-NEXT: %arg1:_(s64) = COPY $x0
99    ; CHECK-NEXT: %arg2:_(s64) = COPY $x1
100    ; CHECK-NEXT: $x0 = COPY %arg1(s64)
101    ; CHECK-NEXT: $x1 = COPY %arg2(s64)
102    ; CHECK-NEXT: $x2 = COPY %arg2(s64)
103    ; CHECK-NEXT: RET_ReallyLR implicit $x0
104    %arg1:_(s64) = COPY $x0
105    %arg2:_(s64) = COPY $x1
106    %zero:_(s64) = G_CONSTANT i64 0
107    %one:_(s64) = G_CONSTANT i64 1
108    %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
109    %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64)
110    %extract2:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64)
111    %extract3:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64)
112    $x0 = COPY %extract(s64)
113    $x1 = COPY %extract2(s64)
114    $x2 = COPY %extract3(s64)
115    RET_ReallyLR implicit $x0
116
117...
118---
119name:            full_extracts_from_build_vector_idx_out_of_range
120alignment:       4
121tracksRegLiveness: true
122liveins:
123  - { reg: '$x0' }
124  - { reg: '$x1' }
125frameInfo:
126  maxAlignment:    1
127  maxCallFrameSize: 0
128machineFunctionInfo: {}
129body:             |
130  bb.0:
131    liveins: $x0, $x1
132
133    ; CHECK-LABEL: name: full_extracts_from_build_vector_idx_out_of_range
134    ; CHECK: liveins: $x0, $x1
135    ; CHECK-NEXT: {{  $}}
136    ; CHECK-NEXT: %arg1:_(s64) = COPY $x0
137    ; CHECK-NEXT: %extract2:_(s64) = G_IMPLICIT_DEF
138    ; CHECK-NEXT: $x0 = COPY %arg1(s64)
139    ; CHECK-NEXT: $x1 = COPY %extract2(s64)
140    ; CHECK-NEXT: RET_ReallyLR implicit $x0
141    %arg1:_(s64) = COPY $x0
142    %arg2:_(s64) = COPY $x1
143    %zero:_(s64) = G_CONSTANT i64 0
144    %one:_(s64) = G_CONSTANT i64 1
145    %two:_(s64) = G_CONSTANT i64 2
146    %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)
147    %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64)
148    %extract2:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %two(s64)
149    $x0 = COPY %extract(s64)
150    $x1 = COPY %extract2(s64)
151    RET_ReallyLR implicit $x0
152
153...
154