mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 14:09:17 +02:00
* do not generate lea with 16 bit references on x86-64, resolves #40936
This commit is contained in:
parent
28e1daa8e1
commit
e91c8040ea
@ -23,7 +23,7 @@ unit aoptx86;
|
|||||||
|
|
||||||
{$i fpcdefs.inc}
|
{$i fpcdefs.inc}
|
||||||
|
|
||||||
{ $define DEBUG_AOPTCPU}
|
{$define DEBUG_AOPTCPU}
|
||||||
|
|
||||||
{$ifdef EXTDEBUG}
|
{$ifdef EXTDEBUG}
|
||||||
{$define DEBUG_AOPTCPU}
|
{$define DEBUG_AOPTCPU}
|
||||||
@ -12071,8 +12071,8 @@ unit aoptx86;
|
|||||||
end;
|
end;
|
||||||
A_ADD:
|
A_ADD:
|
||||||
begin
|
begin
|
||||||
if (taicpu(next).opsize = S_B) or
|
if { LEA doesn't support 8-bit in general and 16-bit on x86-64 operands }
|
||||||
{ LEA doesn't support 8-bit operands }
|
(taicpu(next).opsize in [S_B{$ifdef x86_64},S_W{$endif x86_64}]) or
|
||||||
(taicpu(next).oper[1]^.typ <> top_reg) or
|
(taicpu(next).oper[1]^.typ <> top_reg) or
|
||||||
{ Must write to a register }
|
{ Must write to a register }
|
||||||
(taicpu(next).oper[0]^.typ = top_ref) then
|
(taicpu(next).oper[0]^.typ = top_ref) then
|
||||||
@ -12083,8 +12083,8 @@ unit aoptx86;
|
|||||||
end;
|
end;
|
||||||
A_SUB:
|
A_SUB:
|
||||||
begin
|
begin
|
||||||
if (taicpu(next).opsize = S_B) or
|
if { LEA doesn't support 8-bit in general and 16-bit on x86-64 operands }
|
||||||
{ LEA doesn't support 8-bit operands }
|
(taicpu(next).opsize in [S_B{$ifdef x86_64},S_W{$endif x86_64}]) or
|
||||||
(taicpu(next).oper[1]^.typ <> top_reg) or
|
(taicpu(next).oper[1]^.typ <> top_reg) or
|
||||||
{ Must write to a register }
|
{ Must write to a register }
|
||||||
(taicpu(next).oper[0]^.typ <> top_const) or
|
(taicpu(next).oper[0]^.typ <> top_const) or
|
||||||
@ -12099,8 +12099,8 @@ unit aoptx86;
|
|||||||
A_SAL,
|
A_SAL,
|
||||||
A_SHL:
|
A_SHL:
|
||||||
begin
|
begin
|
||||||
if (taicpu(next).opsize = S_B) or
|
if { LEA doesn't support 8-bit in general and 16-bit on x86-64 operands }
|
||||||
{ LEA doesn't support 8-bit operands }
|
(taicpu(next).opsize in [S_B{$ifdef x86_64},S_W{$endif x86_64}]) or
|
||||||
(taicpu(next).oper[1]^.typ <> top_reg) or
|
(taicpu(next).oper[1]^.typ <> top_reg) or
|
||||||
{ Must write to a register }
|
{ Must write to a register }
|
||||||
(taicpu(next).oper[0]^.typ <> top_const) or
|
(taicpu(next).oper[0]^.typ <> top_const) or
|
||||||
|
10
tests/webtbs/tw40936.pp
Normal file
10
tests/webtbs/tw40936.pp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{ %norun }
|
||||||
|
var
|
||||||
|
b: boolean;
|
||||||
|
w: word;
|
||||||
|
|
||||||
|
begin
|
||||||
|
b := (w shr 1) <> 0;
|
||||||
|
w := w shl 1; // project1.lpr(7,3) Error: Asm: 16 or 32 bit references not supported
|
||||||
|
if b then w := w xor 1;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user