* fixed 64 bit shl/shr/sar operations: the second argument of the

operation is 32 bit, not 64 bit (both in the compiler and in the
    JVM)
  * request a 64 rather than a 32 bit shift operation from tjvmshlshrnode
    if the result is 64 bit (rather than in case shift value is 64 bit,
    since as described above that never happens)

git-svn-id: branches/jvmbackend@18337 -
This commit is contained in:
Jonas Maebe 2011-08-20 07:48:23 +00:00
parent 8f727557c0
commit 87925db8fb
2 changed files with 35 additions and 6 deletions

View File

@ -356,8 +356,15 @@ implementation
if TOpCG2LAsmOp[op]=A_None then
internalerror(2010120533);
list.concat(taicpu.op_none(TOpCG2LAsmOp[op]));
if op<>OP_NEG then
decstack(list,2);
case op of
OP_NOT:
;
{ the second argument here is an int rather than a long }
OP_SHL,OP_SHR,OP_SAR:
decstack(list,1);
else
decstack(list,2);
end;
end;
else
internalerror(2010120531);
@ -381,7 +388,15 @@ implementation
else
begin
maybepreparedivu32(list,op,size,trunc32);
a_load_const_stack(list,size,a,R_INTREGISTER);
case op of
OP_NEG,OP_NOT:
internalerror(2011010801);
OP_SHL,OP_SHR,OP_SAR:
{ the second argument here is an int rather than a long }
a_load_const_stack(list,s32inttype,a,R_INTREGISTER);
else
a_load_const_stack(list,size,a,R_INTREGISTER);
end;
a_op_stack(list,op,size,trunc32);
end;
end;
@ -391,8 +406,22 @@ implementation
trunc32: boolean;
begin
maybepreparedivu32(list,op,size,trunc32);
if not(op in [OP_NEG,OP_NOT]) then
a_load_reg_stack(list,size,reg);
case op of
OP_NEG,OP_NOT:
;
OP_SHL,OP_SHR,OP_SAR:
if not is_64bitint(size) then
a_load_reg_stack(list,size,reg)
else
begin
{ the second argument here is an int rather than a long }
if getsubreg(reg)=R_SUBQ then
internalerror(2011010802);
a_load_reg_stack(list,s32inttype,reg)
end
else
a_load_reg_stack(list,size,reg);
end;
a_op_stack(list,op,size,trunc32);
end;

View File

@ -144,7 +144,7 @@ implementation
op:=OP_SHL
else
op:=OP_SHR;
thlcgjvm(hlcg).a_op_loc_stack(current_asmdata.CurrAsmList,op,right.resultdef,right.location);
thlcgjvm(hlcg).a_op_loc_stack(current_asmdata.CurrAsmList,op,resultdef,right.location);
thlcgjvm(hlcg).a_load_stack_reg(current_asmdata.CurrAsmList,resultdef,location.register);
end;