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

Issue 2804033: ARM: Special code for raising to the power of an integer... (Closed)

Created:
10 years, 5 months ago by Søren Thygesen Gjesse
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

ARM: Special code for raising to the power of an integer When calculating Math.pow where the exponent is a smi use a simple loop to calculate the result. Added support for the vmov instruction moving from one doubleword extension register to another. Added some Math.pow tests which partially covers what is in the Sputnik tests. Committed: http://code.google.com/p/v8/source/detail?r=4990

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 10

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -6 lines) Patch
M src/arm/assembler-arm.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M src/arm/assembler-arm.cc View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M src/arm/codegen-arm.cc View 1 2 3 chunks +50 lines, -4 lines 0 comments Download
M src/arm/disasm-arm.cc View 1 2 1 chunk +8 lines, -1 line 0 comments Download
M src/arm/simulator-arm.cc View 1 2 1 chunk +8 lines, -1 line 0 comments Download
M test/cctest/test-disasm-arm.cc View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
A test/mjsunit/math-pow.js View 1 chunk +124 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Søren Thygesen Gjesse
10 years, 5 months ago (2010-06-30 11:11:16 UTC) #1
Erik Corry
LGTM http://codereview.chromium.org/2804033/diff/9001/10003 File src/arm/codegen-arm.cc (right): http://codereview.chromium.org/2804033/diff/9001/10003#newcode4326 src/arm/codegen-arm.cc:4326: AVOID_NANS_AND_INFINITIES); Apparently we don't need to avoid these. ...
10 years, 5 months ago (2010-06-30 11:30:26 UTC) #2
Rodolph Perfetta
http://codereview.chromium.org/2804033/diff/9001/10003 File src/arm/codegen-arm.cc (right): http://codereview.chromium.org/2804033/diff/9001/10003#newcode4333 src/arm/codegen-arm.cc:4333: __ vmov(d0, scratch1, scratch2); VFP has a vmov instruction ...
10 years, 5 months ago (2010-06-30 11:41:31 UTC) #3
Søren Thygesen Gjesse
10 years, 5 months ago (2010-06-30 12:21:11 UTC) #4
http://codereview.chromium.org/2804033/diff/9001/10003
File src/arm/codegen-arm.cc (right):

http://codereview.chromium.org/2804033/diff/9001/10003#newcode4326
src/arm/codegen-arm.cc:4326: AVOID_NANS_AND_INFINITIES);
On 2010/06/30 11:30:26, Erik Corry wrote:
> Apparently we don't need to avoid these.

We don't, changed.

http://codereview.chromium.org/2804033/diff/9001/10003#newcode4333
src/arm/codegen-arm.cc:4333: __ vmov(d0, scratch1, scratch2);
On 2010/06/30 11:41:31, Rodolph Perfetta wrote:
> VFP has a vmov instruction which can cope with a limited set of immediate. 1.0
> is one of those.

I will look into adding support for that.

http://codereview.chromium.org/2804033/diff/9001/10003#newcode4361
src/arm/codegen-arm.cc:4361: __ LoadRoot(heap_number_map,
Heap::kHeapNumberMapRootIndex);
On 2010/06/30 11:30:26, Erik Corry wrote:
> I don't think you need to do this again.

I do, as the load above is after the jump to exponent_nonsmi.

http://codereview.chromium.org/2804033/diff/9001/10003#newcode4369
src/arm/codegen-arm.cc:4369: // Load the higher bits (which contains the
exponent).
On 2010/06/30 11:30:26, Erik Corry wrote:
> exponent -> floating point exponent

Done.

http://codereview.chromium.org/2804033/diff/9001/10007
File test/mjsunit/math-pow.js (right):

http://codereview.chromium.org/2804033/diff/9001/10007#newcode124
test/mjsunit/math-pow.js:124: assertEquals(NaN, Math.pow(-1000, -1.1));
On 2010/06/30 11:30:26, Erik Corry wrote:
> It would be nice with some precision-based tests.  Something like
> Math.pow(Math.PI, 13) to see if all the digits are the same on all
> architectures.

Unfortunately the digits are not always the same. On ia32 there are differences
between the fast and runtime version. On x64 and ARM (Tegra) both the fast and
the runtime versions give the same result, which is the result of the ia32 fast
version. The ARM simulator on ia32 gives the same result as the is32 runtime
version.

Here are the results of

for (var i = 1; i < 16; i++) print(Math.pow(Math.PI, i))

IA-32 optimized
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400243
306.0196847852814
961.3891935753043
3020.2932277767914
9488.531016070572
29809.099333446204
93648.047476083
294204.0179738905
924269.1815233739
2903677.2706132825
9122171.181754349
28658145.969387986

IA-32 runtime
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400242
306.0196847852814
961.3891935753043
3020.2932277767914
9488.53101607057
29809.0993334462
93648.04747608298
294204.01797389047
924269.1815233737
2903677.270613282
9122171.181754349
28658145.969387982


x64 optimized
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400243
306.0196847852814
961.3891935753043
3020.2932277767914
9488.531016070572
29809.099333446204
93648.047476083
294204.0179738905
924269.1815233739
2903677.2706132825
9122171.181754349
28658145.969387986

x64 runtime
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400243
306.0196847852814
961.3891935753043
3020.2932277767914
9488.531016070572
29809.099333446204
93648.047476083
294204.0179738905
924269.1815233739
2903677.2706132825
9122171.181754349
28658145.969387986


ARM (Tegra) optimized
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400243
306.0196847852814
961.3891935753043
3020.2932277767914
9488.531016070572
29809.099333446204
93648.047476083
294204.0179738905
924269.1815233739
2903677.2706132825
9122171.181754349
28658145.969387986

ARM (Tegra) runtime
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400243
306.0196847852814
961.3891935753043
3020.2932277767914
9488.531016070572
29809.099333446204
93648.047476083
294204.0179738905
924269.1815233739
2903677.2706132825
9122171.181754349
28658145.969387986


ARM optimized (sim)
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400242
306.0196847852814
961.3891935753043
3020.2932277767914
9488.53101607057
29809.0993334462
93648.04747608298
294204.01797389047
924269.1815233737
2903677.270613282
9122171.181754349
28658145.969387982

ARM runtime (sim)
3.141592653589793
9.869604401089358
31.006276680299816
97.40909103400242
306.0196847852814
961.3891935753043
3020.2932277767914
9488.53101607057
29809.0993334462
93648.04747608298
294204.01797389047
924269.1815233737
2903677.270613282
9122171.181754349
28658145.969387982

Powered by Google App Engine
This is Rietveld 408576698