Generate slightly better code for logical negation.

This commit is contained in:
Stephen Heumann 2024-03-06 17:04:51 -06:00
parent 24c6e72a83
commit ca0147507b
1 changed files with 6 additions and 5 deletions

11
Gen.pas
View File

@ -5514,16 +5514,17 @@ procedure GenTree {op: icptr};
GenImplied(m_ina);
end; {case pc_ngi}
pc_not: begin
pc_not:
if not operandIsBoolean then begin
lab1 := GenLabel;
GenImpliedForFlags(m_tax);
GenNative(m_beq, relative, lab1, nil, 0);
GenNative(m_lda_imm, immediate, 1, nil, 0);
GenNative(m_lda_imm, immediate, $ffff, nil, 0);
GenLab(lab1);
end; {if}
GenNative(m_eor_imm, immediate, 1, nil, 0);
end; {if}
GenImplied(m_ina);
end {if}
else
GenNative(m_eor_imm, immediate, 1, nil, 0);
end; {case}
end; {GenBntNgiNot}