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

Side by Side Diff: test/cctest/test-disasm-ia32.cc

Issue 12391055: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nits Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000)); 101 __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000));
102 Handle<FixedArray> foo2 = FACTORY->NewFixedArray(10, TENURED); 102 Handle<FixedArray> foo2 = FACTORY->NewFixedArray(10, TENURED);
103 __ cmp(ebx, foo2); 103 __ cmp(ebx, foo2);
104 __ cmpb(ebx, Operand(ebp, ecx, times_2, 0)); 104 __ cmpb(ebx, Operand(ebp, ecx, times_2, 0));
105 __ cmpb(Operand(ebp, ecx, times_2, 0), ebx); 105 __ cmpb(Operand(ebp, ecx, times_2, 0), ebx);
106 __ or_(edx, 3); 106 __ or_(edx, 3);
107 __ xor_(edx, 3); 107 __ xor_(edx, 3);
108 __ nop(); 108 __ nop();
109 { 109 {
110 CHECK(CpuFeatures::IsSupported(CPUID)); 110 CHECK(CpuFeatures::IsSupported(CPUID));
111 CpuFeatures::Scope fscope(CPUID); 111 CpuFeatureScope fscope(&assm, CPUID);
112 __ cpuid(); 112 __ cpuid();
113 } 113 }
114 { 114 {
115 CHECK(CpuFeatures::IsSupported(RDTSC)); 115 CHECK(CpuFeatures::IsSupported(RDTSC));
116 CpuFeatures::Scope fscope(RDTSC); 116 CpuFeatureScope fscope(&assm, RDTSC);
117 __ rdtsc(); 117 __ rdtsc();
118 } 118 }
119 __ movsx_b(edx, ecx); 119 __ movsx_b(edx, ecx);
120 __ movsx_w(edx, ecx); 120 __ movsx_w(edx, ecx);
121 __ movzx_b(edx, ecx); 121 __ movzx_b(edx, ecx);
122 __ movzx_w(edx, ecx); 122 __ movzx_w(edx, ecx);
123 123
124 __ nop(); 124 __ nop();
125 __ imul(edx, ecx); 125 __ imul(edx, ecx);
126 __ shld(edx, ecx); 126 __ shld(edx, ecx);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 __ faddp(3); 363 __ faddp(3);
364 __ fsubp(3); 364 __ fsubp(3);
365 __ fmulp(3); 365 __ fmulp(3);
366 __ fdivp(3); 366 __ fdivp(3);
367 __ fcompp(); 367 __ fcompp();
368 __ fwait(); 368 __ fwait();
369 __ nop(); 369 __ nop();
370 { 370 {
371 if (CpuFeatures::IsSupported(SSE2)) { 371 if (CpuFeatures::IsSupported(SSE2)) {
372 CpuFeatures::Scope fscope(SSE2); 372 CpuFeatureScope fscope(&assm, SSE2);
373 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); 373 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000));
374 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); 374 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000));
375 __ addsd(xmm1, xmm0); 375 __ addsd(xmm1, xmm0);
376 __ mulsd(xmm1, xmm0); 376 __ mulsd(xmm1, xmm0);
377 __ subsd(xmm1, xmm0); 377 __ subsd(xmm1, xmm0);
378 __ divsd(xmm1, xmm0); 378 __ divsd(xmm1, xmm0);
379 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000)); 379 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000));
380 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1); 380 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1);
381 __ ucomisd(xmm0, xmm1); 381 __ ucomisd(xmm0, xmm1);
382 382
383 // 128 bit move instructions. 383 // 128 bit move instructions.
384 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); 384 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000));
385 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); 385 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0);
386 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); 386 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000));
387 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); 387 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0);
388 } 388 }
389 } 389 }
390 390
391 // cmov. 391 // cmov.
392 { 392 {
393 if (CpuFeatures::IsSupported(CMOV)) { 393 if (CpuFeatures::IsSupported(CMOV)) {
394 CpuFeatures::Scope use_cmov(CMOV); 394 CpuFeatureScope use_cmov(&assm, CMOV);
395 __ cmov(overflow, eax, Operand(eax, 0)); 395 __ cmov(overflow, eax, Operand(eax, 0));
396 __ cmov(no_overflow, eax, Operand(eax, 1)); 396 __ cmov(no_overflow, eax, Operand(eax, 1));
397 __ cmov(below, eax, Operand(eax, 2)); 397 __ cmov(below, eax, Operand(eax, 2));
398 __ cmov(above_equal, eax, Operand(eax, 3)); 398 __ cmov(above_equal, eax, Operand(eax, 3));
399 __ cmov(equal, eax, Operand(ebx, 0)); 399 __ cmov(equal, eax, Operand(ebx, 0));
400 __ cmov(not_equal, eax, Operand(ebx, 1)); 400 __ cmov(not_equal, eax, Operand(ebx, 1));
401 __ cmov(below_equal, eax, Operand(ebx, 2)); 401 __ cmov(below_equal, eax, Operand(ebx, 2));
402 __ cmov(above, eax, Operand(ebx, 3)); 402 __ cmov(above, eax, Operand(ebx, 3));
403 __ cmov(sign, eax, Operand(ecx, 0)); 403 __ cmov(sign, eax, Operand(ecx, 0));
404 __ cmov(not_sign, eax, Operand(ecx, 1)); 404 __ cmov(not_sign, eax, Operand(ecx, 1));
405 __ cmov(parity_even, eax, Operand(ecx, 2)); 405 __ cmov(parity_even, eax, Operand(ecx, 2));
406 __ cmov(parity_odd, eax, Operand(ecx, 3)); 406 __ cmov(parity_odd, eax, Operand(ecx, 3));
407 __ cmov(less, eax, Operand(edx, 0)); 407 __ cmov(less, eax, Operand(edx, 0));
408 __ cmov(greater_equal, eax, Operand(edx, 1)); 408 __ cmov(greater_equal, eax, Operand(edx, 1));
409 __ cmov(less_equal, eax, Operand(edx, 2)); 409 __ cmov(less_equal, eax, Operand(edx, 2));
410 __ cmov(greater, eax, Operand(edx, 3)); 410 __ cmov(greater, eax, Operand(edx, 3));
411 } 411 }
412 } 412 }
413 413
414 // andpd, cmpltsd, movaps, psllq, psrlq, por. 414 // andpd, cmpltsd, movaps, psllq, psrlq, por.
415 { 415 {
416 if (CpuFeatures::IsSupported(SSE2)) { 416 if (CpuFeatures::IsSupported(SSE2)) {
417 CpuFeatures::Scope fscope(SSE2); 417 CpuFeatureScope fscope(&assm, SSE2);
418 __ andpd(xmm0, xmm1); 418 __ andpd(xmm0, xmm1);
419 __ andpd(xmm1, xmm2); 419 __ andpd(xmm1, xmm2);
420 420
421 __ cmpltsd(xmm0, xmm1); 421 __ cmpltsd(xmm0, xmm1);
422 __ cmpltsd(xmm1, xmm2); 422 __ cmpltsd(xmm1, xmm2);
423 423
424 __ movaps(xmm0, xmm1); 424 __ movaps(xmm0, xmm1);
425 __ movaps(xmm1, xmm2); 425 __ movaps(xmm1, xmm2);
426 426
427 __ psllq(xmm0, 17); 427 __ psllq(xmm0, 17);
428 __ psllq(xmm1, 42); 428 __ psllq(xmm1, 42);
429 429
430 __ psllq(xmm0, xmm1); 430 __ psllq(xmm0, xmm1);
431 __ psllq(xmm1, xmm2); 431 __ psllq(xmm1, xmm2);
432 432
433 __ psrlq(xmm0, 17); 433 __ psrlq(xmm0, 17);
434 __ psrlq(xmm1, 42); 434 __ psrlq(xmm1, 42);
435 435
436 __ psrlq(xmm0, xmm1); 436 __ psrlq(xmm0, xmm1);
437 __ psrlq(xmm1, xmm2); 437 __ psrlq(xmm1, xmm2);
438 438
439 __ por(xmm0, xmm1); 439 __ por(xmm0, xmm1);
440 __ por(xmm1, xmm2); 440 __ por(xmm1, xmm2);
441 } 441 }
442 } 442 }
443 443
444 { 444 {
445 if (CpuFeatures::IsSupported(SSE2) && 445 if (CpuFeatures::IsSupported(SSE2) &&
446 CpuFeatures::IsSupported(SSE4_1)) { 446 CpuFeatures::IsSupported(SSE4_1)) {
447 CpuFeatures::Scope scope(SSE4_1); 447 CpuFeatureScope scope(&assm, SSE4_1);
448 __ pextrd(eax, xmm0, 1); 448 __ pextrd(eax, xmm0, 1);
449 __ pinsrd(xmm1, eax, 0); 449 __ pinsrd(xmm1, eax, 0);
450 } 450 }
451 } 451 }
452 452
453 // Nop instructions 453 // Nop instructions
454 for (int i = 0; i < 16; i++) { 454 for (int i = 0; i < 16; i++) {
455 __ Nop(i); 455 __ Nop(i);
456 } 456 }
457 457
458 __ ret(0); 458 __ ret(0);
459 459
460 CodeDesc desc; 460 CodeDesc desc;
461 assm.GetCode(&desc); 461 assm.GetCode(&desc);
462 Isolate* isolate = Isolate::Current(); 462 Isolate* isolate = Isolate::Current();
463 Object* code = isolate->heap()->CreateCode( 463 Object* code = isolate->heap()->CreateCode(
464 desc, 464 desc,
465 Code::ComputeFlags(Code::STUB), 465 Code::ComputeFlags(Code::STUB),
466 Handle<Code>())->ToObjectChecked(); 466 Handle<Code>())->ToObjectChecked();
467 CHECK(code->IsCode()); 467 CHECK(code->IsCode());
468 #ifdef OBJECT_PRINT 468 #ifdef OBJECT_PRINT
469 Code::cast(code)->Print(); 469 Code::cast(code)->Print();
470 byte* begin = Code::cast(code)->instruction_start(); 470 byte* begin = Code::cast(code)->instruction_start();
471 byte* end = begin + Code::cast(code)->instruction_size(); 471 byte* end = begin + Code::cast(code)->instruction_size();
472 disasm::Disassembler::Disassemble(stdout, begin, end); 472 disasm::Disassembler::Disassemble(stdout, begin, end);
473 #endif 473 #endif
474 } 474 }
475 475
476 #undef __ 476 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698