From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id C368A3858D32 for ; Mon, 10 Jul 2023 11:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C368A3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1688987541; bh=mCRek008vzf7WIHU+nprsClM1wzg8rlzFQBjXBbWgZw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FBM3VrCV9q2mS4z8kF77nvVnpjzNH7pAm5O+TXNnGsv+gJn1sIOzMOPb5pasG2kDk 6T5D02m487xLmKcIy8BB6rXfJtNedW0Hu3CMnyPVA8Ju7jT/MTLBF6pJVTgHhRSrm1 ocgKoQzfV345IikGMsuie9F0sqyKdDhrIaOgNmw0= Received: from [192.168.124.11] (unknown [113.140.11.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id F3F3C65EC5; Mon, 10 Jul 2023 07:12:19 -0400 (EDT) Message-ID: Subject: Pushed: [PATCH v2] vect: Fix vectorized BIT_FIELD_REF for signed bit-fields [PR110557] From: Xi Ruoyao To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Andre Vieira , Jakub Jelinek , Hongtao Liu Date: Mon, 10 Jul 2023 19:12:17 +0800 In-Reply-To: References: <20230707131857.2386125-2-xry111@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 MIME-Version: 1.0 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LIKELY_SPAM_FROM,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 2023-07-10 at 10:33 +0000, Richard Biener wrote: > On Fri, 7 Jul 2023, Xi Ruoyao wrote: >=20 > > If a bit-field is signed and it's wider than the output type, we > > must > > ensure the extracted result sign-extended.=C2=A0 But this was not handl= ed > > correctly. > >=20 > > For example: > >=20 > > =C2=A0=C2=A0=C2=A0 int x : 8; > > =C2=A0=C2=A0=C2=A0 long y : 55; > > =C2=A0=C2=A0=C2=A0 bool z : 1; > >=20 > > The vectorized extraction of y was: > >=20 > > =C2=A0=C2=A0=C2=A0 vect__ifc__49.29_110 =3D > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MEM [(stru= ct Item > > *)vectp_a.27_108]; > > =C2=A0=C2=A0=C2=A0 vect_patt_38.30_112 =3D > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 vect__ifc__49.29_110 & { 922337203685477= 5552, > > 9223372036854775552 }; > > =C2=A0=C2=A0=C2=A0 vect_patt_39.31_113 =3D vect_patt_38.30_112 >> 8; > > =C2=A0=C2=A0=C2=A0 vect_patt_40.32_114 =3D > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VIEW_CONVERT_EXPR(ve= ct_patt_39.31_113); > >=20 > > This is obviously incorrect.=C2=A0 This pach has implemented it as: > >=20 > > =C2=A0=C2=A0=C2=A0 vect__ifc__25.16_62 =3D > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 MEM [(stru= ct Item > > *)vectp_a.14_60]; > > =C2=A0=C2=A0=C2=A0 vect_patt_31.17_63 =3D > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VIEW_CONVERT_EXPR(ve= ct__ifc__25.16_62); > > =C2=A0=C2=A0=C2=A0 vect_patt_32.18_64 =3D vect_patt_31.17_63 << 1; > > =C2=A0=C2=A0=C2=A0 vect_patt_33.19_65 =3D vect_patt_32.18_64 >> 9; >=20 > OK. Pushed r14-2407 and r13-7553. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University