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

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

Issue 10636057: Port r11517 (not deopt Math.floor on negative input) to x64, sse2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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 | « no previous file | src/x64/assembler-x64.h » ('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 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 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3162 __ test(output_reg, Immediate(1)); 3162 __ test(output_reg, Immediate(1));
3163 DeoptimizeIf(not_zero, instr->environment()); 3163 DeoptimizeIf(not_zero, instr->environment());
3164 __ bind(&non_zero); 3164 __ bind(&non_zero);
3165 } 3165 }
3166 __ roundsd(xmm_scratch, input_reg, Assembler::kRoundDown); 3166 __ roundsd(xmm_scratch, input_reg, Assembler::kRoundDown);
3167 __ cvttsd2si(output_reg, Operand(xmm_scratch)); 3167 __ cvttsd2si(output_reg, Operand(xmm_scratch));
3168 // Overflow is signalled with minint. 3168 // Overflow is signalled with minint.
3169 __ cmp(output_reg, 0x80000000u); 3169 __ cmp(output_reg, 0x80000000u);
3170 DeoptimizeIf(equal, instr->environment()); 3170 DeoptimizeIf(equal, instr->environment());
3171 } else { 3171 } else {
3172 Label negative_sign; 3172 Label negative_sign, done;
3173 Label done;
3174 // Deoptimize on unordered. 3173 // Deoptimize on unordered.
3175 __ xorps(xmm_scratch, xmm_scratch); // Zero the register. 3174 __ xorps(xmm_scratch, xmm_scratch); // Zero the register.
3176 __ ucomisd(input_reg, xmm_scratch); 3175 __ ucomisd(input_reg, xmm_scratch);
3177 DeoptimizeIf(parity_even, instr->environment()); 3176 DeoptimizeIf(parity_even, instr->environment());
3178 __ j(below, &negative_sign, Label::kNear); 3177 __ j(below, &negative_sign, Label::kNear);
3179 3178
3180 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 3179 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3181 // Check for negative zero. 3180 // Check for negative zero.
3182 Label positive_sign; 3181 Label positive_sign;
3183 __ j(above, &positive_sign, Label::kNear); 3182 __ j(above, &positive_sign, Label::kNear);
3184 __ movmskpd(output_reg, input_reg); 3183 __ movmskpd(output_reg, input_reg);
3185 __ test(output_reg, Immediate(1)); 3184 __ test(output_reg, Immediate(1));
3186 DeoptimizeIf(not_zero, instr->environment()); 3185 DeoptimizeIf(not_zero, instr->environment());
3187 __ Set(output_reg, Immediate(0)); 3186 __ Set(output_reg, Immediate(0));
3188 __ jmp(&done, Label::kNear); 3187 __ jmp(&done, Label::kNear);
3189 __ bind(&positive_sign); 3188 __ bind(&positive_sign);
3190 } 3189 }
3191 3190
3192 // Use truncating instruction (OK because input is positive). 3191 // Use truncating instruction (OK because input is positive).
3193 __ cvttsd2si(output_reg, Operand(input_reg)); 3192 __ cvttsd2si(output_reg, Operand(input_reg));
3194 // Overflow is signalled with minint. 3193 // Overflow is signalled with minint.
3195 __ cmp(output_reg, 0x80000000u); 3194 __ cmp(output_reg, 0x80000000u);
3196 DeoptimizeIf(equal, instr->environment()); 3195 DeoptimizeIf(equal, instr->environment());
3197 __ jmp(&done, Label::kNear); 3196 __ jmp(&done, Label::kNear);
3198 3197
3199 // Non-zero negative reaches here 3198 // Non-zero negative reaches here.
3200 __ bind(&negative_sign); 3199 __ bind(&negative_sign);
3201 // Truncate, then compare and compensate 3200 // Truncate, then compare and compensate.
3202 __ cvttsd2si(output_reg, Operand(input_reg)); 3201 __ cvttsd2si(output_reg, Operand(input_reg));
3203 __ cvtsi2sd(xmm_scratch, output_reg); 3202 __ cvtsi2sd(xmm_scratch, output_reg);
3204 __ ucomisd(input_reg, xmm_scratch); 3203 __ ucomisd(input_reg, xmm_scratch);
3205 __ j(equal, &done, Label::kNear); 3204 __ j(equal, &done, Label::kNear);
3206 __ sub(output_reg, Immediate(1)); 3205 __ sub(output_reg, Immediate(1));
3207 DeoptimizeIf(overflow, instr->environment()); 3206 DeoptimizeIf(overflow, instr->environment());
3208 3207
3209 __ bind(&done); 3208 __ bind(&done);
3210 } 3209 }
3211 } 3210 }
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
5336 FixedArray::kHeaderSize - kPointerSize)); 5335 FixedArray::kHeaderSize - kPointerSize));
5337 __ bind(&done); 5336 __ bind(&done);
5338 } 5337 }
5339 5338
5340 5339
5341 #undef __ 5340 #undef __
5342 5341
5343 } } // namespace v8::internal 5342 } } // namespace v8::internal
5344 5343
5345 #endif // V8_TARGET_ARCH_IA32 5344 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698