Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229072/?format=api
{ "id": 2229072, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229072/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/f8bc67a2-3aef-41a8-a397-0c40211ceaa3@oss.qualcomm.com/", "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": "<f8bc67a2-3aef-41a8-a397-0c40211ceaa3@oss.qualcomm.com>", "date": "2026-04-27T18:02:35", "name": "[to-be-committed,RISC-V,PR,rtl-optimization/96692] Improve xor+xor+ior sequence when possible", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0de68030bdf53f54290cafafc41b327469ade3e3", "submitter": { "id": 92310, "url": "http://patchwork.ozlabs.org/api/1.1/people/92310/?format=api", "name": "Jeffrey Law", "email": "jeffrey.law@oss.qualcomm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/f8bc67a2-3aef-41a8-a397-0c40211ceaa3@oss.qualcomm.com/mbox/", "series": [ { "id": 501700, "url": "http://patchwork.ozlabs.org/api/1.1/series/501700/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501700", "date": "2026-04-27T18:02:35", "name": "[to-be-committed,RISC-V,PR,rtl-optimization/96692] Improve xor+xor+ior sequence when possible", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501700/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229072/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229072/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 (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=BT2EFtyg;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=ThkJsVQC;\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 (2048-bit key,\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=BT2EFtyg;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=ThkJsVQC", "sourceware.org; dmarc=none (p=none dis=none)\n header.from=oss.qualcomm.com", "sourceware.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=205.220.168.131" ], "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 4g4BHz0Gd1z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 04:03:09 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id EF2104BB3BFC\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 18:03:07 +0000 (GMT)", "from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com\n [205.220.168.131])\n by sourceware.org (Postfix) with ESMTPS id 621C14B99F78\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 18:02:40 +0000 (GMT)", "from pps.filterd (m0279863.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63RGYABG3123516\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 18:02:39 GMT", "from mail-dl1-f71.google.com (mail-dl1-f71.google.com\n [74.125.82.71])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dt5qghsne-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 18:02:39 +0000 (GMT)", "by mail-dl1-f71.google.com with SMTP id\n a92af1059eb24-12c726f4019so13714211c88.1\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 11:02:39 -0700 (PDT)", "from [172.31.0.17] ([136.38.201.137])\n by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12c837f7feasm53772388c88.0.2026.04.27.11.02.35\n for <gcc-patches@gcc.gnu.org>\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Mon, 27 Apr 2026 11:02:36 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org EF2104BB3BFC", "OpenDKIM Filter v2.11.0 sourceware.org 621C14B99F78" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 621C14B99F78", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 621C14B99F78", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777312960; cv=none;\n b=xQHTuUknkoWXn5StSll5vTzK8HzoaHRzPQeUVPhza3jECjxUvVr5Vb4zEbVs78Rd5w75HLnEmlpe260M6Y4T0OY/ukz40Vrmz6Lr3S+CKNBmC3UztKTWlwQujfS0QgfKGRYVg+gZ8aauqzyAh8Yh/OqkYRlzw0VOumWN1/OdArc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777312960; c=relaxed/simple;\n bh=Ih399iwEh07yokWVnjMcy4iYs1oWFHvu+UGZyUW8bWw=;\n h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From:\n To:Subject;\n b=jlFK/GdH8EER0dAm2R0eSmT0eYKkUuyoZe3Zj4RlP41OVvrJ7N+1ZY8d00uvhWYBXdsSLz9sM8108XFtoYow3Fqft26YjjNAngCXPuIq+CZBwbpH5/VVe3AH1kcvBxdsBEqVLJP4dJAaQb0V/p9j8qBGaZA2U0/TroB0eaVxoUg=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n content-type:date:from:message-id:mime-version:subject:to; s=\n qcppdkim1; bh=kB8jAJIDPkYlb6OiKqMHeiYfa/Ds5zPHlPEPlkks22o=; b=BT\n 2EFtygMI1zQKIYc9GvM+kCYGEoB0yjY2fvoqj8Rs5ZYt/irM/q87QhYaMHnP+v3M\n uREwbGbrgOOyKlzD9KTYbLS5I+n/EOkLe27AE7Jg/iWLR0vCYRIvEm7i3o99smBR\n EEz/vg1LDaDmZXEz+ByVDoOGx4lHrddMxXx6cyRcw/rLa+sE7zq68oNP6/ftzRKs\n VZZvPJgdf/a/+Utx8xg7Nim2R9PY6d59oxWrzuRMr2D2FZ0V7nFvcmvx7lMJgju+\n yFGvDK8TPoPXNzwebjLvYBgrIL+fXLjTqZnRsw/je7Uh9bTqSMlXfnnGHduQc/fj\n gvzI38HPrTSkFfcSIpEw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1777312958; x=1777917758; darn=gcc.gnu.org;\n h=subject:to:from:content-language:user-agent:mime-version:date\n :message-id:from:to:cc:subject:date:message-id:reply-to;\n bh=kB8jAJIDPkYlb6OiKqMHeiYfa/Ds5zPHlPEPlkks22o=;\n b=ThkJsVQC3bWCAQtxcgBwZ5Fcu7VtfI5K8kqzKWYolyEm6kBcU9u7msIJKDoyWF7/76\n nhGIRqNcC0/l9rp8gHR9nxLgC8V0JHogNDPNulqoWXxkH9pLKZXQ1GPR2HyQBj66LwxB\n pWo3dk2Ez3jlJCNeKgZL67onsJPJe1oXOpjIz2XuOnNJ5RUqs0yEDz5b693mzYL7Iu7f\n wbyJecuIaM8KYt9zM5mgB8zANB6/WTlMfrSQXXlwLaV9gWMuytBAMJKktVpJOThvwZEQ\n jpnDJXFeVl1qyhGK6PQx6ZKPD4NCUnVKgbmLJZIJltg8CNq9VgA91mPmcqioqnFq6CQa\n SteA==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777312958; x=1777917758;\n h=subject:to:from:content-language:user-agent:mime-version:date\n :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=kB8jAJIDPkYlb6OiKqMHeiYfa/Ds5zPHlPEPlkks22o=;\n b=YovfLgLabmP28S3vjR27c9e6Z9xZKfvV4ZKnWpbsvC9HDDnatqQg1ebJwGAgSMJCQA\n UwUsQh+NSswqHx0DPgo1ZX9MQr8sa/XqT63/egO32EetOSskjj9FwgfHBBkcWJZWwauq\n zAwO03p9r9+aSitkRy2HcjpK7AlO6Gl+fICRn7uwSjJQvEczGcPidP7Z+ycM7mBrkgah\n c6+JNKlWEaTaWFyKtNBBE9nEbKFlw8HzhgMeQ+YpAWD+Rl1ia5sjTfhv+GJoXnoLSSrZ\n oQQxakROx+vfbgxEZpqx2NTM96V0UuhcR2HvlZA5HkWeKffr70LlUiW4APRs2G9FVFIx\n 4KAg==", "X-Gm-Message-State": "AOJu0Yz1xgStJndD5qf8p6BfqGCLJ/XiRJ2pTgPIfHRDFRKyLT5QwN0c\n KUYNZ/HTFoUi8+MI40EDruW0UYjDwNNBQ6o5zZU2ogeRQhvnGKEc1GW2mvg0l8idQi9Od+Qb4oK\n SBc77f7aFXWcVoHVDdDoYFWE/Y3WqrpRHQnHhfz2/y1GiuJIk8v1CPpXKgiaaTWskN+j1", "X-Gm-Gg": "AeBDieuHWvuRC53IVPm0GkouMxSXmngzUuamkelgBznWrfiFLwogYgE9EhMyY7d4Fy1\n DIXktGuy4mZjlGyGCOVZSEdiAvVM4kzBWElDnKj+OgHeidPL7+/qi9nHNm5Jy1Et0TXT95GiTuR\n SeR10bVZr5HBqYfZwsFH6h1fWuKNlRHxwiXS6tRefMUbdcdF/t0DKICF/e4zByHxKiGryZ4X1BP\n R+U2QWTp8x3uxIAJ5ukqs2TGuTPkWTVFc1NjqZpateYrQBTN/ngsWes3UuPERakFIidOZB55FK0\n +tJGE1OEy7KW+1emYhPlEF6euJOoqhJNsOfXGZMBT+uNAwTtJUgiyVQ0d8wz+bz20FGPCqRUsCb\n bRZzsrXR2UOQfGwBivMiALoylFdhmfGhzCEQzv6doLdrIn7UDp+Aez6KtvunN", "X-Received": [ "by 2002:a05:7022:ef06:b0:128:bf8d:44d2 with SMTP id\n a92af1059eb24-12ddd4e3dedmr163869c88.2.1777312958260;\n Mon, 27 Apr 2026 11:02:38 -0700 (PDT)", "by 2002:a05:7022:ef06:b0:128:bf8d:44d2 with SMTP id\n a92af1059eb24-12ddd4e3dedmr163844c88.2.1777312957458;\n Mon, 27 Apr 2026 11:02:37 -0700 (PDT)" ], "Content-Type": "multipart/mixed; boundary=\"------------11ejg0s7By70MCgD7Uw1Cxjo\"", "Message-ID": "<f8bc67a2-3aef-41a8-a397-0c40211ceaa3@oss.qualcomm.com>", "Date": "Mon, 27 Apr 2026 12:02:35 -0600", "MIME-Version": "1.0", "User-Agent": "Mozilla Thunderbird", "Content-Language": "en-US", "From": "Jeffrey Law <jeffrey.law@oss.qualcomm.com>", "To": "'GCC Patches' <gcc-patches@gcc.gnu.org>", "Subject": "[to-be-committed][RISC-V][PR rtl-optimization/96692] Improve\n xor+xor+ior sequence when possible", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI3MDE5MiBTYWx0ZWRfX4Fbb1Ki7x7wj\n nFaalBYajGNwPJn2uADkIAnhECQALpDCMB6v7Fn50XRY/2+LntqOW2xlP+POOJDVZb4mAnEe+jA\n LtMDyq5qcjubPbbUU1F5qgIP6Irely1sFlN64Aa0quGIyYkDCqg3k/d+a4La77L1+qlE385w8bp\n IRa9ovv1yo6p/k/yczxXq3qL1RFs6fWOnUv/FeXySPiF7GKMPDBuwqTzWP2unUdTnbtMh/ll+ve\n 8/PLnj8IaeZHw1wpSPWWnhiuwF4b5sDp6k1iGUa08REAdH1pW30HtO0b6gdpPpzsJBmuEeK/XI2\n MiXeaAdzdvfrwvRdRtmPuAsUFfeWBSq14srP139unhMl8ofPiH83VLyPa2OUKk74rPWaI3gx5ow\n nJkA5W2eT3XtKjIMsx+1ZsNvxCS0w1IcwQhUFfZBCfBH2ZMST/MWiHG3c1ggbVoyvDfwvgTQr5e\n H9zWcS3uLqDN8uYRv6w==", "X-Authority-Analysis": "v=2.4 cv=V69NF+ni c=1 sm=1 tr=0 ts=69efa4bf cx=c_pps\n a=JYo30EpNSr/tUYqK9jHPoA==:117 a=asGLMfRmzhnGNxaIYohjRg==:17\n a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=r77TgQKjGQsHNAKrUKIA:9\n a=TvAaG0bYf30ckvNEwHUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10\n a=zkYZT2p0g9doOCsiDmsA:9 a=B2y7HmGcmWMA:10 a=Fk4IpSoW4aLDllm1B1p-:22", "X-Proofpoint-GUID": "j4LfHvHPheLi_cOu-Ul5VqzX7GFWJ8Bm", "X-Proofpoint-ORIG-GUID": "j4LfHvHPheLi_cOu-Ul5VqzX7GFWJ8Bm", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-27_04,2026-04-21_02,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n malwarescore=0 clxscore=1015 suspectscore=0 adultscore=0 spamscore=0\n phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0\n lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000\n definitions=main-2604270192", "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>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "Consider this code:\n\nint f(int a, int b, int c)\n{\n return (a ^ b) ^ (a | c);\n}\n\n\nFor RISC-V we generate something like this:\n\n xor a1,a0,a1\n or a0,a0,a2\n xor a0,a1,a0\n\nBut this would be better:\n\n andn a0,a2,a0\n xor a0,a0,a1\n\nIt looks like Roger tackled this earlier with splitters for x86. I'd \nhave leaned more towards simplify-rtx, but there may be secondary \nconcerns at play. So I'll attack in the RISC-V target files in a \nsimilar manner.\n\nThe patch, but not the testcase, have been in my tester for a while, so \nit's been bootstrapped and regression tested on the Pioneer and BPI-F3 \nboard and regression tested on riscv32-elf and riscv64-elf. Obviously \nI'll wait for pre-commit CI before moving forward.\n\nJeff\nPR rtl-optimization/96692\ngcc/\n\t* config/riscv/bitmanip.md (xor+xor+ior splitters): New splitters\n\tthat ultimately generate andn+xor when possible.\n\ngcc/testsuite\n\n\t* gcc.target/riscv/pr96692.c: New test.", "diff": "diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md\nindex 1ca9f82b363f..54bb5d6ad2a1 100644\n--- a/gcc/config/riscv/bitmanip.md\n+++ b/gcc/config/riscv/bitmanip.md\n@@ -1426,3 +1426,25 @@ (define_split\n [(set (match_dup 2) (plus:X (match_dup 1) (const_int -1)))\n (set (match_dup 0) (and:X (not:X (match_dup 1)) (match_dup 2)))])\n \n+(define_split\n+ [(set (match_operand:X 0 \"register_operand\")\n+ (xor:X (xor:X (ior:X (match_operand:X 1 \"register_operand\")\n+ (match_operand:X 2 \"register_operand\"))\n+ (match_dup 1))\n+ (match_operand:X 3 \"register_operand\")))\n+ (clobber (match_operand:X 4 \"register_operand\"))]\n+ \"TARGET_ZBB || TARGET_ZBKB\"\n+ [(set (match_dup 4) (and:X (not:X (match_dup 1)) (match_dup 2)))\n+ (set (match_dup 0) (xor:X (match_dup 4) (match_dup 3)))])\n+\n+(define_split\n+ [(set (match_operand:X 0 \"register_operand\")\n+ (xor:X (xor:X (ior:X (match_operand:X 1 \"register_operand\")\n+ (match_operand:X 2 \"register_operand\"))\n+ (match_dup 2))\n+ (match_operand:X 3 \"register_operand\")))\n+ (clobber (match_operand:X 4 \"register_operand\"))]\n+ \"TARGET_ZBB || TARGET_ZBKB\"\n+ [(set (match_dup 4) (and:X (not:X (match_dup 2)) (match_dup 1)))\n+ (set (match_dup 0) (xor:X (match_dup 4) (match_dup 3)))])\n+\ndiff --git a/gcc/testsuite/gcc.target/riscv/pr96692.c b/gcc/testsuite/gcc.target/riscv/pr96692.c\nnew file mode 100644\nindex 000000000000..650f4f0f80dd\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/riscv/pr96692.c\n@@ -0,0 +1,12 @@\n+/* { dg-do compile } */\n+/* { dg-additional-options \"-march=rv64gcb_zicond -mabi=lp64d\" { target rv64 } } */\n+/* { dg-additional-options \"-march=rv32gcb_zicond -mabi=ilp32\" { target rv32 } } */\n+/* { dg-skip-if \"\" { *-*-* } { \"-O0\" \"-Og\" } } */\n+\n+int f(int a, int b, int c)\n+{\n+ return (a ^ b) ^ (a | c);\n+}\n+\n+/* { dg-final { scan-assembler-times \"xor\\t\" 1 } } */\n+/* { dg-final { scan-assembler-times \"andn\\t\" 1 } } */\n", "prefixes": [ "to-be-committed", "RISC-V", "PR", "rtl-optimization/96692" ] }