Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: test/cctest/test-assembler-x64.cc

Issue 2161513002: [x64] add Absps/d and Negps/d macro (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 __ pslld(xmm15, 1); 2309 __ pslld(xmm15, 1);
2310 __ movq(rax, xmm15); 2310 __ movq(rax, xmm15);
2311 __ ret(0); 2311 __ ret(0);
2312 2312
2313 CodeDesc desc; 2313 CodeDesc desc;
2314 assm.GetCode(&desc); 2314 assm.GetCode(&desc);
2315 uint64_t result = FUNCTION_CAST<F5>(buffer)(V8_UINT64_C(0x1122334455667788)); 2315 uint64_t result = FUNCTION_CAST<F5>(buffer)(V8_UINT64_C(0x1122334455667788));
2316 CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result); 2316 CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result);
2317 } 2317 }
2318 2318
2319
2320 typedef float(*F9)(float x);
2321 TEST(AssemblerX64Float32x4Abs) {
2322 CcTest::InitializeVM();
2323
2324 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
2325 HandleScope scope(isolate);
2326 v8::internal::byte buffer[256];
2327 MacroAssembler assm(isolate, buffer, sizeof(buffer),
2328 v8::internal::CodeObjectRequired::kYes);
2329 {
2330 __ shufps(xmm0, xmm0, 0x0); // brocast first argument
2331 __ Absps(xmm0);
2332 __ ret(0);
2333 }
2334
2335 CodeDesc desc;
2336 assm.GetCode(&desc);
2337 Handle<Code> code = isolate->factory()->NewCode(
2338 desc,
2339 Code::ComputeFlags(Code::STUB),
2340 Handle<Code>());
2341 #ifdef OBJECT_PRINT
2342 OFStream os(stdout);
2343 code->Print(os);
2344 #endif
2345
2346 F9 f = FUNCTION_CAST<F9>(code->entry());
2347 CHECK_EQ(1.5, f(-1.5));
2348 }
2349
2350
2351 TEST(AssemblerX64Float32x4Neg) {
2352 CcTest::InitializeVM();
2353
2354 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
2355 HandleScope scope(isolate);
2356 v8::internal::byte buffer[256];
2357 MacroAssembler assm(isolate, buffer, sizeof(buffer),
2358 v8::internal::CodeObjectRequired::kYes);
2359 {
2360 __ shufps(xmm0, xmm0, 0x0); // brocast first argument
2361 __ Negps(xmm0);
2362 __ ret(0);
2363 }
2364
2365 CodeDesc desc;
2366 assm.GetCode(&desc);
2367 Handle<Code> code = isolate->factory()->NewCode(
2368 desc,
2369 Code::ComputeFlags(Code::STUB),
2370 Handle<Code>());
2371 #ifdef OBJECT_PRINT
2372 OFStream os(stdout);
2373 code->Print(os);
2374 #endif
2375
2376 CHECK_EQ(-1.5, f(1.5));
2377 }
2319 #undef __ 2378 #undef __
OLDNEW
« src/x64/macro-assembler-x64.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698