From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 132AF385840E; Fri, 12 May 2023 08:41:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 132AF385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683880879; bh=UtJKrHUggVjefpN/9PUNE88otjD9JZNUNswZpOiN3s4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ivnghdnYwnOOHUFCDMMF52A2Sq902tSpFsu26nfwY4FBgiZZoxcAEGWVLqisqLNTK wBBl13yV1eGaClyoW7yOVLeVdQRVwu0u5+VHdcfiY63JHkPMqsXuYlv9JdjPWIlmHb 6Z8nKQaqNBL3R4kZe4rCpDJFjRO+VfK1m4AvY4C8= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102989] Implement C2x's n2763 (_BitInt) Date: Fri, 12 May 2023 08:41:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102989 --- Comment #39 from Richard Biener --- (In reply to Jakub Jelinek from comment #38) > I guess there are other options. > If we could make wide_int/widest_int non-POD, one option would be to turn > their storage into a union of the normal small case we use now everywhere > (i.e. fixed one) and one where the val array is not stored directly in the > storage but pointed to by some pointer. > E.g. > class GTY(()) wide_int_storage > { > private: > HOST_WIDE_INT val[WIDE_INT_MAX_ELTS]; > unsigned int len; > unsigned int precision; > could be > private: > union { HOST_WIDE_INT val[WIDE_INT_MAX_ELTS]; HOST_WIDE_INT *valp; }; > unsigned int len; > unsigned int precision; > and decide which one is which based on len > WIDE_INT_MAX_ELTS or somethi= ng > similar. > Or, if we can't affort to make it non-POD, perhaps valp would refer to > obstack destroyed at the end of each pass or something similar. > Another problem is with INTEGER_CST (note, if we lower this stuff before > expansion hopefully we wouldn't need something similar for rtxes). > Currently INTEGER_CST has: > /* The number of HOST_WIDE_INTs in an INTEGER_CST. */ > struct { > /* The number of HOST_WIDE_INTs if the INTEGER_CST is accessed in > its native precision. */ > unsigned char unextended; >=20=20=20=20 > /* The number of HOST_WIDE_INTs if the INTEGER_CST is extended to > wider precisions based on its TYPE_SIGN. */ > unsigned char extended; >=20 > /* The number of HOST_WIDE_INTs if the INTEGER_CST is accessed in > offset_int precision, with smaller integers being extended > according to their TYPE_SIGN. This is equal to one of the two > fields above but is cached for speed. */=20=20=20=20=20=20=20= =20=20=20=20=20 > unsigned char offset;=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > } int_length; > Now, this obviously limits the largest representable constants to 0xFF > HOST_WIDE_INTs, It might be possible to elide 'offset' given it is just a cache. Also 'extended' can possibly be computed as well.=