* set register size correctly for popcnt(<byte>), resolves

(cherry picked from commit ed158f1e52)

# Conflicts:
#	.gitattributes
This commit is contained in:
florian 2020-07-22 20:47:12 +00:00
parent b9090f9117
commit 055283f9cb
2 changed files with 18 additions and 0 deletions
compiler/x86
tests/webtbs

View File

@ -1011,6 +1011,12 @@ implementation
emit_reg_reg(A_POPCNT,TCGSize2OpSize[opsize],left.location.register,location.register)
else
emit_ref_reg(A_POPCNT,TCGSize2OpSize[opsize],left.location.reference,location.register);
if resultdef.size=1 then
begin
location.size:=OS_8;
location.register:=cg.makeregsize(current_asmdata.CurrAsmList,location.register,location.size);
end;
end;

12
tests/webtbs/tw37400.pp Normal file
View File

@ -0,0 +1,12 @@
{ %cpu=i386,x86_64 }
{ %opt=-Cpcoreavx2 }
function popc ( a, b: byte):byte;
var z,v: byte;
begin
z:=a+b;
v:=popcnt(z); //-- this line
popc:=v;
end;
begin
end.