{"id":2175441,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175441/?format=json","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.0/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":"<20251218071311.941102-2-i@xen0n.name>","date":"2025-12-18T07:13:10","name":"[1/2] LoongArch: Do not define legacy built-in macros for LA32","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6093c09bff86118ff8167c92dbc207e5fab6e421","submitter":{"id":80195,"url":"http://patchwork.ozlabs.org/api/1.0/people/80195/?format=json","name":"WANG Xuerui","email":"i@xen0n.name"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20251218071311.941102-2-i@xen0n.name/mbox/","series":[{"id":485792,"url":"http://patchwork.ozlabs.org/api/1.0/series/485792/?format=json","date":"2025-12-18T07:13:09","name":"LoongArch: Preliminary LA32 clean-ups","version":1,"mbox":"http://patchwork.ozlabs.org/series/485792/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175441/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=xen0n.name header.i=@xen0n.name header.a=rsa-sha256\n header.s=mail header.b=Zr1yeM1f;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=xen0n.name header.i=@xen0n.name header.a=rsa-sha256\n header.s=mail header.b=Zr1yeM1f","sourceware.org;\n dmarc=none (p=none dis=none) header.from=xen0n.name","sourceware.org; spf=pass smtp.mailfrom=xen0n.name","server2.sourceware.org;\n arc=none smtp.remote-ip=115.28.160.31"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4dX23Q2vXrz1xty\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 18:14:26 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 626A04BA2E04\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 07:14:24 +0000 (GMT)","from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31])\n by sourceware.org (Postfix) with ESMTPS id 8BD774BA2E1C\n for <gcc-patches@gcc.gnu.org>; Thu, 18 Dec 2025 07:13:24 +0000 (GMT)","from ld50.lan (unknown [IPv6:240e:b8f:939d:bb00::8c0])\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 mailbox.box.xen0n.name (Postfix) with ESMTPSA id 6466A6017E;\n Thu, 18 Dec 2025 15:13:21 +0800 (CST)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 626A04BA2E04","OpenDKIM Filter v2.11.0 sourceware.org 8BD774BA2E1C"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 8BD774BA2E1C","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 8BD774BA2E1C","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766042004; cv=none;\n b=lQgLSFkvx/FcijlzWcuuNSQvCT+SkWyFPRr5BEeLd1KjaJWaiHy9xe3NS/heIvhZjOIcK635ZQcU369G099KYK4L5H8+Ca0kFlqi8BMTlgs90kUfbXzKbVvSYISUJlY/ckhLFq+sLSlKgcyGB75SnAAwxIloiEqOxZ31BS/pI04=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1766042004; c=relaxed/simple;\n bh=ddCUGsfnzAe337O2jlX9SX9zzbj+84K8zAwlwJbhA/A=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=SMUZcL01sQQZNyvuiLuLsp4KfU1LA6FRHjoEsnbBhH7ysH3f42a4/X7yfrMDNi14TQMRqputv3gTWDufdT8zBpdi9VD7lFyNvh6CNZRdMoSPMiwTs7MAe2vrMHOVjqG0Lvhd4ueg83HlE2ZGRq62wBqEyLP6+5RwaJ32B5n3CxE=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail;\n t=1766042001; bh=ddCUGsfnzAe337O2jlX9SX9zzbj+84K8zAwlwJbhA/A=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=Zr1yeM1fQ/aU9CSk8+SPz0jshhg0QT7xRZKOVv2x1lW8qDCrgdEVGeZRSRQjU04so\n aHKSZuIz5fMsFwToFiqzPNu/yVGNnOUQGMKY39MqiUj1rTQrJceMP2K3BJLbWjExq3\n 7g+tGkU7QiUkEM6myxEBakofC422Zam8sGkr6/Dc=","From":"WANG Xuerui <i@xen0n.name>","To":"gcc-patches@gcc.gnu.org","Cc":"Xi Ruoyao <xry111@xry111.site>, Lulu Cheng <chenglulu@loongson.cn>,\n Chenghua Xu <xuchenghua@loongson.cn>, WANG Xuerui <git@xen0n.name>","Subject":"[PATCH 1/2] LoongArch: Do not define legacy built-in macros for LA32","Date":"Thu, 18 Dec 2025 15:13:10 +0800","Message-ID":"<20251218071311.941102-2-i@xen0n.name>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251218071311.941102-1-i@xen0n.name>","References":"<20251218071311.941102-1-i@xen0n.name>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"From: WANG Xuerui <git@xen0n.name>\n\nThese all-caps built-in macros, while defined in the 2022.01.13 version\nof the original *LoongArch Toolchain Conventions* document [1], are\ndeprecated since version 2023.04.20 [2] by [3], and since the recent\n*Software Development and Build Convention for LoongArch Architectures*\ndocument was released in July 2023, they have completely disappeared.\nNow that it is nearing the end of 2025 and a new LoongArch target is\nadded, better not include the cruft for not deviating from the official\nspecs, and a cleaner ecosystem.\n\n[1]: https://github.com/loongson/LoongArch-Documentation/blob/2022.01.13/docs/LoongArch-toolchain-conventions-EN.adoc#cc-preprocessor-definitions\n[2]: https://github.com/loongson/LoongArch-Documentation/blob/2023.04.20/docs/LoongArch-toolchain-conventions-EN.adoc#cc-preprocessor-built-in-macro-definitions\n[3]: https://github.com/loongson/LoongArch-Documentation/pull/28\n[4]: https://github.com/loongson/la-softdev-convention/blob/v0.1/la-softdev-convention.adoc#83-architecture-related-cc-pre-defined-macros\n\ngcc/ChangeLog:\n\n\t* config/loongarch/loongarch-c.cc\n\t(loongarch_define_unconditional_macros): Do not define legacy\n\tcompatibility macros for LA32.\n\t(loongarch_update_cpp_builtins): Ditto.\n\nSigned-off-by: WANG Xuerui <git@xen0n.name>\n---\n gcc/config/loongarch/loongarch-c.cc | 35 ++++++++++++++++++-----------\n 1 file changed, 22 insertions(+), 13 deletions(-)","diff":"diff --git a/gcc/config/loongarch/loongarch-c.cc b/gcc/config/loongarch/loongarch-c.cc\nindex 6e2f8f43818..b91ba8dd73d 100644\n--- a/gcc/config/loongarch/loongarch-c.cc\n+++ b/gcc/config/loongarch/loongarch-c.cc\n@@ -79,12 +79,15 @@ loongarch_define_unconditional_macros (cpp_reader *pfile)\n   builtin_define (\"__builtin_infq=__builtin_inff128\");\n   builtin_define (\"__builtin_huge_valq=__builtin_huge_valf128\");\n \n-  /* Native Data Sizes.  */\n-  builtin_define_with_int_value (\"_LOONGARCH_SZINT\", INT_TYPE_SIZE);\n-  builtin_define_with_int_value (\"_LOONGARCH_SZLONG\", LONG_TYPE_SIZE);\n-  builtin_define_with_int_value (\"_LOONGARCH_SZPTR\", POINTER_SIZE);\n-  builtin_define_with_int_value (\"_LOONGARCH_FPSET\", 32);\n-  builtin_define_with_int_value (\"_LOONGARCH_SPFPSET\", 32);\n+  /* Legacy compatibility macros for native data sizes.  */\n+  if (TARGET_ABI_LP64)\n+    {\n+      builtin_define_with_int_value (\"_LOONGARCH_SZINT\", INT_TYPE_SIZE);\n+      builtin_define_with_int_value (\"_LOONGARCH_SZLONG\", LONG_TYPE_SIZE);\n+      builtin_define_with_int_value (\"_LOONGARCH_SZPTR\", POINTER_SIZE);\n+      builtin_define_with_int_value (\"_LOONGARCH_FPSET\", 32);\n+      builtin_define_with_int_value (\"_LOONGARCH_SPFPSET\", 32);\n+    }\n }\n \n static void\n@@ -100,13 +103,19 @@ loongarch_update_cpp_builtins (cpp_reader *pfile)\n   builtin_define_with_value (\"__loongarch_tune\",\n \t\t\t     loongarch_tune_strings[la_target.cpu_tune], 1);\n \n-  builtin_undef (\"_LOONGARCH_ARCH\");\n-  builtin_define_with_value (\"_LOONGARCH_ARCH\",\n-\t\t\t     loongarch_arch_strings[la_target.cpu_arch], 1);\n-\n-  builtin_undef (\"_LOONGARCH_TUNE\");\n-  builtin_define_with_value (\"_LOONGARCH_TUNE\",\n-\t\t\t     loongarch_tune_strings[la_target.cpu_tune], 1);\n+  /* Legacy compatibility macros for arch/tune info.  */\n+  if (TARGET_64BIT)\n+    {\n+      builtin_undef (\"_LOONGARCH_ARCH\");\n+      builtin_define_with_value (\"_LOONGARCH_ARCH\",\n+\t\t\t\t loongarch_arch_strings[la_target.cpu_arch],\n+\t\t\t\t 1);\n+\n+      builtin_undef (\"_LOONGARCH_TUNE\");\n+      builtin_define_with_value (\"_LOONGARCH_TUNE\",\n+\t\t\t\t loongarch_tune_strings[la_target.cpu_tune],\n+\t\t\t\t 1);\n+    }\n \n   builtin_undef (\"__loongarch_double_float\");\n   builtin_undef (\"__loongarch_single_float\");\n","prefixes":["1/2"]}