From patchwork Fri Jan 26 07:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenglulu X-Patchwork-Id: 19477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp501454dyb; Thu, 25 Jan 2024 23:39:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMhRRhag7cZR7l4B9VQSxO6xbxA9J5k1S7klfA+WOZ/foyN9g6WUsC1HBVIWTOFYPxmXta X-Received: by 2002:ac8:7f0a:0:b0:42a:51de:d77a with SMTP id f10-20020ac87f0a000000b0042a51ded77amr950295qtk.31.1706254768922; Thu, 25 Jan 2024 23:39:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706254768; cv=pass; d=google.com; s=arc-20160816; b=RLiyeJl0FE6x49FV/DHobEzHk530a6HAau5FxJJ0FWX5AD6JBbwZvNNmragbIgJ0Qa 9F6wFnD/HKIo1COY023IbR5mOsD6eYmEMtyyL3i2EuryLqcVMOfELxCVT/YT176SEKub 7CtEUgQmRPIZEsdIJl3cl4USQDzGQ82jxfSEoKBvHemo+YdwFxKQPiOTqumcompI9hYM 4InCu/0eH0xiLWYs61/MAe1yVJjScWK6OzMPAeOPnmmDziqLOk4PElxr9i/u1bYCxWCq Kuc0GAvPikCIMuH+Ar3kxz2a0XrIlI6WUzPTUhvsKp6KFi/7SFqQm4eQVkftG2LULAQy 1ScA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=Wsvx7MQZccBt4gwacymRNcnm0tM3WMa4vOvcz3LJAt8=; fh=kLXYvQYlFoGM+V705nfHVJAr1G8Exwjn4Aw52UExiO4=; b=x4hZM81lKCSXSNmNso9ly692R8teab/J4v4l6BwRxlZzKghcDuVMNeRZirAmUuW7pF HvOOcL90riab0ChJv3SHDfemyPEzGyLCCGu0hxBofCTVdvfgvVUzRvwwER82NEW2jJZm 6VzGcRHFw1SYrM9AD/pBNmrWYveRb4Xg7fdjiYiIiEgujejrQhPDhTlu+l8Qn7ZgYdIb 34iZEo8oQsMnydPZf1aBzRfzMensKv1+HQo6cnECqnXTxPlP/NUeDyLL/2IRvc8WuiTq gS0iN3hhxD5ihuWL5r48gbKAoFQbgLoaQRltxzsC5zi2gKNHJIFibQpEBgFrtP7iM5yB 4lkw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o9-20020ac87c49000000b0042a7092b2c7si647636qtv.698.2024.01.25.23.39.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 23:39:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A72A3857C5A for ; Fri, 26 Jan 2024 07:39:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id DA1C53858CD1 for ; Fri, 26 Jan 2024 07:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA1C53858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DA1C53858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706254711; cv=none; b=W/8sj7o3UXmBF7o/dwWl1KTttA5GvZSXl+kgNHCJtJO/BqLxVySBWSov6ykwQx81UAYrbe7P2VBOYDG5uJpkblgRPT8pKmwwhcYQkM1b4wYR3vzST590dT3fNNlV6k6YpMlUP6VzZx2wITcYxGx3ZBLRC0nw3erZl8BNqvhqKX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706254711; c=relaxed/simple; bh=UaMRszGgvLSW/tvHKO0r8QacQud4OyXwct09Jq6zfcQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=bEy6TeXkPJGqDPy1dRjeSofKHaTGC3YVyYJTlUZoAeywNHKY5eSmHbJ96MhPGcwFCRRn3q4VpNBT8h1GcuSVMk+vedj9zK2z3fetoeRsOi+q18YY/Rh5ph4b/GfOghxBF4NwXcFhZTrnT+JGsLjy1fw4a0kk2ij9cov6/oy36XM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTGnC-0004HE-EG for gcc-patches@gcc.gnu.org; Fri, 26 Jan 2024 02:38:28 -0500 Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8DxbOlkYbNleiYGAA--.11556S3; Fri, 26 Jan 2024 15:38:13 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxRMxeYbNlPpUbAA--.44775S2; Fri, 26 Jan 2024 15:38:07 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn, Lulu Cheng Subject: [PATCH v4 0/4] When cmodel=extreme, add macro support and only support macros. Date: Fri, 26 Jan 2024 15:37:41 +0800 Message-Id: <20240126073745.13252-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxRMxeYbNlPpUbAA--.44775S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoW7WF4kCr43CrW8Xr1kZr13GFX_yoW8uF13p3 y7uw15KF45G392g3WkJa4fWw4kJ3W7KFWa9a1aqryF9F43XrWfJF18Kw4SqF17G3WUJ34f Xr1Sv3WUW3W2qacCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07jUsqXUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=chenglulu@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_FAIL, SPF_HELO_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789137800557156936 X-GMAIL-MSGID: 1789137800557156936 v3 -> v4: 1. Add macro support for TLS symbols 2. Added support for loading __get_tls_addr symbol address using call36. 3. Merge template got_load_tls_{ld/gd/le/ie}. 4. Enable explicit reloc for extreme TLS GD/LD with -mexplicit-relocs=auto. v2 -> v3: 1. Modify the detection rules of a test case. v1 -> v2: 1. Use the temporarily allocated registers as intermediate registers to implement the extreme macro. 2. Fixed bugs in v1 test cases. Lulu Cheng (4): LoongArch: Merge template got_load_tls_{ld/gd/le/ie}. LoongArch: Add the macro implementation of mcmodel=extreme. LoongArch: Enable explicit reloc for extreme TLS GD/LD with -mexplicit-relocs=auto. LoongArch: Added support for loading __get_tls_addr symbol address using call36. gcc/config/loongarch/loongarch-protos.h | 1 + gcc/config/loongarch/loongarch.cc | 182 +++++++++--------- gcc/config/loongarch/loongarch.md | 101 ++++++---- gcc/config/loongarch/predicates.md | 12 ++ .../gcc.target/loongarch/attr-model-5.c | 8 + .../explicit-relocs-extreme-auto-tls-ld-gd.c | 5 + .../explicit-relocs-medium-auto-tls-ld-gd.c | 5 + ...icit-relocs-medium-call36-auto-tls-ld-gd.c | 5 + .../loongarch/func-call-extreme-5.c | 7 + .../loongarch/func-call-extreme-6.c | 7 + .../gcc.target/loongarch/tls-extreme-macro.c | 35 ++++ 11 files changed, 239 insertions(+), 129 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/attr-model-5.c create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-extreme-auto-tls-ld-gd.c create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-medium-auto-tls-ld-gd.c create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-medium-call36-auto-tls-ld-gd.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-5.c create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-6.c create mode 100644 gcc/testsuite/gcc.target/loongarch/tls-extreme-macro.c