mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 00:20:16 +02:00
* don't do MovOpMov2MovOp optimization reducing bit width of the operation if symbols are involved, resolves #40269
This commit is contained in:
parent
835375e7e0
commit
7afde9fe77
@ -5266,6 +5266,10 @@ unit aoptx86;
|
||||
((topsize2memsize[taicpu(hp1).opsize]<= topsize2memsize[taicpu(hp2).opsize]) or
|
||||
{ opsize matters for these opcodes, we could probably work around this, but it is not worth the effort }
|
||||
((taicpu(hp1).opcode<>A_SHL) and (taicpu(hp1).opcode<>A_SHR) and (taicpu(hp1).opcode<>A_SAR))
|
||||
) and
|
||||
{ if ref contains a symbol, we cannot change its size to a smaller size }
|
||||
((taicpu(p).oper[0]^.typ<>top_ref) or (taicpu(p).oper[0]^.ref^.symbol=nil) or
|
||||
(topsize2memsize[taicpu(p).opsize]<=topsize2memsize[taicpu(hp2).opsize])
|
||||
)
|
||||
{$ifdef i386}
|
||||
{ byte registers of esi, edi, ebp, esp are not available on i386 }
|
||||
|
9
tests/webtbs/tw40269.pp
Normal file
9
tests/webtbs/tw40269.pp
Normal file
@ -0,0 +1,9 @@
|
||||
{ %opt=-O2 }
|
||||
var
|
||||
a, b: int32;
|
||||
x, y: byte;
|
||||
begin
|
||||
x := PtrUint(@a) mod 32;
|
||||
y := PtrUint(@b) mod 32;
|
||||
writeln(x, ' ', y);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user