[M3commit] CVS Update: cm3
Jay Krell
jkrell at elego.de
Sun Feb 28 01:32:54 CET 2010
CVSROOT: /usr/cvs
Changes by: jkrell at birch. 10/02/28 01:32:53
Modified files:
cm3/m3-sys/m3back/src/: M3x86.m3
Log message:
inline 64bit shifts by a constant, or at least more instances (e.g. shifting a non-const by a const?)
Oh, actually left_shift and right_shift already did this, this now affects "signed shift",
which I just don't see much utility in really...
including:
before:
< start_call_direct p.71[_m3_shift64 at 12] 0 Word.64
< load_stack_param Word.32 0
< 00004803: 68FFFFFFFF PUSH $-1
< load_stack_param Word.64 0
< 00004808: 8B5DF8 MOV EBX tv.71[_a]
< 0000480B: 8B55FC MOV EDX tv.71[_a]+4
< 0000480E: 52 PUSH EDX
< 0000480F: 53 PUSH EBX
< call_direct p.71[_m3_shift64 at 12] Word.64
< 00004810: FF1500000000 CALL p.71[_m3_shift64 at 12]
after:
> 00004803: 8B5DF8 MOV EBX tv.71[_a]
> 00004806: 8B55FC MOV EDX tv.71[_a]+4
> 00004809: 0FACD301 SHRD EBX EDX $1
> 0000480D: D1EA SHR EDX $1
(though this really should use other addressing modes
and that'd probably save an instruction)
and then tricks like, shifting by more than 32:
before:
< 00004CA7: 6828000000 PUSH $40
< load_stack_param Word.64 0
< 00004CAC: 8B5DF8 MOV EBX tv.71[_a]
< 00004CAF: 8B55FC MOV EDX tv.71[_a]+4
< 00004CB2: 52 PUSH EDX
< 00004CB3: 53 PUSH EBX
< call_direct p.71[_m3_shift64 at 12] Word.64
< 00004CB4: FF1500000000 CALL p.71[_m3_shift64 at 12]
after:
> 00004B50: 8B5DF8 MOV EBX tv.71[_a]
> 00004B53: 8B55FC MOV EDX tv.71[_a]+4
> 00004B56: 8BD3 MOV EDX EBX
> 00004B58: C1E208 SHL EDX $8
> 00004B5B: 33DB XOR EBX EBX
move low to high, zero low, shift high by count - 32
though this too could be a lot better, at the very least, move edx ebx
could be replaced just with a "virtual move" that reassigns the registers
I'm strongly considering inlining all shifts and rotates, though I couldn't
get it to work yet. This is a step.
also notice this is less than one line changed, just to let the
code run that was already there
More information about the M3commit
mailing list