OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 typedef struct { | 150 typedef struct { |
151 int32_t i32x4_low[4]; | 151 int32_t i32x4_low[4]; |
152 int32_t i32x4_high[4]; | 152 int32_t i32x4_high[4]; |
153 int32_t i16x8_low[8]; | 153 int32_t i16x8_low[8]; |
154 int32_t i16x8_high[8]; | 154 int32_t i16x8_high[8]; |
155 int32_t i8x16_low[16]; | 155 int32_t i8x16_low[16]; |
156 int32_t i8x16_high[16]; | 156 int32_t i8x16_high[16]; |
157 int32_t f32x4_low[4]; | 157 int32_t f32x4_low[4]; |
158 int32_t f32x4_high[4]; | 158 int32_t f32x4_high[4]; |
| 159 int32_t i8x16_low_d[16]; |
| 160 int32_t i8x16_high_d[16]; |
159 } T; | 161 } T; |
160 T t; | 162 T t; |
161 | 163 |
162 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit()); | 164 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit()); |
163 | 165 |
164 for (int i = 0; i < 4; i++) { | 166 for (int i = 0; i < 4; i++) { |
165 __ mov(r4, Operand(i)); | 167 __ mov(r4, Operand(i)); |
166 __ vdup(Neon32, q1, r4); | 168 __ vdup(Neon32, q1, r4); |
167 __ ExtractLane(r5, q1, NeonS32, i); | 169 __ ExtractLane(r5, q1, NeonS32, i); |
168 __ str(r5, MemOperand(r0, offsetof(T, i32x4_low) + 4 * i)); | 170 __ str(r5, MemOperand(r0, offsetof(T, i32x4_low) + 4 * i)); |
169 SwVfpRegister si = SwVfpRegister::from_code(i); | 171 SwVfpRegister si = SwVfpRegister::from_code(i); |
170 __ ExtractLane(si, q1, r4, i); | 172 __ ExtractLane(si, q1, r4, i); |
171 __ vstr(si, r0, offsetof(T, f32x4_low) + 4 * i); | 173 __ vstr(si, r0, offsetof(T, f32x4_low) + 4 * i); |
172 } | 174 } |
173 | 175 |
174 for (int i = 0; i < 8; i++) { | 176 for (int i = 0; i < 8; i++) { |
175 __ mov(r4, Operand(i)); | 177 __ mov(r4, Operand(i)); |
176 __ vdup(Neon16, q1, r4); | 178 __ vdup(Neon16, q1, r4); |
177 __ ExtractLane(r5, q1, NeonS16, i); | 179 __ ExtractLane(r5, q1, NeonS16, i); |
178 __ str(r5, MemOperand(r0, offsetof(T, i16x8_low) + 4 * i)); | 180 __ str(r5, MemOperand(r0, offsetof(T, i16x8_low) + 4 * i)); |
179 } | 181 } |
180 | 182 |
181 for (int i = 0; i < 16; i++) { | 183 for (int i = 0; i < 16; i++) { |
182 __ mov(r4, Operand(i)); | 184 __ mov(r4, Operand(i)); |
183 __ vdup(Neon8, q1, r4); | 185 __ vdup(Neon8, q1, r4); |
184 __ ExtractLane(r5, q1, NeonS8, i); | 186 __ ExtractLane(r5, q1, NeonS8, i); |
185 __ str(r5, MemOperand(r0, offsetof(T, i8x16_low) + 4 * i)); | 187 __ str(r5, MemOperand(r0, offsetof(T, i8x16_low) + 4 * i)); |
186 } | 188 } |
187 | 189 |
| 190 for (int i = 0; i < 8; i++) { |
| 191 __ mov(r4, Operand(i)); |
| 192 __ vdup(Neon8, q1, r4); // q1 = d2,d3 |
| 193 __ ExtractLane(r5, d2, NeonS8, i); |
| 194 __ str(r5, MemOperand(r0, offsetof(T, i8x16_low_d) + 4 * i)); |
| 195 __ ExtractLane(r5, d3, NeonS8, i); |
| 196 __ str(r5, MemOperand(r0, offsetof(T, i8x16_low_d) + 4 * (i + 8))); |
| 197 } |
| 198 |
188 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 199 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
189 for (int i = 0; i < 4; i++) { | 200 for (int i = 0; i < 4; i++) { |
190 __ mov(r4, Operand(-i)); | 201 __ mov(r4, Operand(-i)); |
191 __ vdup(Neon32, q15, r4); | 202 __ vdup(Neon32, q15, r4); |
192 __ ExtractLane(r5, q15, NeonS32, i); | 203 __ ExtractLane(r5, q15, NeonS32, i); |
193 __ str(r5, MemOperand(r0, offsetof(T, i32x4_high) + 4 * i)); | 204 __ str(r5, MemOperand(r0, offsetof(T, i32x4_high) + 4 * i)); |
194 SwVfpRegister si = SwVfpRegister::from_code(i); | 205 SwVfpRegister si = SwVfpRegister::from_code(i); |
195 __ ExtractLane(si, q15, r4, i); | 206 __ ExtractLane(si, q15, r4, i); |
196 __ vstr(si, r0, offsetof(T, f32x4_high) + 4 * i); | 207 __ vstr(si, r0, offsetof(T, f32x4_high) + 4 * i); |
197 } | 208 } |
198 | 209 |
199 for (int i = 0; i < 8; i++) { | 210 for (int i = 0; i < 8; i++) { |
200 __ mov(r4, Operand(-i)); | 211 __ mov(r4, Operand(-i)); |
201 __ vdup(Neon16, q15, r4); | 212 __ vdup(Neon16, q15, r4); |
202 __ ExtractLane(r5, q15, NeonS16, i); | 213 __ ExtractLane(r5, q15, NeonS16, i); |
203 __ str(r5, MemOperand(r0, offsetof(T, i16x8_high) + 4 * i)); | 214 __ str(r5, MemOperand(r0, offsetof(T, i16x8_high) + 4 * i)); |
204 } | 215 } |
205 | 216 |
206 for (int i = 0; i < 16; i++) { | 217 for (int i = 0; i < 16; i++) { |
207 __ mov(r4, Operand(-i)); | 218 __ mov(r4, Operand(-i)); |
208 __ vdup(Neon8, q15, r4); | 219 __ vdup(Neon8, q15, r4); |
209 __ ExtractLane(r5, q15, NeonS8, i); | 220 __ ExtractLane(r5, q15, NeonS8, i); |
210 __ str(r5, MemOperand(r0, offsetof(T, i8x16_high) + 4 * i)); | 221 __ str(r5, MemOperand(r0, offsetof(T, i8x16_high) + 4 * i)); |
211 } | 222 } |
| 223 |
| 224 for (int i = 0; i < 8; i++) { |
| 225 __ mov(r4, Operand(-i)); |
| 226 __ vdup(Neon8, q15, r4); // q1 = d30,d31 |
| 227 __ ExtractLane(r5, d30, NeonS8, i); |
| 228 __ str(r5, MemOperand(r0, offsetof(T, i8x16_high_d) + 4 * i)); |
| 229 __ ExtractLane(r5, d31, NeonS8, i); |
| 230 __ str(r5, MemOperand(r0, offsetof(T, i8x16_high_d) + 4 * (i + 8))); |
| 231 } |
212 } | 232 } |
213 | 233 |
214 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit()); | 234 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit()); |
215 | 235 |
216 CodeDesc desc; | 236 CodeDesc desc; |
217 masm->GetCode(&desc); | 237 masm->GetCode(&desc); |
218 Handle<Code> code = isolate->factory()->NewCode( | 238 Handle<Code> code = isolate->factory()->NewCode( |
219 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 239 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
220 #ifdef DEBUG | 240 #ifdef DEBUG |
221 OFStream os(stdout); | 241 OFStream os(stdout); |
222 code->Print(os); | 242 code->Print(os); |
223 #endif | 243 #endif |
224 F3 f = FUNCTION_CAST<F3>(code->entry()); | 244 F3 f = FUNCTION_CAST<F3>(code->entry()); |
225 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 245 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
226 USE(dummy); | 246 USE(dummy); |
227 for (int i = 0; i < 4; i++) { | 247 for (int i = 0; i < 4; i++) { |
228 CHECK_EQ(i, t.i32x4_low[i]); | 248 CHECK_EQ(i, t.i32x4_low[i]); |
229 CHECK_EQ(i, t.f32x4_low[i]); | 249 CHECK_EQ(i, t.f32x4_low[i]); |
230 } | 250 } |
231 for (int i = 0; i < 8; i++) { | 251 for (int i = 0; i < 8; i++) { |
232 CHECK_EQ(i, t.i16x8_low[i]); | 252 CHECK_EQ(i, t.i16x8_low[i]); |
233 } | 253 } |
234 for (int i = 0; i < 16; i++) { | 254 for (int i = 0; i < 16; i++) { |
235 CHECK_EQ(i, t.i8x16_low[i]); | 255 CHECK_EQ(i, t.i8x16_low[i]); |
236 } | 256 } |
| 257 for (int i = 0; i < 8; i++) { |
| 258 CHECK_EQ(i, t.i8x16_low_d[i]); |
| 259 CHECK_EQ(i, t.i8x16_low_d[i + 8]); |
| 260 } |
237 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 261 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
238 for (int i = 0; i < 4; i++) { | 262 for (int i = 0; i < 4; i++) { |
239 CHECK_EQ(-i, t.i32x4_high[i]); | 263 CHECK_EQ(-i, t.i32x4_high[i]); |
240 CHECK_EQ(-i, t.f32x4_high[i]); | 264 CHECK_EQ(-i, t.f32x4_high[i]); |
241 } | 265 } |
242 for (int i = 0; i < 8; i++) { | 266 for (int i = 0; i < 8; i++) { |
243 CHECK_EQ(-i, t.i16x8_high[i]); | 267 CHECK_EQ(-i, t.i16x8_high[i]); |
244 } | 268 } |
245 for (int i = 0; i < 16; i++) { | 269 for (int i = 0; i < 16; i++) { |
246 CHECK_EQ(-i, t.i8x16_high[i]); | 270 CHECK_EQ(-i, t.i8x16_high[i]); |
247 } | 271 } |
| 272 for (int i = 0; i < 8; i++) { |
| 273 CHECK_EQ(-i, t.i8x16_high_d[i]); |
| 274 CHECK_EQ(-i, t.i8x16_high_d[i + 8]); |
| 275 } |
248 } | 276 } |
249 } | 277 } |
250 | 278 |
251 TEST(ReplaceLane) { | 279 TEST(ReplaceLane) { |
252 if (!CpuFeatures::IsSupported(NEON)) return; | 280 if (!CpuFeatures::IsSupported(NEON)) return; |
253 | 281 |
254 // Allocate an executable page of memory. | 282 // Allocate an executable page of memory. |
255 size_t actual_size; | 283 size_t actual_size; |
256 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( | 284 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( |
257 Assembler::kMinimalBufferSize, &actual_size, true)); | 285 Assembler::kMinimalBufferSize, &actual_size, true)); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 CHECK_EQ_32X4(_32x4_1111, 1, 1, 1, 1); | 510 CHECK_EQ_32X4(_32x4_1111, 1, 1, 1, 1); |
483 CHECK_EQ_32X4(_32x4_2222, 2, 2, 2, 2); | 511 CHECK_EQ_32X4(_32x4_2222, 2, 2, 2, 2); |
484 CHECK_EQ_32X4(_32x4_3333, 3, 3, 3, 3); | 512 CHECK_EQ_32X4(_32x4_3333, 3, 3, 3, 3); |
485 CHECK_EQ_32X4(_32x4_2103, 3, 0, 1, 2); | 513 CHECK_EQ_32X4(_32x4_2103, 3, 0, 1, 2); |
486 CHECK_EQ_32X4(_32x4_0321, 1, 2, 3, 0); | 514 CHECK_EQ_32X4(_32x4_0321, 1, 2, 3, 0); |
487 CHECK_EQ_32X4(_32x4_1132, 2, 3, 1, 1); | 515 CHECK_EQ_32X4(_32x4_1132, 2, 3, 1, 1); |
488 CHECK_EQ_32X4(_32x4_1132_in_place, 2, 3, 1, 1); | 516 CHECK_EQ_32X4(_32x4_1132_in_place, 2, 3, 1, 1); |
489 } | 517 } |
490 | 518 |
491 #undef __ | 519 #undef __ |
OLD | NEW |