From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id F26733858D32 for ; Mon, 8 May 2023 12:04:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F26733858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2acb6571922so23568371fa.0 for ; Mon, 08 May 2023 05:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683547482; x=1686139482; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=evf7xq85TxxtYmAQZHvKIKrH//TR048u9OlfaMm8bc8=; b=i7vSp0CkCSgQfBs5RI9m+VPj7pdR/761uovfAwrfvGrOhAJ7TPEQRkLKX7DY1Bp6B7 SQVazw41sjQDXJMeyU7I7RLXuDwQK2IFB/JzULrW4WVsqucASmwQTAAEjf9dJS7h6Hge TOntpTwCUgBGZM1ojxxBlnR3QN3oE7phs6Bd07vBCaCq6D3VP/7nHhUbBx79/Dz5Yd5V 5ZgLoTq1kY4upXYZ/9RHkfRVPMYef6f1XGS6QRzqrzE0+jGDsIBVRz4d8iQ2zWdYUTpX LlCTSgke2wFIerDz2l3tkibk1nEBO/J3rJtB5M3Hvy783bfw/mKeCHQVhF3BplyQqLQX cy3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683547482; x=1686139482; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=evf7xq85TxxtYmAQZHvKIKrH//TR048u9OlfaMm8bc8=; b=cokBXOoGxeqGxROkLnbPsOK0h5Ed4EEjsAn9gxLga17xe0Iw5WCSYAPE2fsHXp852a h80wpljZ8Tgwb6pwd6Xnhljjs7IKWuTKSZppSq/CfULDxEG5G8/xqcnrnHOntARdSjFe foJ/e16C8XDFjIUjSmIJgjcThtT+kxTaMieXzD0SrD9uZ5+o0IxJF1e4bjUWEOcEIxhn 61uJgD2B19aDz7taEgJjzKcg4uKtU80cItufwsLV+Z7ypg1IGuICPqaMCMHVzHJYivkE Ebn9nbWuxvRKzJX4SfjP6B9kw5TD3bvzg6nZR6fiyEYIJIFZN1fHWZusrS5wCMdrbXLc hhHA== X-Gm-Message-State: AC+VfDx1NBSGzsqMERrWhpmQ/H9XiItU0oavZznKzAz8mcPtMw2zKg1f 4ghMsMMwUn8kRamuFikdEZoNvMAoodjExghGd9E= X-Google-Smtp-Source: ACHHUZ6qQ236eNik/BGbaknWK5Fs1SiNR/xbczt6Nl0D51Z6Q5efA9quh8H6SvMXe3tnhrTcqBUPTDFkauyu0lY9bOk= X-Received: by 2002:a2e:82c3:0:b0:2ac:8000:1ea0 with SMTP id n3-20020a2e82c3000000b002ac80001ea0mr3115642ljh.26.1683547481927; Mon, 08 May 2023 05:04:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 8 May 2023 14:04:29 +0200 Message-ID: Subject: Re: [PATCH] Bump up precision size to 16 bits. To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner , Will Schmidt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_MANYTO,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Feb 3, 2023 at 8:34=E2=80=AFAM Richard Biener wrote: > > On Thu, Feb 2, 2023 at 6:39 PM Michael Meissner via Gcc-patches > wrote: > > > > The new __dmr type that is being added as a possible future PowerPC ins= truction > > "is being added" means this feature is already in GCC 13? > > > set bumps into a structure field size issue. The size of the __dmr typ= e is 1024 bits. > > The precision field in tree_type_common is currently 10 bits, so if you= store > > 1,024 into field, you get a 0 back. When you get 0 in the precision fi= eld, the > > ccp pass passes this 0 to sext_hwi in hwint.h. That function in turn g= enerates > > a shift that is equal to the host wide int bit size, which is undefined= as > > machine dependent for shifting in C/C++. > > > > int shift =3D HOST_BITS_PER_WIDE_INT - prec; > > return ((HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) src << shift)) = >> shift; > > > > It turns out the x86_64 where I first did my tests returns the original= input > > before the two shifts, while the PowerPC always returns 0. In the ccp = pass, the > > original input is -1, and so it worked. When I did the runs on the Pow= erPC, the > > result was 0, which ultimately led to the failure. > > > > In addition, once the precision field is larger, it will help PR C/1029= 89 (C2x > > _BigInt) as well as the implementation of the SET_TYPE_VECTOR_SUBPARTS = macro. > > > > I bootstraped various PowerPC compilers (power10 LE, power9 LE, power8 = BE) > > along with an x86_64 build. There were no regressions. My proposed pa= tches > > for the __dmr type now run fine. Can I install this into the master br= anch for > > GCC 13? > > ... because since we're in stage4 this should fix a regression or at leas= t a > bug that's like ice-on-valid or wrong-code? > > Definitely OK for stage1. I have pushed this now after bootstrapping / testing on x86_64-unknown-linux-gnu. Richard. > Thanks, > Richard. > > > 2023-02-02 Richard Biener > > Michael Meissner > > > > gcc/ > > > > PR middle-end/108623 > > * hwint.h (sext_hwi): Add assertion against precision 0. > > * tree-core.h (tree_type_common): Bump up precision field to 16= bits. > > Align bit fields > 1 bit to at least an 8-bit boundary. > > --- > > gcc/hwint.h | 1 + > > gcc/tree-core.h | 24 ++++++++++++------------ > > 2 files changed, 13 insertions(+), 12 deletions(-) > > > > diff --git a/gcc/hwint.h b/gcc/hwint.h > > index e31aa006fa4..ba92efbfc25 100644 > > --- a/gcc/hwint.h > > +++ b/gcc/hwint.h > > @@ -277,6 +277,7 @@ ctz_or_zero (unsigned HOST_WIDE_INT x) > > static inline HOST_WIDE_INT > > sext_hwi (HOST_WIDE_INT src, unsigned int prec) > > { > > + gcc_checking_assert (prec !=3D 0); > > if (prec =3D=3D HOST_BITS_PER_WIDE_INT) > > return src; > > else > > diff --git a/gcc/tree-core.h b/gcc/tree-core.h > > index 8124a1328d4..b71748c6c02 100644 > > --- a/gcc/tree-core.h > > +++ b/gcc/tree-core.h > > @@ -1686,18 +1686,8 @@ struct GTY(()) tree_type_common { > > tree attributes; > > unsigned int uid; > > > > - unsigned int precision : 10; > > - unsigned no_force_blk_flag : 1; > > - unsigned needs_constructing_flag : 1; > > - unsigned transparent_aggr_flag : 1; > > - unsigned restrict_flag : 1; > > - unsigned contains_placeholder_bits : 2; > > - > > + unsigned int precision : 16; > > ENUM_BITFIELD(machine_mode) mode : 8; > > - > > - /* TYPE_STRING_FLAG for INTEGER_TYPE and ARRAY_TYPE. > > - TYPE_CXX_ODR_P for RECORD_TYPE and UNION_TYPE. */ > > - unsigned string_flag : 1; > > unsigned lang_flag_0 : 1; > > unsigned lang_flag_1 : 1; > > unsigned lang_flag_2 : 1; > > @@ -1713,12 +1703,22 @@ struct GTY(()) tree_type_common { > > so we need to store the value 32 (not 31, as we need the zero > > as well), hence six bits. */ > > unsigned align : 6; > > + /* TYPE_STRING_FLAG for INTEGER_TYPE and ARRAY_TYPE. > > + TYPE_CXX_ODR_P for RECORD_TYPE and UNION_TYPE. */ > > + unsigned string_flag : 1; > > + unsigned no_force_blk_flag : 1; > > + > > unsigned warn_if_not_align : 6; > > + unsigned needs_constructing_flag : 1; > > + unsigned transparent_aggr_flag : 1; > > + > > + unsigned contains_placeholder_bits : 2; > > + unsigned restrict_flag : 1; > > unsigned typeless_storage : 1; > > unsigned empty_flag : 1; > > unsigned indivisible_p : 1; > > unsigned no_named_args_stdarg_p : 1; > > - unsigned spare : 15; > > + unsigned spare : 9; > > > > alias_set_type alias_set; > > tree pointer_to; > > -- > > 2.39.1 > > > > > > -- > > Michael Meissner, IBM > > PO Box 98, Ayer, Massachusetts, USA, 01432 > > email: meissner@linux.ibm.com