diff --git a/.gitattributes b/.gitattributes index c3d77bec09..5bc3a2b377 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9730,6 +9730,7 @@ tests/tbs/tb0583a.pp svneol=native#text/plain tests/tbs/tb0584.pp svneol=native#text/pascal tests/tbs/tb0585.pp svneol=native#text/pascal tests/tbs/tb0586.pp svneol=native#text/pascal +tests/tbs/tb0587.pp svneol=native#text/plain tests/tbs/tb205.pp svneol=native#text/plain tests/tbs/ub0060.pp svneol=native#text/plain tests/tbs/ub0069.pp svneol=native#text/plain diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index ec7bd5e1dd..66cf6ed496 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -789,6 +789,10 @@ begin case tx86operand(operands[2]).opsize of S_L : opsize:=S_WL; +{$ifdef x86_64} + S_Q : + opsize:=S_WQ; +{$endif} end; S_B : begin @@ -797,6 +801,10 @@ begin opsize:=S_BW; S_L : opsize:=S_BL; +{$ifdef x86_64} + S_Q : + opsize:=S_BQ; +{$endif} end; end; end; diff --git a/tests/tbs/tb0587.pp b/tests/tbs/tb0587.pp new file mode 100644 index 0000000000..fb36c3ed34 --- /dev/null +++ b/tests/tbs/tb0587.pp @@ -0,0 +1,29 @@ +{ %cpu=x86_64 } +{ %opt=-Aas } + +{$asmmode intel} + +procedure test; +var + i1,i2: int64; + b: shortint; +begin + b:=-128; + asm + movsx rax, b + mov i1,rax + movzx rax, b + mov i2,rax + end ['rax']; + if i1<>-128 then + halt(1); + if i2<>byte(-128) then + halt(2); +end; + +begin + test +end. + + +