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

Issue 6576030: X64 Crankshaft: Implement Math.abs on x64 lithium. (Closed)

Created:
9 years, 10 months ago by William Hesse
Modified:
9 years, 7 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

X64 Crankshaft: Implement Math.abs on x64 lithium. Committed: http://code.google.com/p/v8/source/detail?r=6936

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+134 lines, -6 lines) Patch
M src/x64/assembler-x64.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/x64/assembler-x64.cc View 1 chunk +22 lines, -0 lines 0 comments Download
M src/x64/disasm-x64.cc View 1 chunk +7 lines, -3 lines 0 comments Download
M src/x64/lithium-codegen-x64.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 chunk +96 lines, -2 lines 4 comments Download
M src/x64/macro-assembler-x64.h View 1 chunk +1 line, -1 line 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
William Hesse
9 years, 10 months ago (2011-02-24 13:07:21 UTC) #1
Lasse Reichstein
9 years, 10 months ago (2011-02-24 13:57:02 UTC) #2
LGTM

http://codereview.chromium.org/6576030/diff/1/src/x64/lithium-codegen-x64.cc
File src/x64/lithium-codegen-x64.cc (right):

http://codereview.chromium.org/6576030/diff/1/src/x64/lithium-codegen-x64.cc#...
src/x64/lithium-codegen-x64.cc:2333: __ negl(input_reg);
If you want to avoid the jumps, you can do:

movl(kScratchRegister, input_reg);
asrl(kScratchRegister, 31);
xorl(input_reg, kScratchRegister);
subl(inpt_reg, kScratchRegister);
DeoptimizeIf(negative, ...).

On the other hand, it's probably not any faster than using negl.

http://codereview.chromium.org/6576030/diff/1/src/x64/lithium-codegen-x64.cc#...
src/x64/lithium-codegen-x64.cc:2334: __ testl(input_reg, input_reg);
The negl instruction sets the sign flag, so you can omit the testl.

http://codereview.chromium.org/6576030/diff/1/src/x64/lithium-codegen-x64.cc#...
src/x64/lithium-codegen-x64.cc:2358: XMMRegister  scratch = xmm0;
Extra space before "scratch".

http://codereview.chromium.org/6576030/diff/1/src/x64/lithium-codegen-x64.cc#...
src/x64/lithium-codegen-x64.cc:2362: __ andpd(input_reg, scratch);
Neat.

Powered by Google App Engine
This is Rietveld 408576698