{"id":2224755,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2224755/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/aeM0MfvpKEvUniYx@tucnak/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<aeM0MfvpKEvUniYx@tucnak>","date":"2026-04-18T07:35:13","name":"bitintlower: Padding bit fixes, part 2 [PR123635]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5b0fe9c9dd5aeb695dd8ebc7e41bbc75ddd3a033","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.1/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/aeM0MfvpKEvUniYx@tucnak/mbox/","series":[{"id":500426,"url":"http://patchwork.ozlabs.org/api/1.1/series/500426/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500426","date":"2026-04-18T07:35:13","name":"bitintlower: Padding bit fixes, part 2 [PR123635]","version":1,"mbox":"http://patchwork.ozlabs.org/series/500426/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224755/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224755/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=AR6w7KB6;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=AR6w7KB6","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fyNpQ5Yp9z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 17:35:56 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 929584CD2019\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 07:35:54 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 6EA864B920A8\n for <gcc-patches@gcc.gnu.org>; Sat, 18 Apr 2026 07:35:22 +0000 (GMT)","from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-87pNIPxOMTuWx1MlxNfisA-1; Sat,\n 18 Apr 2026 03:35:20 -0400","from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 5D9BB19560B2; Sat, 18 Apr 2026 07:35:18 +0000 (UTC)","from tucnak.zalov.cz (unknown [10.44.33.129])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 6BE9E1800352; Sat, 18 Apr 2026 07:35:17 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 63I7ZEH43118838\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Sat, 18 Apr 2026 09:35:14 +0200","(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63I7ZD9D3118837;\n Sat, 18 Apr 2026 09:35:13 +0200"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 929584CD2019","OpenDKIM Filter v2.11.0 sourceware.org 6EA864B920A8"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 6EA864B920A8","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 6EA864B920A8","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776497722; cv=none;\n b=QJBSQFeV0UpqiZKzCgSvSv69q8wqnLkzgTgBmZwPUBiNcep93l293YCdPMDMzCnGnWAmexeq9RhgLJdVEdO5mhpUGRreykFzuTyM2b68RZqhBbvJUWLnMBBkrP6OeeXRFYB5p5s8r9owfnPc2JRpVebG0skpIoCUGdNnnamLQ3s=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776497722; c=relaxed/simple;\n bh=FxDL3/bdBiIm8/T/tEwh8xLZzPaSpePuxDCtKg9SpWo=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=VKXFhoNmPhUGNJVsskpEggNyugVOon+ukd3sJk4CslfBgxegJ39JDAkzF7VBODXR0baGepeAP4xzmsGtWH4Ru/VwWkCKtVCe1ykt4beoVqpLQxFvCLigtLsPf9Vy+CPvOXmiTq2QPp5/p9UMcYtrFK3t0uCKmwv72JOn7+67AWY=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776497722;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=sHkSEDPsHAeD9YQartfFDO+MMMlVNqEL6ZmwfV8pe3M=;\n b=AR6w7KB6ggn7M6xzKcQgKls+D0YvkcYd2TayRsudOVRnIeQCgqrSX0wC2zJXstl6NbOBZJ\n wEQ/XqibtExMR3zVY20mhnxbLh1nuLZLbQsaaN9GP+421Bi6L98JxCx5sJrCY+fxFj8O4i\n 0kR3TC96DQfBih/W/nFpvHsdErTXUkI=","X-MC-Unique":"87pNIPxOMTuWx1MlxNfisA-1","X-Mimecast-MFC-AGG-ID":"87pNIPxOMTuWx1MlxNfisA_1776497718","Date":"Sat, 18 Apr 2026 09:35:13 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Richard Biener <rguenther@suse.de>,\n Andrew Pinski <andrew.pinski@oss.qualcomm.com>","Cc":"gcc-patches@gcc.gnu.org,\n Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>,\n Palmer Dabbelt <palmer@dabbelt.com>, Robin Dapp <rdapp.gcc@gmail.com>","Subject":"[PATCH] bitintlower: Padding bit fixes, part 2 [PR123635]","Message-ID":"<aeM0MfvpKEvUniYx@tucnak>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.111","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"vvZr5DoUU0hQY983cT2P0us3_knd3Xv9fDdzYvvaOyM_1776497718","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Hi!\n\nSo, I've tried the (extremely slow) cfarm95 RISCV box and found that my\nearlier PR123635 patch actually broke stuff.\nFirst thing I found is that __riscv__ macro I was using in bitintext.h\ndoesn't exist and fixed that.\nI wrote two new tests (88/89, one for a problem I'll talk about later and\none to cover shifts) and fixed one nit in 86/87.  All the testing\nhas been done on this modified tests and using\nmake -j8 -k check-gcc RUNTESTFLAGS=\"dg.exp='*bitint* pr112673.c builtin-stdc-bit-*.c pr112566-2.c pr112511.c pr116588.c pr116003.c pr113693.c pr113602.c flex-array-counted-by-7.c' dg-torture.exp='*bitint* pr116480-2.c pr114312.c pr114121.c' dfp.exp=*bitint* vect.exp='vect-early-break_99-pr113287.c' tree-ssa.exp=pr113735.c\"\nOn pre-r16-8678 source, the FAILs were\nFAIL: gcc.dg/torture/bitint-82.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-82.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-83.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-83.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-86.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-86.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-87.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-87.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-88.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-88.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-89.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-89.c   -O2  execution test\ni.e. all the bitintext.h tests for padding bits (except bitint-84.c),\nplus gcc.dg/bitint-39.c gcc.dg/torture/bitint-37.c tests timing out\n(but those timed out due to extremely slow CPU all the time, and are\nreally large and not padding related, so let's ignore that).\nNow, with r16-8678 (i.e. vanilla trunk), the FAILs are\nFAIL: gcc.dg/torture/bitint-42.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-42.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-62.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-62.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-66.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-68.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-68.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-79.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-80.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-81.c   -O0  execution test\nFAIL: gcc.dg/torture/bitint-81.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-83.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-87.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-88.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-89.c   -O2  execution test\nSo, I broke some tests (42, 62, 66, 68, 79, 80, 81) and\nfixed a few too (82, 86 and at -O0 only 83, 87, 88, 89).\n\nI've debugged the regressions I've caused and the problem is on large/huge\n_BitInt bit-field stores, we can't clear any padding bits in those cases,\nbit-fields never have paddings (C FE rejects oversized bit-fields and the\npadding is used for further fields or is merely structure padding rather\nthan padding of the bit-field).\nThe following patch fixes more than that.  There is another problem\n(bitint-88.c tries to test that), when we merge some operation (e.g.\naddition) of some narrower large/huge _BitInt with sign extension from\nit into a wider unsigned _BitInt (e.g. signed _BitInt(513) addition\nsign extended into unsigned _BitInt(1025)), the earlier solution for\nthe extra padding limb doesn't work properly, we do want to sign\nextend the bit 512 into bits 513-1024, but the padding bits above\nthat need to be cleared.  For the limb containing bit 1024 we do it\nright, it is sign extension but outside of loop, so should cast the\nall zeros or all ones value to unsigned long : 1 and back, but\nthe limb containing bit 1088 needs to be just zeroed.\nAnd the patch also adds the bitint_ext_full handling to RSHIFT_EXPR\nand LSHIFT_EXPR code.\n\nWith this, the FAILs on riscv64-linux are\nFAIL: gcc.dg/torture/bitint-87.c   -O2  execution test\nFAIL: gcc.dg/torture/bitint-89.c   -O2  execution test\nwhich means I need to debug further the multiplication/division/modulo/\ncasts from float and there is some remaining problem with the shifts.\nPlus something not covered yet, the overflow builtins/ubsan (all of +-*).\n\nIn any case, because this patch doesn't regress on riscv64-linux any\nactual non-padding tests and even these two aren't regressions, I'd\nlike to commit this patch separately and fix stuff incrementally,\nto unbreak the bit-field stores.\n\nBootstrapped/regtested on x86_64-linux and i686-linux (plus tested on\nriscv64-linux, see above), ok for trunk?\n\n2026-04-18  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR middle-end/123635\n\t* gimple-lower-bitint.cc (bitint_precision_kind): Assert the current\n\tassumptions, that bitint_ext_full for abi_limb_prec > limb_prec is\n\tsupported only when abi_limb_prec is limb_Prec * 2 and it is not\n\tbig endian in that case.\n\t(bitint_large_huge::lower_mergeable_stmt): Don't set separate_ext\n\tfir bitint_ext_full for bit-field stores.  Guard the condition\n\ton an extra limb of padding bits to be extended rather than including\n\tearlier extensions in that too.  If already sign extending before\n\tand type is unsigned, set zero_ms_limb instead and later handle it.\n\t(bitint_large_huge::lower_shift_stmt): Handle bitint_ext_full.\n\n\t* gcc.dg/bitintext.h: Use __riscv macro instead of __riscv__.\n\t* gcc.dg/torture/bitint-86.c: Remove bogus sync_char_short\n\teffective target.\n\t* gcc.dg/torture/bitint-87.c: Likewise.\n\t* gcc.dg/torture/bitint-88.c: New test.\n\t* gcc.dg/torture/bitint-89.c: New test.\n\n\n\tJakub","diff":"--- gcc/gimple-lower-bitint.cc.jj\t2026-04-17 10:03:53.011966091 +0200\n+++ gcc/gimple-lower-bitint.cc\t2026-04-17 23:13:43.698349335 +0200\n@@ -115,6 +115,12 @@ bitint_precision_kind (int prec)\n   if (!abi_limb_prec)\n     abi_limb_prec\n       = GET_MODE_PRECISION (as_a <scalar_int_mode> (info.abi_limb_mode));\n+  /* For bitint_ext_full with different limb_mode from abi_limb_mode we\n+     currently only support only abi_limb_mode twice the precision of\n+     limb_mode, and don't support big endian in that case either.  */\n+  gcc_assert (bitint_extended != bitint_ext_full\n+\t      || (abi_limb_prec == 2 * limb_prec\n+\t\t  && !bitint_big_endian));\n   if (!huge_min_prec)\n     {\n       if (4 * limb_prec >= MAX_FIXED_MODE_SIZE)\n@@ -2877,15 +2883,24 @@ bitint_large_huge::lower_mergeable_stmt\n     = (prec != (unsigned) TYPE_PRECISION (type)\n        && (CEIL ((unsigned) TYPE_PRECISION (type), limb_prec)\n \t   > CEIL (prec, limb_prec)));\n+  bool zero_ms_limb = false;\n   if (bitint_extended == bitint_ext_full\n       && !eq_p\n+      && !nlhs\n       && abi_limb_prec > limb_prec\n       && ((CEIL ((unsigned) TYPE_PRECISION (type), abi_limb_prec)\n-\t   * abi_limb_prec / limb_prec) > CEIL (prec, limb_prec)))\n+\t   * abi_limb_prec / limb_prec)\n+\t  > CEIL ((unsigned) TYPE_PRECISION (type), limb_prec)))\n     {\n       if (prec == (unsigned) TYPE_PRECISION (type))\n-\tsext = !TYPE_UNSIGNED (type);\n-      separate_ext = true;\n+\t{\n+\t  sext = !TYPE_UNSIGNED (type);\n+\t  separate_ext = true;\n+\t}\n+      else if (TYPE_UNSIGNED (type) && sext)\n+\tzero_ms_limb = true;\n+      else\n+\tseparate_ext = true;\n     }\n   unsigned dst_idx_off = 0;\n   if (separate_ext && bitint_big_endian)\n@@ -3124,7 +3139,10 @@ bitint_large_huge::lower_mergeable_stmt\n       kind = bitint_precision_kind (type);\n       unsigned start = CEIL (prec, limb_prec);\n       prec = TYPE_PRECISION (type);\n-      if (bitint_extended == bitint_ext_full && abi_limb_prec > limb_prec)\n+      if (bitint_extended == bitint_ext_full\n+\t  && !nlhs\n+\t  && !zero_ms_limb\n+\t  && abi_limb_prec > limb_prec)\n \t{\n \t  prec = CEIL (prec, abi_limb_prec) * abi_limb_prec;\n \t  kind = bitint_precision_kind (prec);\n@@ -3289,6 +3307,26 @@ bitint_large_huge::lower_mergeable_stmt\n \t    }\n \t}\n     }\n+  if (zero_ms_limb)\n+    {\n+      tree p2 = build_int_cst (sizetype,\n+\t\t\t       CEIL ((unsigned) TYPE_PRECISION (type),\n+\t\t\t\t     abi_limb_prec)\n+\t\t\t       * abi_limb_prec / limb_prec - 1);\n+      tree l = limb_access (lhs_type, lhs, p2, true);\n+      g = gimple_build_assign (l, build_zero_cst (m_limb_type));\n+      insert_before (g);\n+      if (eh)\n+\t{\n+\t  maybe_duplicate_eh_stmt (g, stmt);\n+\t  if (eh_pad)\n+\t    {\n+\t      edge e = split_block (gsi_bb (m_gsi), g);\n+\t      m_gsi = gsi_after_labels (e->dest);\n+\t      add_eh_edge (e->src, find_edge (gimple_bb (stmt), eh_pad));\n+\t    }\n+\t}\n+    }\n \n   if (gimple_store_p (stmt))\n     {\n@@ -3784,6 +3822,14 @@ bitint_large_huge::lower_shift_stmt (tre\n       if (bitint_big_endian)\n \tg = gimple_build_cond (NE_EXPR, idx, size_zero_node,\n \t\t\t       NULL_TREE, NULL_TREE);\n+      else if (bitint_extended == bitint_ext_full\n+\t       && abi_limb_prec > limb_prec)\n+\t{\n+\t  tree p2 = build_int_cst (sizetype,\n+\t\t\t\t   CEIL (prec, abi_limb_prec)\n+\t\t\t\t   * abi_limb_prec / limb_prec - 1);\n+\t  g = gimple_build_cond (LE_EXPR, idx_next, p2, NULL_TREE, NULL_TREE);\n+\t}\n       else\n \tg = gimple_build_cond (LE_EXPR, idx_next, p, NULL_TREE, NULL_TREE);\n       insert_before (g);\n@@ -3967,7 +4013,60 @@ bitint_large_huge::lower_shift_stmt (tre\n \t  insert_before (g);\n \t  v = add_cast (type, v);\n \t  l = limb_access (TREE_TYPE (lhs), obj, idx, true);\n-\t  g = gimple_build_assign (l, add_cast (m_limb_type, v));\n+\t  v = add_cast (m_limb_type, v);\n+\t  g = gimple_build_assign (l, v);\n+\t  insert_before (g);\n+\t  if (bitint_extended == bitint_ext_full\n+\t      && abi_limb_prec > limb_prec\n+\t      && (CEIL (prec, abi_limb_prec) * abi_limb_prec\n+\t\t  > CEIL (prec, limb_prec) * limb_prec))\n+\t    {\n+\t      tree p2 = build_int_cst (sizetype,\n+\t\t\t\t       CEIL (prec, abi_limb_prec)\n+\t\t\t\t       * abi_limb_prec / limb_prec - 1);\n+\t      if (TYPE_UNSIGNED (TREE_TYPE (lhs)))\n+\t\tv = build_zero_cst (m_limb_type);\n+\t      else\n+\t\t{\n+\t\t  g = gimple_build_assign (make_ssa_name (m_limb_type),\n+\t\t\t\t\t   RSHIFT_EXPR, v,\n+\t\t\t\t\t   build_int_cst (unsigned_type_node,\n+\t\t\t\t\t\t\t  limb_prec - 1));\n+\t\t  v = gimple_assign_lhs (g);\n+\t\t  insert_before (g);\n+\t\t}\n+\t      l = limb_access (TREE_TYPE (lhs), obj, p2, true);\n+\t      g = gimple_build_assign (l, v);\n+\t      insert_before (g);\n+\t    }\n+\t}\n+      else if (bitint_extended == bitint_ext_full\n+\t       && abi_limb_prec > limb_prec\n+\t       && (CEIL (prec, abi_limb_prec) * abi_limb_prec\n+\t\t   > CEIL (prec, limb_prec) * limb_prec))\n+\t{\n+\t  m_gsi = gsi_after_labels (edge_false->dest);\n+\t  tree p2 = build_int_cst (sizetype,\n+\t\t\t\t   CEIL (prec, abi_limb_prec)\n+\t\t\t\t   * abi_limb_prec / limb_prec - 1);\n+\t  tree v;\n+\t  if (TYPE_UNSIGNED (TREE_TYPE (lhs)))\n+\t    v = build_zero_cst (m_limb_type);\n+\t  else\n+\t    {\n+\t      tree l = limb_access (TREE_TYPE (lhs), obj, p, true);\n+\t      v = make_ssa_name (m_limb_type);\n+\t      g = gimple_build_assign (v, l);\n+\t      insert_before (g);\n+\t      g = gimple_build_assign (make_ssa_name (m_limb_type),\n+\t\t\t\t       RSHIFT_EXPR, v,\n+\t\t\t\t       build_int_cst (unsigned_type_node,\n+\t\t\t\t\t\t      limb_prec - 1));\n+\t      v = gimple_assign_lhs (g);\n+\t      insert_before (g);\n+\t    }\n+\t  tree l = limb_access (TREE_TYPE (lhs), obj, p2, true);\n+\t  g = gimple_build_assign (l, v);\n \t  insert_before (g);\n \t}\n     }\n--- gcc/testsuite/gcc.dg/bitintext.h.jj\t2026-04-15 17:20:57.301896454 +0200\n+++ gcc/testsuite/gcc.dg/bitintext.h\t2026-04-16 19:22:52.303139301 +0200\n@@ -16,7 +16,7 @@ do_copy (void *p, const void *q, __SIZE_\n #define CEIL(x,y) (((x) + (y) - 1) / (y))\n \n /* Promote a _BitInt type to include its padding bits.  */\n-#if defined (__s390x__) || defined(__arm__) || defined(__riscv__)\n+#if defined (__s390x__) || defined(__arm__) || defined(__riscv)\n #define PROMOTED_SIZE(x) sizeof (x)\n #elif defined(__loongarch__)\n #define PROMOTED_SIZE(x) (sizeof (x) > 8 ? CEIL (S (x), 64) * 8 : sizeof (x))\n@@ -25,7 +25,7 @@ do_copy (void *p, const void *q, __SIZE_\n /* Macro to test whether (on targets where psABI requires it) _BitInt\n    with padding bits have those filled with sign or zero extension.  */\n #if defined(__s390x__) || defined(__arm__) || defined(__loongarch__) \\\n-    || defined(__riscv__)\n+    || defined(__riscv)\n #define BEXTC1(x, uns) \\\n   do {\t\t\t\t\t\t\t  \\\n     uns _BitInt(PROMOTED_SIZE (x) * __CHAR_BIT__) __x;\t  \\\n--- gcc/testsuite/gcc.dg/torture/bitint-86.c.jj\t2026-04-15 17:20:57.302099957 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-86.c\t2026-04-16 18:27:01.228764387 +0200\n@@ -1,6 +1,5 @@\n /* PR middle-end/123635 */\n /* { dg-do run { target bitint } } */\n-/* { dg-require-effective-target sync_char_short } */\n /* { dg-options \"-std=c23 -pedantic-errors\" } */\n /* { dg-skip-if \"\" { ! run_expensive_tests }  { \"*\" } { \"-O0\" \"-O2\" } } */\n /* { dg-skip-if \"\" { ! run_expensive_tests } { \"-flto\" } { \"\" } } */\n--- gcc/testsuite/gcc.dg/torture/bitint-87.c.jj\t2026-04-15 17:20:57.302186204 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-87.c\t2026-04-16 18:27:06.213681901 +0200\n@@ -1,6 +1,5 @@\n /* PR middle-end/123635 */\n /* { dg-do run { target bitint } } */\n-/* { dg-require-effective-target sync_char_short } */\n /* { dg-options \"-std=c23 -pedantic-errors\" } */\n /* { dg-skip-if \"\" { ! run_expensive_tests }  { \"*\" } { \"-O0\" \"-O2\" } } */\n /* { dg-skip-if \"\" { ! run_expensive_tests } { \"-flto\" } { \"\" } } */\n--- gcc/testsuite/gcc.dg/torture/bitint-88.c.jj\t2026-04-16 17:26:24.531981977 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-88.c\t2026-04-16 18:27:11.196599442 +0200\n@@ -0,0 +1,95 @@\n+/* PR middle-end/123635 */\n+/* { dg-do run { target bitint } } */\n+/* { dg-options \"-std=c23 -pedantic-errors\" } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests }  { \"*\" } { \"-O0\" \"-O2\" } } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests } { \"-flto\" } { \"\" } } */\n+\n+#if __BITINT_MAXWIDTH__ >= 1025\n+unsigned _BitInt(513) a, b, c, d;\n+_BitInt(513) e, f, g, h;\n+unsigned _BitInt(1025) i, j, k, l;\n+_BitInt(1025) m, n, o, p;\n+#endif\n+\n+#include \"../bitintext.h\"\n+\n+#if __BITINT_MAXWIDTH__ >= 1025\n+[[gnu::noipa]] void\n+f1 (_BitInt(513) q, _BitInt(513) r, _BitInt(513) s,\n+    unsigned _BitInt(513) t, unsigned _BitInt(513) u, unsigned _BitInt(513) v)\n+{\n+  a = q + r;\n+  BEXTC (a);\n+  b = r + s;\n+  BEXTC (b);\n+  c = q - r;\n+  BEXTC (c);\n+  d = q - s;\n+  BEXTC (d);\n+  e = t + u;\n+  BEXTC (e);\n+  f = u + v;\n+  BEXTC (f);\n+  g = t - u;\n+  BEXTC (g);\n+  h = t - v;\n+  BEXTC (h);\n+}\n+\n+[[gnu::noipa]] void\n+f2 (_BitInt(513) q, _BitInt(513) r, _BitInt(513) s,\n+    unsigned _BitInt(513) t, unsigned _BitInt(513) u, unsigned _BitInt(513) v)\n+{\n+  i = q + r;\n+  BEXTC (i);\n+  j = r + s;\n+  BEXTC (j);\n+  k = q - r;\n+  BEXTC (k);\n+  l = q - s;\n+  BEXTC (l);\n+  m = t + u;\n+  BEXTC (m);\n+  n = u + v;\n+  BEXTC (n);\n+  o = t - u;\n+  BEXTC (o);\n+  p = t - v;\n+  BEXTC (p);\n+}\n+#endif\n+\n+int\n+main ()\n+{\n+#if __BITINT_MAXWIDTH__ >= 1025\n+  __builtin_memset (&a, 0x55, sizeof (a));\n+  __builtin_memset (&b, 0xaa, sizeof (b));\n+  __builtin_memset (&c, 0x55, sizeof (c));\n+  __builtin_memset (&d, 0xaa, sizeof (d));\n+  __builtin_memset (&e, 0x55, sizeof (e));\n+  __builtin_memset (&f, 0xaa, sizeof (f));\n+  __builtin_memset (&g, 0x55, sizeof (g));\n+  __builtin_memset (&h, 0xaa, sizeof (h));\n+  f1 (-2639616085193412675089727272130019765984398127278861998378045997173219392866835944828454559654047247059773556852593471531433454810831298259785611283536204wb,\n+      -7234121192495298112713936268702056205915537824658323839255206188456944966709752205781440683757949161649123152428620619997014209098183677328840647884700332wb,\n+      8654283549227219676537451326576929768614001427323560383705131223498505581982738964879437520020436012891649083646965651378407397436785749860023553778646861wb,\n+      15046745594550617619205422464231805109110883864578289024439083517871820578179553927615539526791313634437787081814763432804808038115388367331529035246240655uwb,\n+      20633637828717837096174917874088391607464281656818868213468970773994599068609617673436080725569780340050358299419252926775025136778754971701553110169281151uwb,\n+      513612209045189503622076474995216606086383139671427104179978688982034117764664711277072795083902951564358998498109412142322138933760173628255697435284781uwb);\n+  __builtin_memset (&i, 0x55, sizeof (i));\n+  __builtin_memset (&j, 0xaa, sizeof (j));\n+  __builtin_memset (&k, 0x55, sizeof (k));\n+  __builtin_memset (&l, 0xaa, sizeof (l));\n+  __builtin_memset (&m, 0x55, sizeof (m));\n+  __builtin_memset (&n, 0xaa, sizeof (n));\n+  __builtin_memset (&o, 0x55, sizeof (o));\n+  __builtin_memset (&p, 0xaa, sizeof (p));\n+  f2 (-2639616085193412675089727272130019765984398127278861998378045997173219392866835944828454559654047247059773556852593471531433454810831298259785611283536204wb,\n+      -7234121192495298112713936268702056205915537824658323839255206188456944966709752205781440683757949161649123152428620619997014209098183677328840647884700332wb,\n+      8654283549227219676537451326576929768614001427323560383705131223498505581982738964879437520020436012891649083646965651378407397436785749860023553778646861wb,\n+      15046745594550617619205422464231805109110883864578289024439083517871820578179553927615539526791313634437787081814763432804808038115388367331529035246240655uwb,\n+      20633637828717837096174917874088391607464281656818868213468970773994599068609617673436080725569780340050358299419252926775025136778754971701553110169281151uwb,\n+      513612209045189503622076474995216606086383139671427104179978688982034117764664711277072795083902951564358998498109412142322138933760173628255697435284781uwb);\n+#endif\n+}\n--- gcc/testsuite/gcc.dg/torture/bitint-89.c.jj\t2026-04-16 17:38:27.367050011 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-89.c\t2026-04-16 18:27:16.800506707 +0200\n@@ -0,0 +1,99 @@\n+/* PR middle-end/123635 */\n+/* { dg-do run { target bitint } } */\n+/* { dg-options \"-std=c23 -pedantic-errors\" } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests }  { \"*\" } { \"-O0\" \"-O2\" } } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests } { \"-flto\" } { \"\" } } */\n+\n+#if __BITINT_MAXWIDTH__ >= 1025\n+_BitInt(513) a, b, c, d;\n+unsigned _BitInt(513) e, f, g, h;\n+_BitInt(513) i, j, k, l;\n+unsigned _BitInt(513) m, n, o, p;\n+#endif\n+\n+#include \"../bitintext.h\"\n+\n+#if __BITINT_MAXWIDTH__ >= 1025\n+[[gnu::noipa]] void\n+f1 (_BitInt(513) q, _BitInt(513) r, _BitInt(513) s,\n+    unsigned _BitInt(513) t, unsigned _BitInt(513) u, unsigned _BitInt(513) v,\n+    int z)\n+{\n+  a = q >> 23;\n+  BEXTC (a);\n+  b = r << 23;\n+  BEXTC (b);\n+  c = r >> z;\n+  BEXTC (c);\n+  d = s << z;\n+  BEXTC (d);\n+  e = t >> 23;\n+  BEXTC (e);\n+  f = u << 23;\n+  BEXTC (f);\n+  g = t >> z;\n+  BEXTC (g);\n+  h = v << z;\n+  BEXTC (h);\n+}\n+\n+[[gnu::noipa]] void\n+f2 (_BitInt(513) q, _BitInt(513) r, _BitInt(513) s,\n+    unsigned _BitInt(513) t, unsigned _BitInt(513) u, unsigned _BitInt(513) v,\n+    int z)\n+{\n+  i = q >> 67;\n+  BEXTC (i);\n+  j = r << 67;\n+  BEXTC (j);\n+  k = q >> z;\n+  BEXTC (k);\n+  l = s << z;\n+  BEXTC (l);\n+  m = t >> 67;\n+  BEXTC (m);\n+  n = u << 67;\n+  BEXTC (n);\n+  o = t >> z;\n+  BEXTC (o);\n+  p = v << z;\n+  BEXTC (p);\n+}\n+#endif\n+\n+int\n+main ()\n+{\n+#if __BITINT_MAXWIDTH__ >= 1025\n+  __builtin_memset (&a, 0x55, sizeof (a));\n+  __builtin_memset (&b, 0xaa, sizeof (b));\n+  __builtin_memset (&c, 0x55, sizeof (c));\n+  __builtin_memset (&d, 0xaa, sizeof (d));\n+  __builtin_memset (&e, 0x55, sizeof (e));\n+  __builtin_memset (&f, 0xaa, sizeof (f));\n+  __builtin_memset (&g, 0x55, sizeof (g));\n+  __builtin_memset (&h, 0xaa, sizeof (h));\n+  f1 (-2639616085193412675089727272130019765984398127278861998378045997173219392866835944828454559654047247059773556852593471531433454810831298259785611283536204wb,\n+      -7234121192495298112713936268702056205915537824658323839255206188456944966709752205781440683757949161649123152428620619997014209098183677328840647884700332wb,\n+      8654283549227219676537451326576929768614001427323560383705131223498505581982738964879437520020436012891649083646965651378407397436785749860023553778646861wb,\n+      15046745594550617619205422464231805109110883864578289024439083517871820578179553927615539526791313634437787081814763432804808038115388367331529035246240655uwb,\n+      20633637828717837096174917874088391607464281656818868213468970773994599068609617673436080725569780340050358299419252926775025136778754971701553110169281151uwb,\n+      513612209045189503622076474995216606086383139671427104179978688982034117764664711277072795083902951564358998498109412142322138933760173628255697435284781uwb,\n+      129);\n+  __builtin_memset (&i, 0x55, sizeof (i));\n+  __builtin_memset (&j, 0xaa, sizeof (j));\n+  __builtin_memset (&k, 0x55, sizeof (k));\n+  __builtin_memset (&l, 0xaa, sizeof (l));\n+  __builtin_memset (&m, 0x55, sizeof (m));\n+  __builtin_memset (&n, 0xaa, sizeof (n));\n+  __builtin_memset (&o, 0x55, sizeof (o));\n+  __builtin_memset (&p, 0xaa, sizeof (p));\n+  f2 (2639616085193412675089727272130019765984398127278861998378045997173219392866835944828454559654047247059773556852593471531433454810831298259785611283536204wb,\n+      -7234121192495298112713936268702056205915537824658323839255206188456944966709752205781440683757949161649123152428620619997014209098183677328840647884700332wb,\n+      -8654283549227219676537451326576929768614001427323560383705131223498505581982738964879437520020436012891649083646965651378407397436785749860023553778646861wb,\n+      513612209045189503622076474995216606086383139671427104179978688982034117764664711277072795083902951564358998498109412142322138933760173628255697435284781uwb,\n+      20633637828717837096174917874088391607464281656818868213468970773994599068609617673436080725569780340050358299419252926775025136778754971701553110169281151uwb,\n+      15046745594550617619205422464231805109110883864578289024439083517871820578179553927615539526791313634437787081814763432804808038115388367331529035246240655uwb,\n+      211);\n+#endif\n+}\n","prefixes":[]}