Received: from eggs.gnu.org ([2001:4830:134:3::10]:40074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWgb7-0004qg-2D for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:11:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWgb2-0000qJ-16 for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:11:48 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWgb1-0000qC-Mh for qemu-devel@nongnu.org; Mon, 08 Aug 2016 05:11:43 -0400 Received: by mail-wm0-x241.google.com with SMTP id o80so14190971wme.0 for ; Mon, 08 Aug 2016 02:11:43 -0700 (PDT) Sender: Paolo Bonzini References: <20160807011557.31007-1-bobby.prani@gmail.com> From: Paolo Bonzini Message-ID: <0449638a-b8ee-9e37-7d16-e31f0f082f22@redhat.com> Date: Mon, 8 Aug 2016 11:11:41 +0200 MIME-Version: 1.0 In-Reply-To: <20160807011557.31007-1-bobby.prani@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-mips: Fix warning about shifting negative value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pranith Kumar , Aurelien Jarno , Leon Alrae , "open list:All patches CC here" On 07/08/2016 03:15, Pranith Kumar wrote: > With latest clang you get the following warning: > > warning: shifting a negative signed value is undefined [-Wshift-negative-value] > > Fix the warning by changing negative shift to inverse 0 shift. > > Signed-off-by: Pranith Kumar > --- > target-mips/translate.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/target-mips/translate.c b/target-mips/translate.c > index bab52cb..d224de0 100644 > --- a/target-mips/translate.c > +++ b/target-mips/translate.c > @@ -3282,7 +3282,7 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc, int rd, int rs, int rt) > { > TCGv t2 = tcg_temp_new(); > TCGv t3 = tcg_temp_new(); > - tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, -1LL << 63); > + tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, ~0ULL << 63); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, -1LL); > tcg_gen_and_tl(t2, t2, t3); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, 0); > @@ -3298,7 +3298,7 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc, int rd, int rs, int rt) > { > TCGv t2 = tcg_temp_new(); > TCGv t3 = tcg_temp_new(); > - tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, -1LL << 63); > + tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, ~0ULL << 63); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, -1LL); > tcg_gen_and_tl(t2, t2, t3); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, 0); > @@ -3444,7 +3444,7 @@ static void gen_muldiv(DisasContext *ctx, uint32_t opc, > { > TCGv t2 = tcg_temp_new(); > TCGv t3 = tcg_temp_new(); > - tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, -1LL << 63); > + tcg_gen_setcondi_tl(TCG_COND_EQ, t2, t0, ~0ULL << 63); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, -1LL); > tcg_gen_and_tl(t2, t2, t3); > tcg_gen_setcondi_tl(TCG_COND_EQ, t3, t1, 0); > @@ -3791,7 +3791,7 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, > tcg_gen_movi_tl(cpu_gpr[rd], 0); > tcg_gen_br(l3); > gen_set_label(l1); > - tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); > + tcg_gen_brcondi_tl(TCG_COND_NE, t0, ~0ULL << 63, l2); > tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); > tcg_gen_mov_tl(cpu_gpr[rd], t0); > tcg_gen_br(l3); > @@ -3820,7 +3820,7 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc, > TCGLabel *l2 = gen_new_label(); > TCGLabel *l3 = gen_new_label(); > tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); > - tcg_gen_brcondi_tl(TCG_COND_NE, t0, -1LL << 63, l2); > + tcg_gen_brcondi_tl(TCG_COND_NE, t0, ~0ULL << 63, l2); > tcg_gen_brcondi_tl(TCG_COND_NE, t1, -1LL, l2); > gen_set_label(l1); > tcg_gen_movi_tl(cpu_gpr[rd], 0); > No, please no. clang is wrong in putting this under -Wall. Paolo