src/dst register for andI_rReg_imm255 and andI_rReg_imm65535

Vladimir Kozlov Vladimir.Kozlov at Sun.COM
Tue Sep 22 08:57:14 PDT 2009

movzbl will change the value since it will move only
lowest byte. The src is loop variable and its value
will be > 255.

But you are right - we don't need the spill here:

instead of

	movl    R11, RBP	# spill
	movzbl  R11, R11	# int & 0xFF

it could be

	movzbl  R11, RBP	# int & 0xFF

And your suggested change will work.


Christian Thalinger wrote:
> Christian Thalinger wrote:
>> Tom Rodriguez wrote:
>>> On Sep 21, 2009, at 12:06 PM, Christian Thalinger wrote:
>>>> Vladimir Kozlov wrote:
>>>>> Christian,
>>>>> Can you tell more about the problem you see?
>>>>> The instructions you pointing use dst register only:
>>>>> "movzbl  $dst, $dst\t# int & 0xFF"
>>>> Right.  Well, it's not a problem, I just wonder why it does not use  
>>>> the
>>>> src register:
>>>> "movzbl  $dst, $src\t# int & 0xFF"
>>>> but instead we have to emit a spill instruction to move src to dst.
>>> That will occur if there are other users of src.  If it's the last use  
>>> then we shouldn't emit the spill.
>> I was looking at some assembly output while testing something else and I
>> noticed that it's not the case.  Maybe LoopUnrollLimit=1 changes the way
>> code is emitted, but in this small loop there is no other use of src and
>> we have a spill:
>> 042   B2: #	B2 B3 <- B1 B2 	Loop: B2-B2 inner stride: not constant
>> Freq: 1e+06
>> 042   	movl    R11, RBP	# spill
>> 045   	movzbl  R11, R11	# int & 0xFF
>> 049   	addl    RBX, R11	# int
>> 04c   	incl    RBP	# int
>> 04e   	cmpl    RBP, #2147483647
>> 054   	jl,s   B2	# loop end  P=1.000000 C=809121.000000
> Seems I'm a bit confused today... of course there is another use of src.
>  But what is the reason we need a spill here?  src doesn't get changed
> in the movzbl instruction.
> -- Christian

More information about the hotspot-compiler-dev mailing list