From patchwork Wed Aug 9 11:46:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiajie Chen X-Patchwork-Id: 13370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2743001vqr; Wed, 9 Aug 2023 04:55:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0oYZ7xsWB9PaeT0FpBN3fYxVyXQ/XJuWmRja7eErBDKLqo/r8T+0EmPXHI7NX7CCE5d1Q X-Received: by 2002:a17:907:3f93:b0:99b:cadd:c2ee with SMTP id hr19-20020a1709073f9300b0099bcaddc2eemr15778716ejc.29.1691582102101; Wed, 09 Aug 2023 04:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691582102; cv=none; d=google.com; s=arc-20160816; b=fipF07uyD0PwJBI/oijvxwn+vRAP0irRi6k6FGaxfRPKReTL9Arx9OkCaGGs8S8fyE iRRl0W+4eDeGUpSmXl3OyvtANFhDcA6VHNL4X4xVy+AYacMucv0LUTFF6paiplMeQMs8 1TkTjImnc8oTFok0wxJmTWGxz8OHPpaua41sQUqUb+BtyUr+qNSpCU0kENZiNukmCPzF fPo08tGwMQuKpxlX9rtjrkaChmO9AwnnkksXFF7vWnIrLn+fvGj+EljgPsK4gJP/h1dZ m/ZAu4cEo6k3E/cKaAorlciTag+vmR201SrEddfEckeJ5AZqNRZ/qMiqmNAaA6hPFxK7 IIWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=UKzmwzldZQHza6qJwGz5lP6Wdk6WRJXHfPsJd4A0EWk=; fh=nBdY3vW/mgwv3C0AxagIWVpWoiWSUh4TsWT+uiKUcFM=; b=j0MZ3pSulgfgia0gDOaFQ2quc4XsV6H0JkfOiRw7MZO+eSYPbfkb32nj6Tv5jdayi+ eAhVT/KIbg+RZ5J5M8xAtKCTKQsSJQqGx9TR8Z1JMaDvBBTYgTFfU3UffoBj2UxmeNyF nctp+iZKqJDuGkKyngoFGI9KXjoTz8DzFnfcwIFoSd5SdIlvjEs6Nm2bFHjqlFjk4wQM sHfuwSqX3zHo17EZ2l5rBMf9ouSXdFqPHGW870GrYVP0HQa9HTLTEM7ihY35VQw7kcTC dZoSE/XCZVr/QEc6PfWIC8gyrqRAaaH98Q4UcIwtJSCr1BFGytxxfpWyQMcNUUY6wOvD /XJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=geLBSG86; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id by4-20020a0564021b0400b005234abc7d8asi2075858edb.589.2023.08.09.04.55.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 04:55:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=geLBSG86; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F17AC3854830 for ; Wed, 9 Aug 2023 11:54:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F17AC3854830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691582077; bh=UKzmwzldZQHza6qJwGz5lP6Wdk6WRJXHfPsJd4A0EWk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=geLBSG86gCfVkrD8BFrtkuQlyBl6Kfwqd8frhktYP5dCd8TRB3SFkx6Ohv9M9pNf4 deiRBzYorzydaCZRm0CPRoW8U9nY/+dA1SOSgDiDPLevBVlr2tDUD7OCQHyPE7YALg wVucgDjepMKjD67Gn6wvUviaXz1xIbHQGGGNYZ1M= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from hognose1.porkbun.com (hognose1.porkbun.com [35.82.102.206]) by sourceware.org (Postfix) with ESMTPS id E89243857BB2 for ; Wed, 9 Aug 2023 11:53:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E89243857BB2 Received: from cslab-raptor.. (unknown [166.111.226.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: c@jia.je) by hognose1.porkbun.com (Postfix) with ESMTPSA id 4B89043FAD; Wed, 9 Aug 2023 11:53:37 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, xuchenghua@loongson.cn, Jiajie Chen Subject: [PATCH v2 00/14] LoongArch: Add loongarch32 and ilp32 abi Date: Wed, 9 Aug 2023 19:46:07 +0800 Message-ID: <20230809115325.3716347-1-c@jia.je> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jiajie Chen via Gcc-patches From: Jiajie Chen Reply-To: Jiajie Chen Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773752394650506021 X-GMAIL-MSGID: 1773752394650506021 The patch series add loongarch32 and ilp32 abi support to gcc. One can build libgcc, libatomic and glibc etc and generate a complete loongarch32-unknown-linux-gnu-toolchain with minimal patches at: - binutils: https://github.com/jiegec/binutils-gdb/tree/loongarch32 - glibc: https://github.com/jiegec/glibc/tree/loongarch32 - crosstool-ng: https://github.com/jiegec/crosstool-ng/tree/loongarch32 We will wait for folks at Loongson to complete abi documentation of ilp32d abi. Changes since v1: - Can build a complete toolchain with glibc - Fix sizeof(long double) in ilp32 abi - Fix ftintrz generation for loongarch32 Full changes: Jiajie Chen (14): LoongArch: Introduce loongarch32 target LoongArch: Fix default ISA setting LoongArch: Fix SI division for loongarch32 target LoongArch: Fix movgr2frh.w operand order LoongArch: Fix 64-bit move for loongarch32 target LoongArch: Fix 64-bit immediate move for loongarch32 target LoongArch: Fix signed 32-bit overflow for loongarch32 target LoongArch: Disable SF/DF -> unsigned DI expand in loongarch32 LoongArch: Add -march=loongarch64 to tests with -mabi=lp64d LoongArch: Forbid ADDRESS_REG_REG in loongarch32 LoongArch: Mark am* instructions as LA64-only LoongArch: Set long double width to 128 in la32 LoongArch: Fix ilp32 detection LoongArch: Allow ftintrz for DF->DI in loongarch32 contrib/config-list.mk | 1 + gcc/config.gcc | 61 ++++++++++++++++--- .../loongarch/genopts/loongarch-strings | 5 ++ gcc/config/loongarch/genopts/loongarch.opt.in | 12 ++++ gcc/config/loongarch/gnu-user.h | 3 + gcc/config/loongarch/linux.h | 8 ++- gcc/config/loongarch/loongarch-c.cc | 12 ++++ gcc/config/loongarch/loongarch-def.c | 33 ++++++++++ gcc/config/loongarch/loongarch-def.h | 25 +++++--- gcc/config/loongarch/loongarch-driver.h | 4 ++ gcc/config/loongarch/loongarch-opts.cc | 27 ++++++-- gcc/config/loongarch/loongarch-opts.h | 20 ++++-- gcc/config/loongarch/loongarch-str.h | 5 ++ gcc/config/loongarch/loongarch.cc | 7 ++- gcc/config/loongarch/loongarch.h | 2 +- gcc/config/loongarch/loongarch.md | 39 ++++++------ gcc/config/loongarch/loongarch.opt | 12 ++++ gcc/config/loongarch/sync.md | 10 +-- gcc/config/loongarch/t-linux | 16 ++++- gcc/testsuite/g++.target/loongarch/bytepick.C | 2 +- gcc/testsuite/g++.target/loongarch/pr106828.C | 2 +- .../gcc.target/loongarch/add-const.c | 2 +- gcc/testsuite/gcc.target/loongarch/arch-1.c | 5 ++ gcc/testsuite/gcc.target/loongarch/arch-2.c | 5 ++ .../gcc.target/loongarch/array-ldx.c | 6 ++ .../gcc.target/loongarch/attr-model-1.c | 2 +- .../gcc.target/loongarch/attr-model-2.c | 2 +- .../gcc.target/loongarch/flt-abi-isa-1.c | 2 +- gcc/testsuite/gcc.target/loongarch/fscaleb.c | 2 +- .../gcc.target/loongarch/ftint-no-inexact.c | 2 +- gcc/testsuite/gcc.target/loongarch/ftint.c | 2 +- .../gcc.target/loongarch/func-call-1.c | 2 +- .../gcc.target/loongarch/func-call-2.c | 2 +- .../gcc.target/loongarch/func-call-3.c | 2 +- .../gcc.target/loongarch/func-call-4.c | 2 +- .../gcc.target/loongarch/func-call-5.c | 2 +- .../gcc.target/loongarch/func-call-6.c | 2 +- .../gcc.target/loongarch/func-call-7.c | 2 +- .../gcc.target/loongarch/func-call-8.c | 2 +- .../loongarch/func-call-extreme-1.c | 2 +- .../loongarch/func-call-extreme-2.c | 2 +- .../gcc.target/loongarch/func-call-medium-1.c | 2 +- .../gcc.target/loongarch/func-call-medium-2.c | 2 +- .../gcc.target/loongarch/func-call-medium-3.c | 2 +- .../gcc.target/loongarch/func-call-medium-4.c | 2 +- .../gcc.target/loongarch/func-call-medium-5.c | 2 +- .../gcc.target/loongarch/func-call-medium-6.c | 2 +- .../gcc.target/loongarch/func-call-medium-7.c | 2 +- .../gcc.target/loongarch/func-call-medium-8.c | 2 +- gcc/testsuite/gcc.target/loongarch/imm-load.c | 2 +- .../gcc.target/loongarch/imm-load1.c | 2 +- gcc/testsuite/gcc.target/loongarch/mulw_d_w.c | 2 +- .../gcc.target/loongarch/pr109465-1.c | 2 +- .../gcc.target/loongarch/pr109465-2.c | 2 +- .../gcc.target/loongarch/pr109465-3.c | 2 +- .../gcc.target/loongarch/prolog-opt.c | 2 +- .../loongarch/relocs-symbol-noaddend.c | 2 +- .../loongarch/zero-size-field-pass.c | 2 +- .../loongarch/zero-size-field-ret.c | 2 +- libitm/config/loongarch/asm.h | 2 +- 60 files changed, 298 insertions(+), 96 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/arch-1.c create mode 100644 gcc/testsuite/gcc.target/loongarch/arch-2.c create mode 100644 gcc/testsuite/gcc.target/loongarch/array-ldx.c