Re: [PATCH] LoongArch: fix signed overflow in loongarch_emit_int_compare

2022-11-06 Thread Xi Ruoyao via Gcc-patches
On Sun, 2022-11-06 at 09:46 +0800, Lulu Cheng wrote: > I think it should be here: > >   if (!increment && !decrement) > continue; > > + if ((increment && rhs == HOST_WIDE_INT_MAX) > + || (decrement && rhs == HOST_WIDE_INT_MIN)) > + 

Re: [PATCH] LoongArch: fix signed overflow in loongarch_emit_int_compare

2022-11-05 Thread Lulu Cheng
在 2022/11/4 下午2:39, Xi Ruoyao 写道: Signed overflow is an undefined behavior, so we need to prevent it from happening, instead of "checking" the result. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_emit_int_compare): Avoid signed overflow. --- Bootstrapped and regt

[PATCH] LoongArch: fix signed overflow in loongarch_emit_int_compare

2022-11-03 Thread Xi Ruoyao via Gcc-patches
Signed overflow is an undefined behavior, so we need to prevent it from happening, instead of "checking" the result. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_emit_int_compare): Avoid signed overflow. --- Bootstrapped and regtested on loongarch64-linux-gnu. OK fo