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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 10990024: ARM: Small optimisation of VFP immediate creation (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 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 | « src/arm/macro-assembler-arm.h ('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 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 const double src2, 782 const double src2,
783 const Register fpscr_flags, 783 const Register fpscr_flags,
784 const Condition cond) { 784 const Condition cond) {
785 // Compare and load FPSCR. 785 // Compare and load FPSCR.
786 vcmp(src1, src2, cond); 786 vcmp(src1, src2, cond);
787 vmrs(fpscr_flags, cond); 787 vmrs(fpscr_flags, cond);
788 } 788 }
789 789
790 void MacroAssembler::Vmov(const DwVfpRegister dst, 790 void MacroAssembler::Vmov(const DwVfpRegister dst,
791 const double imm, 791 const double imm,
792 const Register scratch,
792 const Condition cond) { 793 const Condition cond) {
793 ASSERT(CpuFeatures::IsEnabled(VFP2)); 794 ASSERT(CpuFeatures::IsEnabled(VFP2));
794 static const DoubleRepresentation minus_zero(-0.0); 795 static const DoubleRepresentation minus_zero(-0.0);
795 static const DoubleRepresentation zero(0.0); 796 static const DoubleRepresentation zero(0.0);
796 DoubleRepresentation value(imm); 797 DoubleRepresentation value(imm);
797 // Handle special values first. 798 // Handle special values first.
798 if (value.bits == zero.bits) { 799 if (value.bits == zero.bits) {
799 vmov(dst, kDoubleRegZero, cond); 800 vmov(dst, kDoubleRegZero, cond);
800 } else if (value.bits == minus_zero.bits) { 801 } else if (value.bits == minus_zero.bits) {
801 vneg(dst, kDoubleRegZero, cond); 802 vneg(dst, kDoubleRegZero, cond);
802 } else { 803 } else {
803 vmov(dst, imm, cond); 804 vmov(dst, imm, scratch, cond);
804 } 805 }
805 } 806 }
806 807
807
808 void MacroAssembler::EnterFrame(StackFrame::Type type) { 808 void MacroAssembler::EnterFrame(StackFrame::Type type) {
809 // r0-r3: preserved 809 // r0-r3: preserved
810 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); 810 stm(db_w, sp, cp.bit() | fp.bit() | lr.bit());
811 mov(ip, Operand(Smi::FromInt(type))); 811 mov(ip, Operand(Smi::FromInt(type)));
812 push(ip); 812 push(ip);
813 mov(ip, Operand(CodeObject())); 813 mov(ip, Operand(CodeObject()));
814 push(ip); 814 push(ip);
815 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP. 815 add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved FP.
816 } 816 }
817 817
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 Vmov(temp_double_reg, 0.0); 3669 Vmov(temp_double_reg, 0.0);
3670 VFPCompareAndSetFlags(input_reg, temp_double_reg); 3670 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3671 b(gt, &above_zero); 3671 b(gt, &above_zero);
3672 3672
3673 // Double value is less than zero, NaN or Inf, return 0. 3673 // Double value is less than zero, NaN or Inf, return 0.
3674 mov(result_reg, Operand(0)); 3674 mov(result_reg, Operand(0));
3675 b(al, &done); 3675 b(al, &done);
3676 3676
3677 // Double value is >= 255, return 255. 3677 // Double value is >= 255, return 255.
3678 bind(&above_zero); 3678 bind(&above_zero);
3679 Vmov(temp_double_reg, 255.0); 3679 Vmov(temp_double_reg, 255.0, result_reg);
3680 VFPCompareAndSetFlags(input_reg, temp_double_reg); 3680 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3681 b(le, &in_bounds); 3681 b(le, &in_bounds);
3682 mov(result_reg, Operand(255)); 3682 mov(result_reg, Operand(255));
3683 b(al, &done); 3683 b(al, &done);
3684 3684
3685 // In 0-255 range, round and truncate. 3685 // In 0-255 range, round and truncate.
3686 bind(&in_bounds); 3686 bind(&in_bounds);
3687 // Save FPSCR. 3687 // Save FPSCR.
3688 vmrs(ip); 3688 vmrs(ip);
3689 // Set rounding mode to round to the nearest integer by clearing bits[23:22]. 3689 // Set rounding mode to round to the nearest integer by clearing bits[23:22].
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3838 void CodePatcher::EmitCondition(Condition cond) { 3838 void CodePatcher::EmitCondition(Condition cond) {
3839 Instr instr = Assembler::instr_at(masm_.pc_); 3839 Instr instr = Assembler::instr_at(masm_.pc_);
3840 instr = (instr & ~kCondMask) | cond; 3840 instr = (instr & ~kCondMask) | cond;
3841 masm_.emit(instr); 3841 masm_.emit(instr);
3842 } 3842 }
3843 3843
3844 3844
3845 } } // namespace v8::internal 3845 } } // namespace v8::internal
3846 3846
3847 #endif // V8_TARGET_ARCH_ARM 3847 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698