1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming < %s | FileCheck %s
4 ; RUN: llc -force-streaming-compatible < %s | FileCheck %s --check-prefix=NONEON-NOSVE
6 target triple = "aarch64-unknown-linux-gnu"
12 define half @extractelement_v2f16(<2 x half> %op1) {
13 ; CHECK-LABEL: extractelement_v2f16:
15 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
16 ; CHECK-NEXT: mov z0.h, z0.h[1]
17 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
20 ; NONEON-NOSVE-LABEL: extractelement_v2f16:
21 ; NONEON-NOSVE: // %bb.0:
22 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
23 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
24 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
25 ; NONEON-NOSVE-NEXT: ldr h0, [sp, #10]
26 ; NONEON-NOSVE-NEXT: add sp, sp, #16
27 ; NONEON-NOSVE-NEXT: ret
28 %r = extractelement <2 x half> %op1, i64 1
32 define half @extractelement_v4f16(<4 x half> %op1) {
33 ; CHECK-LABEL: extractelement_v4f16:
35 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
36 ; CHECK-NEXT: mov z0.h, z0.h[3]
37 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
40 ; NONEON-NOSVE-LABEL: extractelement_v4f16:
41 ; NONEON-NOSVE: // %bb.0:
42 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
43 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
44 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
45 ; NONEON-NOSVE-NEXT: ldr h0, [sp, #14]
46 ; NONEON-NOSVE-NEXT: add sp, sp, #16
47 ; NONEON-NOSVE-NEXT: ret
48 %r = extractelement <4 x half> %op1, i64 3
52 define half @extractelement_v8f16(<8 x half> %op1) {
53 ; CHECK-LABEL: extractelement_v8f16:
55 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
56 ; CHECK-NEXT: mov z0.h, z0.h[7]
57 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
60 ; NONEON-NOSVE-LABEL: extractelement_v8f16:
61 ; NONEON-NOSVE: // %bb.0:
62 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
63 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
64 ; NONEON-NOSVE-NEXT: ldr h0, [sp, #14]
65 ; NONEON-NOSVE-NEXT: add sp, sp, #16
66 ; NONEON-NOSVE-NEXT: ret
67 %r = extractelement <8 x half> %op1, i64 7
71 define half @extractelement_v16f16(ptr %a) {
72 ; CHECK-LABEL: extractelement_v16f16:
74 ; CHECK-NEXT: ldr q0, [x0, #16]
75 ; CHECK-NEXT: mov z0.h, z0.h[7]
76 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
79 ; NONEON-NOSVE-LABEL: extractelement_v16f16:
80 ; NONEON-NOSVE: // %bb.0:
81 ; NONEON-NOSVE-NEXT: ldr q0, [x0, #16]
82 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
83 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
84 ; NONEON-NOSVE-NEXT: ldr h0, [sp, #14]
85 ; NONEON-NOSVE-NEXT: add sp, sp, #16
86 ; NONEON-NOSVE-NEXT: ret
87 %op1 = load <16 x half>, ptr %a
88 %r = extractelement <16 x half> %op1, i64 15
92 define float @extractelement_v2f32(<2 x float> %op1) {
93 ; CHECK-LABEL: extractelement_v2f32:
95 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
96 ; CHECK-NEXT: mov z0.s, z0.s[1]
97 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
100 ; NONEON-NOSVE-LABEL: extractelement_v2f32:
101 ; NONEON-NOSVE: // %bb.0:
102 ; NONEON-NOSVE-NEXT: sub sp, sp, #16
103 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
104 ; NONEON-NOSVE-NEXT: str d0, [sp, #8]
105 ; NONEON-NOSVE-NEXT: ldr s0, [sp, #12]
106 ; NONEON-NOSVE-NEXT: add sp, sp, #16
107 ; NONEON-NOSVE-NEXT: ret
108 %r = extractelement <2 x float> %op1, i64 1
112 define float @extractelement_v4f32(<4 x float> %op1) {
113 ; CHECK-LABEL: extractelement_v4f32:
115 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
116 ; CHECK-NEXT: mov z0.s, z0.s[3]
117 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
120 ; NONEON-NOSVE-LABEL: extractelement_v4f32:
121 ; NONEON-NOSVE: // %bb.0:
122 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
123 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
124 ; NONEON-NOSVE-NEXT: ldr s0, [sp, #12]
125 ; NONEON-NOSVE-NEXT: add sp, sp, #16
126 ; NONEON-NOSVE-NEXT: ret
127 %r = extractelement <4 x float> %op1, i64 3
131 define float @extractelement_v8f32(ptr %a) {
132 ; CHECK-LABEL: extractelement_v8f32:
134 ; CHECK-NEXT: ldr q0, [x0, #16]
135 ; CHECK-NEXT: mov z0.s, z0.s[3]
136 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
139 ; NONEON-NOSVE-LABEL: extractelement_v8f32:
140 ; NONEON-NOSVE: // %bb.0:
141 ; NONEON-NOSVE-NEXT: ldr q0, [x0, #16]
142 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
143 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
144 ; NONEON-NOSVE-NEXT: ldr s0, [sp, #12]
145 ; NONEON-NOSVE-NEXT: add sp, sp, #16
146 ; NONEON-NOSVE-NEXT: ret
147 %op1 = load <8 x float>, ptr %a
148 %r = extractelement <8 x float> %op1, i64 7
152 define double @extractelement_v1f64(<1 x double> %op1) {
153 ; CHECK-LABEL: extractelement_v1f64:
157 ; NONEON-NOSVE-LABEL: extractelement_v1f64:
158 ; NONEON-NOSVE: // %bb.0:
159 ; NONEON-NOSVE-NEXT: ret
160 %r = extractelement <1 x double> %op1, i64 0
163 define double @extractelement_v2f64(<2 x double> %op1) {
164 ; CHECK-LABEL: extractelement_v2f64:
166 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
167 ; CHECK-NEXT: mov z0.d, z0.d[1]
168 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
171 ; NONEON-NOSVE-LABEL: extractelement_v2f64:
172 ; NONEON-NOSVE: // %bb.0:
173 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
174 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
175 ; NONEON-NOSVE-NEXT: ldr d0, [sp, #8]
176 ; NONEON-NOSVE-NEXT: add sp, sp, #16
177 ; NONEON-NOSVE-NEXT: ret
178 %r = extractelement <2 x double> %op1, i64 1
182 define double @extractelement_v4f64(ptr %a) {
183 ; CHECK-LABEL: extractelement_v4f64:
185 ; CHECK-NEXT: ldr q0, [x0, #16]
186 ; CHECK-NEXT: mov z0.d, z0.d[1]
187 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
190 ; NONEON-NOSVE-LABEL: extractelement_v4f64:
191 ; NONEON-NOSVE: // %bb.0:
192 ; NONEON-NOSVE-NEXT: ldr q0, [x0, #16]
193 ; NONEON-NOSVE-NEXT: str q0, [sp, #-16]!
194 ; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16
195 ; NONEON-NOSVE-NEXT: ldr d0, [sp, #8]
196 ; NONEON-NOSVE-NEXT: add sp, sp, #16
197 ; NONEON-NOSVE-NEXT: ret
198 %op1 = load <4 x double>, ptr %a
199 %r = extractelement <4 x double> %op1, i64 3