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 3194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3205 if (input_reg.is(result_reg)) { | 3205 if (input_reg.is(result_reg)) { |
3206 subp(rsp, Immediate(kDoubleSize)); | 3206 subp(rsp, Immediate(kDoubleSize)); |
3207 movsd(MemOperand(rsp, 0), xmm0); | 3207 movsd(MemOperand(rsp, 0), xmm0); |
3208 SlowTruncateToI(result_reg, rsp, 0); | 3208 SlowTruncateToI(result_reg, rsp, 0); |
3209 addp(rsp, Immediate(kDoubleSize)); | 3209 addp(rsp, Immediate(kDoubleSize)); |
3210 } else { | 3210 } else { |
3211 SlowTruncateToI(result_reg, input_reg); | 3211 SlowTruncateToI(result_reg, input_reg); |
3212 } | 3212 } |
3213 | 3213 |
3214 bind(&done); | 3214 bind(&done); |
| 3215 // Keep our invariant that the upper 32 bits are zero. |
| 3216 movl(result_reg, result_reg); |
3215 } | 3217 } |
3216 | 3218 |
3217 | 3219 |
3218 void MacroAssembler::TruncateDoubleToI(Register result_reg, | 3220 void MacroAssembler::TruncateDoubleToI(Register result_reg, |
3219 XMMRegister input_reg) { | 3221 XMMRegister input_reg) { |
3220 Label done; | 3222 Label done; |
3221 cvttsd2siq(result_reg, input_reg); | 3223 cvttsd2siq(result_reg, input_reg); |
3222 cmpq(result_reg, Immediate(1)); | 3224 cmpq(result_reg, Immediate(1)); |
3223 j(no_overflow, &done, Label::kNear); | 3225 j(no_overflow, &done, Label::kNear); |
3224 | 3226 |
3225 subp(rsp, Immediate(kDoubleSize)); | 3227 subp(rsp, Immediate(kDoubleSize)); |
3226 movsd(MemOperand(rsp, 0), input_reg); | 3228 movsd(MemOperand(rsp, 0), input_reg); |
3227 SlowTruncateToI(result_reg, rsp, 0); | 3229 SlowTruncateToI(result_reg, rsp, 0); |
3228 addp(rsp, Immediate(kDoubleSize)); | 3230 addp(rsp, Immediate(kDoubleSize)); |
3229 | 3231 |
3230 bind(&done); | 3232 bind(&done); |
| 3233 // Keep our invariant that the upper 32 bits are zero. |
| 3234 movl(result_reg, result_reg); |
3231 } | 3235 } |
3232 | 3236 |
3233 | 3237 |
3234 void MacroAssembler::DoubleToI(Register result_reg, | 3238 void MacroAssembler::DoubleToI(Register result_reg, |
3235 XMMRegister input_reg, | 3239 XMMRegister input_reg, |
3236 XMMRegister scratch, | 3240 XMMRegister scratch, |
3237 MinusZeroMode minus_zero_mode, | 3241 MinusZeroMode minus_zero_mode, |
3238 Label* conversion_failed, | 3242 Label* conversion_failed, |
3239 Label::Distance dst) { | 3243 Label::Distance dst) { |
3240 cvttsd2si(result_reg, input_reg); | 3244 cvttsd2si(result_reg, input_reg); |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5085 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5089 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
5086 movl(rax, dividend); | 5090 movl(rax, dividend); |
5087 shrl(rax, Immediate(31)); | 5091 shrl(rax, Immediate(31)); |
5088 addl(rdx, rax); | 5092 addl(rdx, rax); |
5089 } | 5093 } |
5090 | 5094 |
5091 | 5095 |
5092 } } // namespace v8::internal | 5096 } } // namespace v8::internal |
5093 | 5097 |
5094 #endif // V8_TARGET_ARCH_X64 | 5098 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |