Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2223774/?format=api
{ "id": 2223774, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223774/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/aeCQ_tJTTwe51o3B@tucnak/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "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": "<aeCQ_tJTTwe51o3B@tucnak>", "date": "2026-04-16T07:34:22", "name": "i386: Fix up TARGET_AVOID_FALSE_DEP_FOR_BMI APX NF splitters [PR124892]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "19e3a8eb1aa70ac63f1a5139a8c68dce6e3aedf9", "submitter": { "id": 671, "url": "http://patchwork.ozlabs.org/api/1.1/people/671/?format=api", "name": "Jakub Jelinek", "email": "jakub@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/aeCQ_tJTTwe51o3B@tucnak/mbox/", "series": [ { "id": 500094, "url": "http://patchwork.ozlabs.org/api/1.1/series/500094/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500094", "date": "2026-04-16T07:34:22", "name": "i386: Fix up TARGET_AVOID_FALSE_DEP_FOR_BMI APX NF splitters [PR124892]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500094/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2223774/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2223774/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=PPo/LIp1;\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=PPo/LIp1", "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 4fx8tJ4Gbrz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 17:35:03 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 539724BA2E1F\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 07:35:01 +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 1E03A4BA543C\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 07:34:32 +0000 (GMT)", "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-28-lRi6J_GoOYySJN31OL6m0w-1; Thu,\n 16 Apr 2026 03:34:27 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 82521180034A; Thu, 16 Apr 2026 07:34:26 +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 E2198180044F; Thu, 16 Apr 2026 07:34:25 +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 63G7YNRU887659\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Thu, 16 Apr 2026 09:34:23 +0200", "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63G7YMcg887656;\n Thu, 16 Apr 2026 09:34:22 +0200" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 539724BA2E1F", "OpenDKIM Filter v2.11.0 sourceware.org 1E03A4BA543C" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 1E03A4BA543C", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 1E03A4BA543C", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776324872; cv=none;\n b=h4t/lEIvR4ZSyN2+uF7oWoSr3H0rqZxoWDy/ReqU3tYLnCrmirPqkqlYZD93qpjKfXC8bkH8IlYg0WfSfAWXONo7d+hiQPpXsmss8GXzji3hqonifORrhvoRyFREMMhRmYceO/HOmnFPEIYCrGrtLNtE7EvPHRo+5G18bAX25mw=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776324872; c=relaxed/simple;\n bh=rrNDadLfo67UVOz6SPTCEbIXg1cPF4byOfz6K7NAdJs=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=hu3i/rWoT9tcJYzbPLdnBRV1X6DkkQsBMeX0l9BQbYU0HIQHSJFXsH5+t3MCG7+ikix0aPSQvmNHVH82X3if58YZWqx23KSR36IdcABaCHWCXqTrJF6zW6Ezn+49ZkUFfyxbfwPE035FadJQkmLI5Im25gkeE9cGUnyCZOBq+jE=", "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=1776324871;\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=wvo3uHANLt8X65vgj5UvXm7T/6SM9km46RYf+YH+AM0=;\n b=PPo/LIp1ps27D7CT/4zBmKXJUTK1wZZYgl2JUREkI1+QuSsG64/8WWsA4V6ema1X+d5oJC\n 77XVIFErY3bcjrBtb9NdlRK5MOjBmulmbMtbdnLT0IQ9vfUby9cKfaH7senKjXa8/oVySM\n 4bvW4iyVRu2cUJqVhcSJ0wmPEkmQ4OU=", "X-MC-Unique": "lRi6J_GoOYySJN31OL6m0w-1", "X-Mimecast-MFC-AGG-ID": "lRi6J_GoOYySJN31OL6m0w_1776324867", "Date": "Thu, 16 Apr 2026 09:34:22 +0200", "From": "Jakub Jelinek <jakub@redhat.com>", "To": "Uros Bizjak <ubizjak@gmail.com>, Hongtao Liu <hongtao.liu@intel.com>", "Cc": "gcc-patches@gcc.gnu.org", "Subject": "[PATCH] i386: Fix up TARGET_AVOID_FALSE_DEP_FOR_BMI APX NF splitters\n [PR124892]", "Message-ID": "<aeCQ_tJTTwe51o3B@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": "7Uhokyor60QpnxxLIcsK_MyirXIX7nC7Xq7G_86EPS0_1776324867", "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\nThe following testcase is miscompiled because the 3\nTARGET_AVOID_FALSE_DEP_FOR_BMI APX NF splitters use ix86_expand_clear.\nAll other uses of ix86_expand_clear are on either splitters where we know\nsomething clobbers flags register or sets it at the end of pattern (so\nclearly flags register is not live across the pattern) or in\ndefine_peephole2 where we explicitly check peep2_regno_dead_p (?, FLAGS_REG).\nNow, ix86_expand_clear handles right the QI/HImode cases by setting SImode\ninstead and based on TARGET_USE_MOV0 and/or optimize_insn_for_size_p\ndecides whether to use xor reg, reg form or mov $0, reg.\nNow, for these 3 APX NF splitters there is actually no flags clobber nor set\nin the pattern and because it is a splitter, we don't know if flags register\nis live across it (likely yes, otherwise why the APX NF pattern would be\nused) or not. So, we can't use ix86_expand_clear which could clobber flags.\nAs the splitters are only SWI48, we don't have to worry about QI/HImode\nclearing and so IMHO just want to always use the mov $0, reg form by hand.\nIf flags actually isn't live across it, we have\n;; Attempt to always use XOR for zeroing registers (including FP modes).\n(define_peephole2\n [(set (match_operand 0 \"general_reg_operand\")\n (match_operand 1 \"const0_operand\"))]\n \"GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD\n && (! TARGET_USE_MOV0 || optimize_insn_for_size_p ())\n && peep2_regno_dead_p (0, FLAGS_REG)\"\n [(parallel [(set (match_dup 0) (const_int 0))\n (clobber (reg:CC FLAGS_REG))])]\n \"operands[0] = gen_lowpart (word_mode, operands[0]);\")\npeephole2 which would turn the mov $0, reg back to xor reg, reg.\n\nBootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?\n\n2026-04-16 Jakub Jelinek <jakub@redhat.com>\n\n\tPR target/124892\n\t* config/i386/i386.md (clz<mode>2_lzcnt_nf,\n\t<lt_zcnt>_<mode>_nf, popcount<mode>2_nf): Emit explicit\n\tset of (match_dup 0) to (const_int 0) without flags clobber instead of\n\tusing ix86_expand_clear.\n\n\t* gcc.target/i386/apx-pr124892.c: New test.\n\n\n\tJakub", "diff": "--- gcc/config/i386/i386.md.jj\t2026-03-27 10:17:13.854335308 +0100\n+++ gcc/config/i386/i386.md\t2026-04-15 18:35:23.740482534 +0200\n@@ -21859,11 +21859,12 @@ (define_insn_and_split \"clz<mode>2_lzcnt\n \"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed\n && optimize_function_for_speed_p (cfun)\n && !reg_mentioned_p (operands[0], operands[1])\"\n- [(parallel\n+ [(set (match_dup 0) (const_int 0))\n+ (parallel\n [(set (match_dup 0)\n \t (clz:SWI48 (match_dup 1)))\n (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])]\n- \"ix86_expand_clear (operands[0]);\"\n+ \"\"\n [(set_attr \"prefix_rep\" \"1\")\n (set_attr \"type\" \"bitmanip\")\n (set_attr \"mode\" \"<MODE>\")])\n@@ -22020,11 +22021,12 @@ (define_insn_and_split \"<lt_zcnt>_<mode>\n \"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed\n && optimize_function_for_speed_p (cfun)\n && !reg_mentioned_p (operands[0], operands[1])\"\n- [(parallel\n+ [(set (match_dup 0) (const_int 0))\n+ (parallel\n [(set (match_dup 0)\n \t (unspec:SWI48 [(match_dup 1)] LT_ZCNT))\n (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])]\n- \"ix86_expand_clear (operands[0]);\"\n+ \"\"\n [(set_attr \"type\" \"<lt_zcnt_type>\")\n (set_attr \"prefix_0f\" \"1\")\n (set_attr \"prefix_rep\" \"1\")\n@@ -22666,11 +22668,12 @@ (define_insn_and_split \"popcount<mode>2_\n \"&& TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed\n && optimize_function_for_speed_p (cfun)\n && !reg_mentioned_p (operands[0], operands[1])\"\n- [(parallel\n+ [(set (match_dup 0) (const_int 0))\n+ (parallel\n [(set (match_dup 0)\n \t (popcount:SWI48 (match_dup 1)))\n (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)])]\n- \"ix86_expand_clear (operands[0]);\"\n+ \"\"\n [(set_attr \"prefix_rep\" \"1\")\n (set_attr \"type\" \"bitmanip\")\n (set_attr \"mode\" \"<MODE>\")])\n--- gcc/testsuite/gcc.target/i386/apx-pr124892.c.jj\t2026-04-15 18:44:16.052606262 +0200\n+++ gcc/testsuite/gcc.target/i386/apx-pr124892.c\t2026-04-15 18:44:50.020039751 +0200\n@@ -0,0 +1,20 @@\n+/* PR target/124892 */\n+/* { dg-do run { target { apxf && { lzcnt && { ! ia32 } } } } } */\n+/* { dg-options \"-O2 -frename-registers\" } */\n+\n+[[gnu::noipa, gnu::target (\"apxf\"), gnu::target (\"lzcnt\")]] char\n+foo (unsigned u)\n+{\n+ return __builtin_stdc_bit_ceil (u);\n+}\n+\n+int\n+main ()\n+{\n+ if (!__builtin_cpu_supports (\"apxf\"))\n+ return 0;\n+ if (!__builtin_cpu_supports (\"lzcnt\"))\n+ return 0;\n+ if (foo (7) != 8)\n+ __builtin_abort ();\n+}\n", "prefixes": [] }