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

Side by Side Diff: src/arm/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/assembler-arm.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 *encoding = (hi >> 16) & 0xf; // Low nybble. 1968 *encoding = (hi >> 16) & 0xf; // Low nybble.
1969 *encoding |= (hi >> 4) & 0x70000; // Low three bits of the high nybble. 1969 *encoding |= (hi >> 4) & 0x70000; // Low three bits of the high nybble.
1970 *encoding |= (hi >> 12) & 0x80000; // Top bit of the high nybble. 1970 *encoding |= (hi >> 12) & 0x80000; // Top bit of the high nybble.
1971 1971
1972 return true; 1972 return true;
1973 } 1973 }
1974 1974
1975 1975
1976 void Assembler::vmov(const DwVfpRegister dst, 1976 void Assembler::vmov(const DwVfpRegister dst,
1977 double imm, 1977 double imm,
1978 const Register scratch,
1978 const Condition cond) { 1979 const Condition cond) {
1979 // Dd = immediate 1980 // Dd = immediate
1980 // Instruction details available in ARM DDI 0406B, A8-640. 1981 // Instruction details available in ARM DDI 0406B, A8-640.
1981 ASSERT(CpuFeatures::IsEnabled(VFP2)); 1982 ASSERT(CpuFeatures::IsEnabled(VFP2));
1982 1983
1983 uint32_t enc; 1984 uint32_t enc;
1984 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { 1985 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) {
1985 // The double can be encoded in the instruction. 1986 // The double can be encoded in the instruction.
1986 emit(cond | 0xE*B24 | 0xB*B20 | dst.code()*B12 | 0xB*B8 | enc); 1987 emit(cond | 0xE*B24 | 0xB*B20 | dst.code()*B12 | 0xB*B8 | enc);
1987 } else { 1988 } else {
1988 // Synthesise the double from ARM immediates. This could be implemented 1989 // Synthesise the double from ARM immediates. This could be implemented
1989 // using vldr from a constant pool. 1990 // using vldr from a constant pool.
1990 uint32_t lo, hi; 1991 uint32_t lo, hi;
1991 DoubleAsTwoUInt32(imm, &lo, &hi); 1992 DoubleAsTwoUInt32(imm, &lo, &hi);
1993 mov(ip, Operand(lo));
1992 1994
1993 if (lo == hi) { 1995 if (scratch.is(no_reg)) {
1994 // If the lo and hi parts of the double are equal, the literal is easier
1995 // to create. This is the case with 0.0.
1996 mov(ip, Operand(lo));
1997 vmov(dst, ip, ip);
1998 } else {
1999 // Move the low part of the double into the lower of the corresponsing S 1996 // Move the low part of the double into the lower of the corresponsing S
2000 // registers of D register dst. 1997 // registers of D register dst.
2001 mov(ip, Operand(lo));
2002 vmov(dst.low(), ip, cond); 1998 vmov(dst.low(), ip, cond);
2003 1999
2004 // Move the high part of the double into the higher of the corresponsing S 2000 // Move the high part of the double into the higher of the corresponsing S
2005 // registers of D register dst. 2001 // registers of D register dst.
2006 mov(ip, Operand(hi)); 2002 mov(ip, Operand(hi));
2007 vmov(dst.high(), ip, cond); 2003 vmov(dst.high(), ip, cond);
2004 } else {
2005 // Move the low and high parts of the double to a D register in one
2006 // instruction.
2007 mov(scratch, Operand(hi));
2008 vmov(dst, ip, scratch, cond);
2008 } 2009 }
2009 } 2010 }
2010 } 2011 }
2011 2012
2012 2013
2013 void Assembler::vmov(const SwVfpRegister dst, 2014 void Assembler::vmov(const SwVfpRegister dst,
2014 const SwVfpRegister src, 2015 const SwVfpRegister src,
2015 const Condition cond) { 2016 const Condition cond) {
2016 // Sd = Sm 2017 // Sd = Sm
2017 // Instruction details available in ARM DDI 0406B, A8-642. 2018 // Instruction details available in ARM DDI 0406B, A8-642.
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 2689
2689 // Since a constant pool was just emitted, move the check offset forward by 2690 // Since a constant pool was just emitted, move the check offset forward by
2690 // the standard interval. 2691 // the standard interval.
2691 next_buffer_check_ = pc_offset() + kCheckPoolInterval; 2692 next_buffer_check_ = pc_offset() + kCheckPoolInterval;
2692 } 2693 }
2693 2694
2694 2695
2695 } } // namespace v8::internal 2696 } } // namespace v8::internal
2696 2697
2697 #endif // V8_TARGET_ARCH_ARM 2698 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698