arm64/isel: Avoid signed overflow when handling immediates

Clang incorrectly optimizes this negation with -O2 and causes QBE to
emit 0 in place of INT64_MIN.
This commit is contained in:
Alexey Yerin 2024-08-02 14:39:07 +03:00 committed by Quentin Carbonneaux
parent efcb5465e5
commit bb8de8c633

View file

@ -24,7 +24,7 @@ imm(Con *c, int k, int64_t *pn)
i = Iplo12; i = Iplo12;
if (n < 0) { if (n < 0) {
i = Inlo12; i = Inlo12;
n = -n; n = -(uint64_t)n;
} }
*pn = n; *pn = n;
if ((n & 0x000fff) == n) if ((n & 0x000fff) == n)