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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 8805011: Fixing MathPowHalf on x64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); 2845 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2846 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); 2846 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2847 __ sqrtsd(input_reg, input_reg); 2847 __ sqrtsd(input_reg, input_reg);
2848 } 2848 }
2849 2849
2850 2850
2851 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { 2851 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
2852 XMMRegister xmm_scratch = xmm0; 2852 XMMRegister xmm_scratch = xmm0;
2853 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); 2853 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
2854 ASSERT(ToDoubleRegister(instr->result()).is(input_reg)); 2854 ASSERT(ToDoubleRegister(instr->result()).is(input_reg));
2855
2856 // Note that according to ECMA-262 15.8.2.13:
2857 // Math.pow(-Infinity, 0.5) == Infinity
2858 // Math.sqrt(-Infinity) == NaN
2859 Label done, sqrt;
2860 // Check base for -Infinity. According to IEEE-754, single-precision
ulan 2011/12/05 16:32:41 double-precision
2861 // -Infinity has the highest 12 bits set and the lowest 52 bits cleared.
2862 __ movq(kScratchRegister, V8_INT64_C(0xFFF0000000000000), RelocInfo::NONE);
2863 __ movq(xmm_scratch, kScratchRegister);
2864 __ ucomisd(xmm_scratch, input_reg);
2865 __ j(not_equal, &sqrt, Label::kNear);
2866 // If input is -Infinity, return Infinity.
2867 __ xorps(input_reg, input_reg);
2868 __ subsd(input_reg, xmm_scratch);
2869 __ jmp(&done, Label::kNear);
2870
2871 // Square root.
2872 __ bind(&sqrt);
2855 __ xorps(xmm_scratch, xmm_scratch); 2873 __ xorps(xmm_scratch, xmm_scratch);
2856 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0. 2874 __ addsd(input_reg, xmm_scratch); // Convert -0 to +0.
2857 __ sqrtsd(input_reg, input_reg); 2875 __ sqrtsd(input_reg, input_reg);
2876 __ bind(&done);
2858 } 2877 }
2859 2878
2860 2879
2861 void LCodeGen::DoPower(LPower* instr) { 2880 void LCodeGen::DoPower(LPower* instr) {
2862 LOperand* left = instr->InputAt(0); 2881 LOperand* left = instr->InputAt(0);
2863 XMMRegister left_reg = ToDoubleRegister(left); 2882 XMMRegister left_reg = ToDoubleRegister(left);
2864 ASSERT(!left_reg.is(xmm1)); 2883 ASSERT(!left_reg.is(xmm1));
2865 LOperand* right = instr->InputAt(1); 2884 LOperand* right = instr->InputAt(1);
2866 XMMRegister result_reg = ToDoubleRegister(instr->result()); 2885 XMMRegister result_reg = ToDoubleRegister(instr->result());
2867 Representation exponent_type = instr->hydrogen()->right()->representation(); 2886 Representation exponent_type = instr->hydrogen()->right()->representation();
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4343 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4325 ASSERT(osr_pc_offset_ == -1); 4344 ASSERT(osr_pc_offset_ == -1);
4326 osr_pc_offset_ = masm()->pc_offset(); 4345 osr_pc_offset_ = masm()->pc_offset();
4327 } 4346 }
4328 4347
4329 #undef __ 4348 #undef __
4330 4349
4331 } } // namespace v8::internal 4350 } } // namespace v8::internal
4332 4351
4333 #endif // V8_TARGET_ARCH_X64 4352 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698