+ added compile time const evaluation for Bsf/Bsr(const) as well

git-svn-id: trunk@35941 -
This commit is contained in:
nickysn 2017-04-24 20:35:08 +00:00
parent da8e72b4fe
commit 5393daa994
3 changed files with 1567 additions and 0 deletions

1
.gitattributes vendored
View File

@ -12104,6 +12104,7 @@ tests/test/tblock2a.pp svneol=native#text/plain
tests/test/tbopr.pp svneol=native#text/plain
tests/test/tbrtlevt.pp svneol=native#text/plain
tests/test/tbsx1.pp svneol=native#text/plain
tests/test/tbsx2.pp svneol=native#text/plain
tests/test/tcas128.pp svneol=native#text/pascal
tests/test/tcase0.pp svneol=native#text/pascal
tests/test/tcase1.pp svneol=native#text/plain

View File

@ -2534,6 +2534,42 @@ implementation
in_ror_x,
in_ror_x_y :
result:=handle_const_rox;
in_bsf_x:
begin
if left.nodetype=ordconstn then
begin
case left.resultdef.size of
1:
result:=cordconstnode.create(BsfByte(Byte(tordconstnode(left).value.uvalue)),resultdef,false);
2:
result:=cordconstnode.create(BsfWord(Word(tordconstnode(left).value.uvalue)),resultdef,false);
4:
result:=cordconstnode.create(BsfDWord(DWord(tordconstnode(left).value.uvalue)),resultdef,false);
8:
result:=cordconstnode.create(BsfQWord(QWord(tordconstnode(left).value.uvalue)),resultdef,false);
else
internalerror(2017042401);
end;
end;
end;
in_bsr_x :
begin
if left.nodetype=ordconstn then
begin
case left.resultdef.size of
1:
result:=cordconstnode.create(BsrByte(Byte(tordconstnode(left).value.uvalue)),resultdef,false);
2:
result:=cordconstnode.create(BsrWord(Word(tordconstnode(left).value.uvalue)),resultdef,false);
4:
result:=cordconstnode.create(BsrDWord(DWord(tordconstnode(left).value.uvalue)),resultdef,false);
8:
result:=cordconstnode.create(BsrQWord(QWord(tordconstnode(left).value.uvalue)),resultdef,false);
else
internalerror(2017042401);
end;
end;
end;
in_popcnt_x :
begin
if left.nodetype=ordconstn then

1530
tests/test/tbsx2.pp Normal file

File diff suppressed because it is too large Load Diff