ibmruntimes / v8ppc

Port of Google V8 javascript engine to PowerPC®
Other
94 stars 19 forks source link

Optimize mov() to output smaller sequence when possible #92

Open andrewlow opened 11 years ago

andrewlow commented 11 years ago

The current mov() implementation in 32bit looks something like this

lis     r8, 2146
ori     r8, r8, 38788

on 64bit it is 5 instructions

lis 3,0xdead
ori 3,3,48879
sldi 3,3,32
oris 3,3,0xfeed
ori 3,3,32918

For some constants (specifically those that do not need relocation) we can do better.

andrewlow commented 11 years ago

Initial implementation doesn't appear to produce much difference in terms of performance

baseline:

$ ../out/ppc.release/d8 run.js
Richards: 6704
DeltaBlue: 8562
Crypto: 5987
RayTrace: 8189
EarleyBoyer: 16069
RegExp: 2383
Splay: 4603
NavierStokes: 7842
----
Score (version 7): 6664
-bash-4.1$ ../out/ppc.release/d8 run.js
Richards: 6683
DeltaBlue: 7121
Crypto: 5976
RayTrace: 8132
EarleyBoyer: 15795
RegExp: 2392
Splay: 4480
NavierStokes: 7749
----
Score (version 7): 6460
-bash-4.1$ ../out/ppc.release/d8 run.js
Richards: 6704
DeltaBlue: 8549
Crypto: 6210
RayTrace: 8189
EarleyBoyer: 16052
RegExp: 2432
Splay: 4477
NavierStokes: 6997
----
Score (version 7): 6592

With new mov()

$ ../out/ppc.release/d8 run.js
Richards: 6390
DeltaBlue: 8556
Crypto: 5915
RayTrace: 8066
EarleyBoyer: 16049
RegExp: 2409
Splay: 4689
NavierStokes: 8358
----
Score (version 7): 6677
-bash-4.1$ ../out/ppc.release/d8 run.js
Richards: 6651
DeltaBlue: 8549
Crypto: 5921
RayTrace: 8067
EarleyBoyer: 16049
RegExp: 2404
Splay: 4702
NavierStokes: 7998
----
Score (version 7): 6675
-bash-4.1$ ../out/ppc.release/d8 run.js
Richards: 5627
DeltaBlue: 8483
Crypto: 6194
RayTrace: 8149
EarleyBoyer: 16091
RegExp: 2400
Splay: 4726
NavierStokes: 7709
----
Score (version 7): 6550
andrewlow commented 11 years ago

Commit a4e0fda83cf6748c2342d1daf297a5f73700036f - I'm not sure we can optimize more with mov()

andrewlow commented 11 years ago

Leaving this open until 64bit has been optimized - my commit above only addresses 32bit