OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 405 |
406 | 406 |
407 TEST(6) { | 407 TEST(6) { |
408 // Test saturating instructions. | 408 // Test saturating instructions. |
409 CcTest::InitializeVM(); | 409 CcTest::InitializeVM(); |
410 Isolate* isolate = CcTest::i_isolate(); | 410 Isolate* isolate = CcTest::i_isolate(); |
411 HandleScope scope(isolate); | 411 HandleScope scope(isolate); |
412 | 412 |
413 Assembler assm(isolate, NULL, 0); | 413 Assembler assm(isolate, NULL, 0); |
414 | 414 |
415 if (CpuFeatures::IsSupported(ARMv7)) { | 415 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. |
416 CpuFeatureScope scope(&assm, ARMv7); | 416 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. |
417 __ usat(r1, 8, Operand(r0)); // Sat 0xFFFF to 0-255 = 0xFF. | 417 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. |
418 __ usat(r2, 12, Operand(r0, ASR, 9)); // Sat (0xFFFF>>9) to 0-4095 = 0x7F. | 418 __ add(r0, r1, Operand(r2)); |
419 __ usat(r3, 1, Operand(r0, LSL, 16)); // Sat (0xFFFF<<16) to 0-1 = 0x0. | 419 __ add(r0, r0, Operand(r3)); |
420 __ add(r0, r1, Operand(r2)); | 420 __ mov(pc, Operand(lr)); |
421 __ add(r0, r0, Operand(r3)); | |
422 __ mov(pc, Operand(lr)); | |
423 | 421 |
424 CodeDesc desc; | 422 CodeDesc desc; |
425 assm.GetCode(&desc); | 423 assm.GetCode(&desc); |
426 Handle<Code> code = isolate->factory()->NewCode( | 424 Handle<Code> code = isolate->factory()->NewCode( |
427 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 425 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
428 #ifdef DEBUG | 426 #ifdef DEBUG |
429 OFStream os(stdout); | 427 OFStream os(stdout); |
430 code->Print(os); | 428 code->Print(os); |
431 #endif | 429 #endif |
432 F1 f = FUNCTION_CAST<F1>(code->entry()); | 430 F1 f = FUNCTION_CAST<F1>(code->entry()); |
433 int res = reinterpret_cast<int>( | 431 int res = reinterpret_cast<int>( |
434 CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); | 432 CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0)); |
435 ::printf("f() = %d\n", res); | 433 ::printf("f() = %d\n", res); |
436 CHECK_EQ(382, res); | 434 CHECK_EQ(382, res); |
437 } | |
438 } | 435 } |
439 | 436 |
440 | 437 |
441 enum VCVTTypes { | 438 enum VCVTTypes { |
442 s32_f64, | 439 s32_f64, |
443 u32_f64 | 440 u32_f64 |
444 }; | 441 }; |
445 | 442 |
446 static void TestRoundingMode(VCVTTypes types, | 443 static void TestRoundingMode(VCVTTypes types, |
447 VFPRoundingMode mode, | 444 VFPRoundingMode mode, |
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 HandleScope scope(isolate); | 2432 HandleScope scope(isolate); |
2436 | 2433 |
2437 Assembler assm(isolate, NULL, 0); | 2434 Assembler assm(isolate, NULL, 0); |
2438 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2435 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2439 __ BlockConstPoolFor(1019); | 2436 __ BlockConstPoolFor(1019); |
2440 for (int i = 0; i < 1019; ++i) __ nop(); | 2437 for (int i = 0; i < 1019; ++i) __ nop(); |
2441 __ vldr(d0, MemOperand(r0, 0)); | 2438 __ vldr(d0, MemOperand(r0, 0)); |
2442 } | 2439 } |
2443 | 2440 |
2444 #undef __ | 2441 #undef __ |
OLD | NEW |