1 ; RUN: llc < %s -mtriple=ve-unknown-unknown -mattr=+vpu | FileCheck %s
6 define fastcc i64 @extract_rr_v256i64(i32 signext %idx, <256 x i64> %v) {
7 ; CHECK-LABEL: extract_rr_v256i64:
9 ; CHECK-NEXT: and %s0, %s0, (32)0
10 ; CHECK-NEXT: lvs %s0, %v0(%s0)
11 ; CHECK-NEXT: b.l.t (, %s10)
12 %ret = extractelement <256 x i64> %v, i32 %idx
16 define fastcc i64 @extract_ri7_v256i64(<256 x i64> %v) {
17 ; CHECK-LABEL: extract_ri7_v256i64:
19 ; CHECK-NEXT: lvs %s0, %v0(127)
20 ; CHECK-NEXT: b.l.t (, %s10)
21 %ret = extractelement <256 x i64> %v, i32 127
25 define fastcc i64 @extract_ri8_v256i64(<256 x i64> %v) {
26 ; CHECK-LABEL: extract_ri8_v256i64:
28 ; CHECK-NEXT: lea %s0, 128
29 ; CHECK-NEXT: lvs %s0, %v0(%s0)
30 ; CHECK-NEXT: b.l.t (, %s10)
31 %ret = extractelement <256 x i64> %v, i32 128
35 define fastcc i64 @extract_ri_v512i64(<512 x i64> %v) {
36 ; CHECK-LABEL: extract_ri_v512i64:
38 ; CHECK-NEXT: lvs %s0, %v1(116)
39 ; CHECK-NEXT: b.l.t (, %s10)
40 %ret = extractelement <512 x i64> %v, i32 372
46 define fastcc i32 @extract_rr_v256i32(i32 signext %idx, <256 x i32> %v) {
47 ; CHECK-LABEL: extract_rr_v256i32:
49 ; CHECK-NEXT: and %s0, %s0, (32)0
50 ; CHECK-NEXT: lvs %s0, %v0(%s0)
51 ; CHECK-NEXT: b.l.t (, %s10)
52 %ret = extractelement <256 x i32> %v, i32 %idx
56 define fastcc i32 @extract_ri7_v256i32(<256 x i32> %v) {
57 ; CHECK-LABEL: extract_ri7_v256i32:
59 ; CHECK-NEXT: lvs %s0, %v0(127)
60 ; CHECK-NEXT: b.l.t (, %s10)
61 %ret = extractelement <256 x i32> %v, i32 127
65 define fastcc i32 @extract_ri8_v256i32(<256 x i32> %v) {
66 ; CHECK-LABEL: extract_ri8_v256i32:
68 ; CHECK-NEXT: lea %s0, 128
69 ; CHECK-NEXT: lvs %s0, %v0(%s0)
70 ; CHECK-NEXT: b.l.t (, %s10)
71 %ret = extractelement <256 x i32> %v, i32 128
75 define fastcc i32 @extract_ri_v512i32(<512 x i32> %v) {
76 ; CHECK-LABEL: extract_ri_v512i32:
78 ; CHECK-NEXT: lea %s0, 186
79 ; CHECK-NEXT: lvs %s0, %v0(%s0)
80 ; CHECK-NEXT: srl %s0, %s0, 32
81 ; CHECK-NEXT: b.l.t (, %s10)
82 %ret = extractelement <512 x i32> %v, i32 372
86 define fastcc i32 @extract_rr_v512i32(<512 x i32> %v, i32 signext %idx) {
87 ; CHECK-LABEL: extract_rr_v512i32:
89 ; CHECK-NEXT: lea %s1, -2
90 ; CHECK-NEXT: and %s1, %s1, (32)0
91 ; CHECK-NEXT: and %s1, %s0, %s1
92 ; CHECK-NEXT: srl %s1, %s1, 1
93 ; CHECK-NEXT: lvs %s1, %v0(%s1)
94 ; CHECK-NEXT: nnd %s0, %s0, (63)0
95 ; CHECK-NEXT: sla.w.sx %s0, %s0, 5
96 ; CHECK-NEXT: srl %s0, %s1, %s0
97 ; CHECK-NEXT: and %s0, %s0, (32)0
98 ; CHECK-NEXT: b.l.t (, %s10)
99 %ret = extractelement <512 x i32> %v, i32 %idx
105 define fastcc double @extract_rr_v256f64(i32 signext %idx, <256 x double> %v) {
106 ; CHECK-LABEL: extract_rr_v256f64:
108 ; CHECK-NEXT: and %s0, %s0, (32)0
109 ; CHECK-NEXT: lvs %s0, %v0(%s0)
110 ; CHECK-NEXT: b.l.t (, %s10)
111 %ret = extractelement <256 x double> %v, i32 %idx
115 define fastcc double @extract_ri7_v256f64(<256 x double> %v) {
116 ; CHECK-LABEL: extract_ri7_v256f64:
118 ; CHECK-NEXT: lvs %s0, %v0(127)
119 ; CHECK-NEXT: b.l.t (, %s10)
120 %ret = extractelement <256 x double> %v, i32 127
124 define fastcc double @extract_ri8_v256f64(<256 x double> %v) {
125 ; CHECK-LABEL: extract_ri8_v256f64:
127 ; CHECK-NEXT: lea %s0, 128
128 ; CHECK-NEXT: lvs %s0, %v0(%s0)
129 ; CHECK-NEXT: b.l.t (, %s10)
130 %ret = extractelement <256 x double> %v, i32 128
134 define fastcc double @extract_ri_v512f64(<512 x double> %v) {
135 ; CHECK-LABEL: extract_ri_v512f64:
137 ; CHECK-NEXT: lvs %s0, %v1(116)
138 ; CHECK-NEXT: b.l.t (, %s10)
139 %ret = extractelement <512 x double> %v, i32 372
145 define fastcc float @extract_rr_v256f32(i32 signext %idx, <256 x float> %v) {
146 ; CHECK-LABEL: extract_rr_v256f32:
148 ; CHECK-NEXT: and %s0, %s0, (32)0
149 ; CHECK-NEXT: lvs %s0, %v0(%s0)
150 ; CHECK-NEXT: b.l.t (, %s10)
151 %ret = extractelement <256 x float> %v, i32 %idx
155 define fastcc float @extract_ri7_v256f32(<256 x float> %v) {
156 ; CHECK-LABEL: extract_ri7_v256f32:
158 ; CHECK-NEXT: lvs %s0, %v0(127)
159 ; CHECK-NEXT: b.l.t (, %s10)
160 %ret = extractelement <256 x float> %v, i32 127
164 define fastcc float @extract_ri8_v256f32(<256 x float> %v) {
165 ; CHECK-LABEL: extract_ri8_v256f32:
167 ; CHECK-NEXT: lea %s0, 128
168 ; CHECK-NEXT: lvs %s0, %v0(%s0)
169 ; CHECK-NEXT: b.l.t (, %s10)
170 %ret = extractelement <256 x float> %v, i32 128
174 define fastcc float @extract_ri_v512f32(<512 x float> %v) {
175 ; CHECK-LABEL: extract_ri_v512f32:
177 ; CHECK-NEXT: lea %s0, 186
178 ; CHECK-NEXT: lvs %s0, %v0(%s0)
179 ; CHECK-NEXT: srl %s0, %s0, 32
180 ; CHECK-NEXT: sll %s0, %s0, 32
181 ; CHECK-NEXT: b.l.t (, %s10)
182 %ret = extractelement <512 x float> %v, i32 372
186 define fastcc float @extract_rr_v512f32(<512 x float> %v, i32 signext %idx) {
187 ; CHECK-LABEL: extract_rr_v512f32:
189 ; CHECK-NEXT: lea %s1, -2
190 ; CHECK-NEXT: and %s1, %s1, (32)0
191 ; CHECK-NEXT: and %s1, %s0, %s1
192 ; CHECK-NEXT: srl %s1, %s1, 1
193 ; CHECK-NEXT: lvs %s1, %v0(%s1)
194 ; CHECK-NEXT: nnd %s0, %s0, (63)0
195 ; CHECK-NEXT: sla.w.sx %s0, %s0, 5
196 ; CHECK-NEXT: srl %s0, %s1, %s0
197 ; CHECK-NEXT: and %s0, %s0, (32)0
198 ; CHECK-NEXT: sll %s0, %s0, 32
199 ; CHECK-NEXT: b.l.t (, %s10)
200 %ret = extractelement <512 x float> %v, i32 %idx