OLD | NEW |
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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 *encoding = (hi >> 16) & 0xf; // Low nybble. | 2060 *encoding = (hi >> 16) & 0xf; // Low nybble. |
2061 *encoding |= (hi >> 4) & 0x70000; // Low three bits of the high nybble. | 2061 *encoding |= (hi >> 4) & 0x70000; // Low three bits of the high nybble. |
2062 *encoding |= (hi >> 12) & 0x80000; // Top bit of the high nybble. | 2062 *encoding |= (hi >> 12) & 0x80000; // Top bit of the high nybble. |
2063 | 2063 |
2064 return true; | 2064 return true; |
2065 } | 2065 } |
2066 | 2066 |
2067 | 2067 |
2068 void Assembler::vmov(const DwVfpRegister dst, | 2068 void Assembler::vmov(const DwVfpRegister dst, |
2069 double imm, | 2069 double imm, |
2070 const Register scratch, | 2070 const Register scratch) { |
2071 const Condition cond) { | |
2072 ASSERT(CpuFeatures::IsEnabled(VFP2)); | 2071 ASSERT(CpuFeatures::IsEnabled(VFP2)); |
2073 | 2072 |
2074 uint32_t enc; | 2073 uint32_t enc; |
2075 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { | 2074 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { |
2076 // The double can be encoded in the instruction. | 2075 // The double can be encoded in the instruction. |
2077 // | 2076 // |
2078 // Dd = immediate | 2077 // Dd = immediate |
2079 // Instruction details available in ARM DDI 0406C.b, A8-936. | 2078 // Instruction details available in ARM DDI 0406C.b, A8-936. |
2080 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | imm4H(19-16) | | 2079 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | imm4H(19-16) | |
2081 // Vd(15-12) | 101(11-9) | sz=1(8) | imm4L(3-0) | 2080 // Vd(15-12) | 101(11-9) | sz=1(8) | imm4L(3-0) |
2082 int vd, d; | 2081 int vd, d; |
2083 dst.split_code(&vd, &d); | 2082 dst.split_code(&vd, &d); |
2084 emit(cond | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc); | 2083 emit(al | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc); |
2085 } else if (FLAG_enable_vldr_imm) { | 2084 } else if (FLAG_enable_vldr_imm) { |
2086 // TODO(jfb) Temporarily turned off until we have constant blinding or | 2085 // TODO(jfb) Temporarily turned off until we have constant blinding or |
2087 // some equivalent mitigation: an attacker can otherwise control | 2086 // some equivalent mitigation: an attacker can otherwise control |
2088 // generated data which also happens to be executable, a Very Bad | 2087 // generated data which also happens to be executable, a Very Bad |
2089 // Thing indeed. | 2088 // Thing indeed. |
2090 // Blinding gets tricky because we don't have xor, we probably | 2089 // Blinding gets tricky because we don't have xor, we probably |
2091 // need to add/subtract without losing precision, which requires a | 2090 // need to add/subtract without losing precision, which requires a |
2092 // cookie value that Lithium is probably better positioned to | 2091 // cookie value that Lithium is probably better positioned to |
2093 // choose. | 2092 // choose. |
2094 // We could also add a few peepholes here like detecting 0.0 and | 2093 // We could also add a few peepholes here like detecting 0.0 and |
2095 // -0.0 and doing a vmov from the sequestered d14, forcing denorms | 2094 // -0.0 and doing a vmov from the sequestered d14, forcing denorms |
2096 // to zero (we set flush-to-zero), and normalizing NaN values. | 2095 // to zero (we set flush-to-zero), and normalizing NaN values. |
2097 // We could also detect redundant values. | 2096 // We could also detect redundant values. |
2098 // The code could also randomize the order of values, though | 2097 // The code could also randomize the order of values, though |
2099 // that's tricky because vldr has a limited reach. Furthermore | 2098 // that's tricky because vldr has a limited reach. Furthermore |
2100 // it breaks load locality. | 2099 // it breaks load locality. |
2101 RecordRelocInfo(imm); | 2100 RecordRelocInfo(imm); |
2102 vldr(dst, MemOperand(pc, 0), cond); | 2101 vldr(dst, MemOperand(pc, 0)); |
2103 } else { | 2102 } else { |
2104 // Synthesise the double from ARM immediates. | 2103 // Synthesise the double from ARM immediates. |
2105 uint32_t lo, hi; | 2104 uint32_t lo, hi; |
2106 DoubleAsTwoUInt32(imm, &lo, &hi); | 2105 DoubleAsTwoUInt32(imm, &lo, &hi); |
2107 | 2106 |
2108 if (scratch.is(no_reg)) { | 2107 if (scratch.is(no_reg)) { |
2109 if (dst.code() < 16) { | 2108 if (dst.code() < 16) { |
2110 // Move the low part of the double into the lower of the corresponsing S | 2109 // Move the low part of the double into the lower of the corresponsing S |
2111 // registers of D register dst. | 2110 // registers of D register dst. |
2112 mov(ip, Operand(lo)); | 2111 mov(ip, Operand(lo)); |
2113 vmov(dst.low(), ip, cond); | 2112 vmov(dst.low(), ip); |
2114 | 2113 |
2115 // Move the high part of the double into the higher of the | 2114 // Move the high part of the double into the higher of the |
2116 // corresponsing S registers of D register dst. | 2115 // corresponsing S registers of D register dst. |
2117 mov(ip, Operand(hi)); | 2116 mov(ip, Operand(hi)); |
2118 vmov(dst.high(), ip, cond); | 2117 vmov(dst.high(), ip); |
2119 } else { | 2118 } else { |
2120 // D16-D31 does not have S registers, so move the low and high parts | 2119 // D16-D31 does not have S registers, so move the low and high parts |
2121 // directly to the D register using vmov.32. | 2120 // directly to the D register using vmov.32. |
2122 // Note: This may be slower, so we only do this when we have to. | 2121 // Note: This may be slower, so we only do this when we have to. |
2123 mov(ip, Operand(lo)); | 2122 mov(ip, Operand(lo)); |
2124 vmov(dst, VmovIndexLo, ip, cond); | 2123 vmov(dst, VmovIndexLo, ip); |
2125 mov(ip, Operand(hi)); | 2124 mov(ip, Operand(hi)); |
2126 vmov(dst, VmovIndexHi, ip, cond); | 2125 vmov(dst, VmovIndexHi, ip); |
2127 } | 2126 } |
2128 } else { | 2127 } else { |
2129 // Move the low and high parts of the double to a D register in one | 2128 // Move the low and high parts of the double to a D register in one |
2130 // instruction. | 2129 // instruction. |
2131 mov(ip, Operand(lo)); | 2130 mov(ip, Operand(lo)); |
2132 mov(scratch, Operand(hi)); | 2131 mov(scratch, Operand(hi)); |
2133 vmov(dst, ip, scratch, cond); | 2132 vmov(dst, ip, scratch); |
2134 } | 2133 } |
2135 } | 2134 } |
2136 } | 2135 } |
2137 | 2136 |
2138 | 2137 |
2139 void Assembler::vmov(const SwVfpRegister dst, | 2138 void Assembler::vmov(const SwVfpRegister dst, |
2140 const SwVfpRegister src, | 2139 const SwVfpRegister src, |
2141 const Condition cond) { | 2140 const Condition cond) { |
2142 // Sd = Sm | 2141 // Sd = Sm |
2143 // Instruction details available in ARM DDI 0406B, A8-642. | 2142 // Instruction details available in ARM DDI 0406B, A8-642. |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3026 | 3025 |
3027 // Since a constant pool was just emitted, move the check offset forward by | 3026 // Since a constant pool was just emitted, move the check offset forward by |
3028 // the standard interval. | 3027 // the standard interval. |
3029 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 3028 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
3030 } | 3029 } |
3031 | 3030 |
3032 | 3031 |
3033 } } // namespace v8::internal | 3032 } } // namespace v8::internal |
3034 | 3033 |
3035 #endif // V8_TARGET_ARCH_ARM | 3034 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |