mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-30 23:37:25 +01:00
* removed superfluous masking of rotation count for rol/ror inlines
git-svn-id: trunk@11789 -
This commit is contained in:
parent
c4789a5ae4
commit
fbbbf33be1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7809,6 +7809,7 @@ tests/test/trecreg3.pp -text
|
||||
tests/test/trecreg4.pp svneol=native#text/plain
|
||||
tests/test/tresstr.pp svneol=native#text/plain
|
||||
tests/test/trox1.pp svneol=native#text/plain
|
||||
tests/test/trox2.pp svneol=native#text/plain
|
||||
tests/test/trstr1.pp svneol=native#text/plain
|
||||
tests/test/trstr2.pp svneol=native#text/plain
|
||||
tests/test/trstr3.pp svneol=native#text/plain
|
||||
|
||||
@ -757,19 +757,7 @@ implementation
|
||||
else
|
||||
begin
|
||||
location_force_reg(current_asmdata.CurrAsmList,op2.location,location.size,false);
|
||||
{
|
||||
if op2.location.loc<>LOC_REGISTER then
|
||||
begin
|
||||
hcountreg:=cg.getintregister(current_asmdata.CurrAsmList,
|
||||
op2.location.size);
|
||||
cg.a_load_loc_reg(current_asmdata.CurrAsmList,location.size,
|
||||
op2.location,hcountreg);
|
||||
end
|
||||
else
|
||||
hcountreg:=op2.location.register;
|
||||
}
|
||||
{ do modulo 2 operation }
|
||||
cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,op2.location.size,resultdef.size*8-1,op2.location.register);
|
||||
cg.a_op_reg_reg(current_asmdata.CurrAsmList,op,location.size,op2.location.register,location.register);
|
||||
end;
|
||||
end
|
||||
|
||||
64
tests/test/trox2.pp
Normal file
64
tests/test/trox2.pp
Normal file
@ -0,0 +1,64 @@
|
||||
// tests whether the rol/ror operations properly mask out the shift count
|
||||
procedure do_error(i : integer);
|
||||
begin
|
||||
writeln('Error: ',i);
|
||||
halt(1);
|
||||
end;
|
||||
|
||||
var
|
||||
b1,b2 : byte;
|
||||
w1 : word;
|
||||
d1 : dword;
|
||||
q1 : qword;
|
||||
begin
|
||||
b1:=2;
|
||||
b2:=15;
|
||||
b1:=ror(b1,b2);
|
||||
if b1<>4 then
|
||||
do_error(1000);
|
||||
|
||||
w1:=1;
|
||||
b2:=29;
|
||||
w1:=ror(w1,b2);
|
||||
if w1<>$8 then
|
||||
do_error(1001);
|
||||
|
||||
d1:=$400;
|
||||
b2:=60;
|
||||
d1:=ror(d1,b2);
|
||||
if d1<>$4000 then
|
||||
do_error(1002);
|
||||
|
||||
q1:=$80000000000;
|
||||
b2:=125;
|
||||
q1:=ror(q1,b2);
|
||||
if q1<>$400000000000 then
|
||||
do_error(1003);
|
||||
|
||||
b1:=$81;
|
||||
b2:=14;
|
||||
b1 := rol(b1, b2);
|
||||
if (b1 <> $60) then
|
||||
do_error(2000);
|
||||
|
||||
|
||||
w1:=$8001;
|
||||
b2:=22;
|
||||
w1:=rol(w1,b2);
|
||||
if w1<>$60 then
|
||||
do_error(2001);
|
||||
|
||||
d1:=$80000001;
|
||||
b2:=38;
|
||||
d1:=rol(d1,b2);
|
||||
if d1<>$60 then
|
||||
do_error(2002);
|
||||
|
||||
q1:=$8000000000000001;
|
||||
b2:=70;
|
||||
q1:=rol(q1,b2);
|
||||
if q1<>$60 then
|
||||
do_error(2003);
|
||||
|
||||
writeln('ok');
|
||||
end.
|
||||
Loading…
Reference in New Issue
Block a user