From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C23323857709; Wed, 6 Sep 2023 15:57:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C23323857709 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694015857; bh=feRnCG8II0yOZWZ9HvR70bLBdBWfNCDmx3qLt/N2m30=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H1p35fEaf1MKKR+Ifsyx4tsyIkx99WWigBzRVoc0tljz2/ymNgduFxnrUggbikqIh OVpo5YQsUinWmfHqlmplB1jdC1S2HU62ZzAytanrAy/q+aWOX9ApqXxNnCLyTWbNRb RUenqKOb9dlaWLfFrtBI62FojKytEv2yWc+maWGs= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102989] Implement C2x's n2763 (_BitInt) Date: Wed, 06 Sep 2023 15:57:35 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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 #97 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a9d6c7fbeb374365058ffe2b9815d2b4b7193d38 commit r14-3746-ga9d6c7fbeb374365058ffe2b9815d2b4b7193d38 Author: Jakub Jelinek Date: Wed Sep 6 17:27:41 2023 +0200 _BitInt lowering support [PR102989] The following patch adds a new bitintlower lowering pass which lowers m= ost operations on medium _BitInt into operations on corresponding integer types, large _BitInt into straight line code operating on 2 or more limbs and finally huge _BitInt into a loop plus optional straight line code. As the only supported architecture is little-endian, the lowering only supports little-endian for now, because it would be impossible to test = it all for big-endian. Rest is written with any endian support in mind, b= ut of course only little-endian has been actually tested. I hope it is ok to add big-endian support to the lowering pass incrementally later when first big-endian target shows with the backend support. There are 2 possibilities of adding such support, one would be minimal = one, just tweak limb_access function and perhaps one or two other spots and transform there the indexes from little endian (index 0 is least significant) to big endian for just the memory access. Advantage is I think maintainance costs, disadvantage is that the loops will still iterate from 0 to some number of limbs and we'd rely on IVOPTs or something similar changing it later= if needed. Or we could make those indexes endian related everywhere, thou= gh I'm afraid that would be several hundreds of changes. For switches indexed by large/huge _BitInt the patch invokes what the switch lowering pass does (but only on those specific switches, not all of the= m); the switch lowering breaks the switches into clusters and none of the clusters can have a range which doesn't fit into 64-bit UWHI, everything else wi= ll be turned into a tree of comparisons. For clusters normally emitted as smaller switches, because we already have a guarantee that the low .. high rang= e is at most 64 bits, the patch forces subtraction of the low and turns it i= nto a 64-bit switch. This is done before the actual pass starts. Similarly, we cancel lowering of certain constructs like ABS_EXPR, ABSU_EXPR, MIN_EXPR, MAX_EXPR and COND_EXPR and turn those back to simpler compari= sons etc., so that fewer operations need to be lowered later. 2023-09-06 Jakub Jelinek PR c/102989 * Makefile.in (OBJS): Add gimple-lower-bitint.o. * passes.def: Add pass_lower_bitint after pass_lower_complex and pass_lower_bitint_O0 after pass_lower_complex_O0. * tree-pass.h (PROP_gimple_lbitint): Define. (make_pass_lower_bitint_O0, make_pass_lower_bitint): Declare. * gimple-lower-bitint.h: New file. * tree-ssa-live.h (struct _var_map): Add bitint member. (init_var_map): Adjust declaration. (region_contains_p): Handle map->bitint like map->outofssa_p. * tree-ssa-live.cc (init_var_map): Add BITINT argument, initial= ize map->bitint and set map->outofssa_p to false if it is non-NULL. * tree-ssa-coalesce.cc: Include gimple-lower-bitint.h. (build_ssa_conflict_graph): Call build_bitint_stmt_ssa_conflict= s if map->bitint. (create_coalesce_list_for_region): For map->bitint ignore SSA_N= AMEs not in that bitmap, and allow res without default def. (compute_optimized_partition_bases): In map->bitint mode try ha= rd to coalesce any SSA_NAMEs with the same size. (coalesce_bitint): New function. (coalesce_ssa_name): In map->bitint mode, or map->bitmap into used_in_copies and call coalesce_bitint. * gimple-lower-bitint.cc: New file.=