OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 if (!CpuFeatures::IsSupported(AVX)) return; | 1271 if (!CpuFeatures::IsSupported(AVX)) return; |
1272 | 1272 |
1273 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 1273 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
1274 HandleScope scope(isolate); | 1274 HandleScope scope(isolate); |
1275 v8::internal::byte buffer[1024]; | 1275 v8::internal::byte buffer[1024]; |
1276 Assembler assm(isolate, buffer, sizeof(buffer)); | 1276 Assembler assm(isolate, buffer, sizeof(buffer)); |
1277 { | 1277 { |
1278 CpuFeatureScope avx_scope(&assm, AVX); | 1278 CpuFeatureScope avx_scope(&assm, AVX); |
1279 Label exit; | 1279 Label exit; |
1280 // arguments in xmm0, xmm1 and xmm2 | 1280 // arguments in xmm0, xmm1 and xmm2 |
| 1281 __ subq(rsp, Immediate(kDoubleSize * 2)); // For memory operand |
| 1282 |
| 1283 __ movl(rdx, Immediate(0xc2f64000)); // -123.125 |
| 1284 __ vmovd(xmm4, rdx); |
| 1285 __ vmovss(Operand(rsp, 0), xmm4); |
| 1286 __ vmovss(xmm5, Operand(rsp, 0)); |
| 1287 __ vmovd(rcx, xmm5); |
| 1288 __ cmpl(rcx, rdx); |
| 1289 __ movl(rax, Immediate(9)); |
| 1290 __ j(not_equal, &exit); |
| 1291 |
1281 __ movl(rax, Immediate(0)); | 1292 __ movl(rax, Immediate(0)); |
1282 | |
1283 __ vmaxss(xmm3, xmm0, xmm1); | 1293 __ vmaxss(xmm3, xmm0, xmm1); |
1284 __ vucomiss(xmm3, xmm1); | 1294 __ vucomiss(xmm3, xmm1); |
1285 __ j(parity_even, &exit); | 1295 __ j(parity_even, &exit); |
1286 __ j(not_equal, &exit); | 1296 __ j(not_equal, &exit); |
1287 __ movl(rax, Immediate(1)); | 1297 __ movl(rax, Immediate(1)); |
1288 | 1298 |
1289 __ vminss(xmm3, xmm1, xmm2); | 1299 __ vminss(xmm3, xmm1, xmm2); |
1290 __ vucomiss(xmm3, xmm1); | 1300 __ vucomiss(xmm3, xmm1); |
1291 __ j(parity_even, &exit); | 1301 __ j(parity_even, &exit); |
1292 __ j(not_equal, &exit); | 1302 __ j(not_equal, &exit); |
(...skipping 20 matching lines...) Expand all Loading... |
1313 __ vdivss(xmm3, xmm0, xmm1); | 1323 __ vdivss(xmm3, xmm0, xmm1); |
1314 __ vmulss(xmm3, xmm3, xmm2); | 1324 __ vmulss(xmm3, xmm3, xmm2); |
1315 __ vmulss(xmm3, xmm3, xmm1); | 1325 __ vmulss(xmm3, xmm3, xmm1); |
1316 __ vucomiss(xmm3, xmm2); | 1326 __ vucomiss(xmm3, xmm2); |
1317 __ j(parity_even, &exit); | 1327 __ j(parity_even, &exit); |
1318 __ j(not_equal, &exit); | 1328 __ j(not_equal, &exit); |
1319 __ movl(rax, Immediate(6)); | 1329 __ movl(rax, Immediate(6)); |
1320 | 1330 |
1321 // result in eax | 1331 // result in eax |
1322 __ bind(&exit); | 1332 __ bind(&exit); |
| 1333 __ addq(rsp, Immediate(kDoubleSize * 2)); |
1323 __ ret(0); | 1334 __ ret(0); |
1324 } | 1335 } |
1325 | 1336 |
1326 CodeDesc desc; | 1337 CodeDesc desc; |
1327 assm.GetCode(&desc); | 1338 assm.GetCode(&desc); |
1328 Handle<Code> code = isolate->factory()->NewCode( | 1339 Handle<Code> code = isolate->factory()->NewCode( |
1329 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1340 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1330 #ifdef OBJECT_PRINT | 1341 #ifdef OBJECT_PRINT |
1331 OFStream os(stdout); | 1342 OFStream os(stdout); |
1332 code->Print(os); | 1343 code->Print(os); |
(...skipping 27 matching lines...) Expand all Loading... |
1360 __ vmovsd(xmm6, xmm5); | 1371 __ vmovsd(xmm6, xmm5); |
1361 __ vmovapd(xmm3, xmm6); | 1372 __ vmovapd(xmm3, xmm6); |
1362 | 1373 |
1363 // Test vcvtss2sd & vcvtsd2ss | 1374 // Test vcvtss2sd & vcvtsd2ss |
1364 __ movl(rax, Immediate(9)); | 1375 __ movl(rax, Immediate(9)); |
1365 __ movq(rdx, V8_INT64_C(0x426D1A0000000000)); | 1376 __ movq(rdx, V8_INT64_C(0x426D1A0000000000)); |
1366 __ movq(Operand(rsp, 0), rdx); | 1377 __ movq(Operand(rsp, 0), rdx); |
1367 __ vcvtsd2ss(xmm6, xmm6, Operand(rsp, 0)); | 1378 __ vcvtsd2ss(xmm6, xmm6, Operand(rsp, 0)); |
1368 __ vcvtss2sd(xmm7, xmm6, xmm6); | 1379 __ vcvtss2sd(xmm7, xmm6, xmm6); |
1369 __ vcvtsd2ss(xmm8, xmm7, xmm7); | 1380 __ vcvtsd2ss(xmm8, xmm7, xmm7); |
1370 __ movss(Operand(rsp, 0), xmm8); | 1381 __ vmovss(Operand(rsp, 0), xmm8); |
1371 __ vcvtss2sd(xmm9, xmm8, Operand(rsp, 0)); | 1382 __ vcvtss2sd(xmm9, xmm8, Operand(rsp, 0)); |
1372 __ vmovq(rcx, xmm9); | 1383 __ vmovq(rcx, xmm9); |
1373 __ cmpq(rcx, rdx); | 1384 __ cmpq(rcx, rdx); |
1374 __ j(not_equal, &exit); | 1385 __ j(not_equal, &exit); |
1375 | 1386 |
1376 // Test vcvttsd2si | 1387 // Test vcvttsd2si |
1377 __ movl(rax, Immediate(10)); | 1388 __ movl(rax, Immediate(10)); |
1378 __ movl(rdx, Immediate(123)); | 1389 __ movl(rdx, Immediate(123)); |
1379 __ vcvtlsi2sd(xmm6, xmm6, rdx); | 1390 __ vcvtlsi2sd(xmm6, xmm6, rdx); |
1380 __ vcvttsd2si(rcx, xmm6); | 1391 __ vcvttsd2si(rcx, xmm6); |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 | 2152 |
2142 F1 f = FUNCTION_CAST<F1>(code->entry()); | 2153 F1 f = FUNCTION_CAST<F1>(code->entry()); |
2143 for (int i = 0; i < kNumCases; ++i) { | 2154 for (int i = 0; i < kNumCases; ++i) { |
2144 int res = f(i); | 2155 int res = f(i); |
2145 PrintF("f(%d) = %d\n", i, res); | 2156 PrintF("f(%d) = %d\n", i, res); |
2146 CHECK_EQ(values[i], res); | 2157 CHECK_EQ(values[i], res); |
2147 } | 2158 } |
2148 } | 2159 } |
2149 | 2160 |
2150 #undef __ | 2161 #undef __ |
OLD | NEW |