From patchwork Thu Jul 4 09:56:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cheng X-Patchwork-Id: 1956763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WFBrT4dNsz1xqb for ; Thu, 4 Jul 2024 19:56:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21CFB384A4BC for ; Thu, 4 Jul 2024 09:56:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 545C03858C41 for ; Thu, 4 Jul 2024 09:56:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 545C03858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 545C03858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720086995; cv=none; b=DAWNm4+O+vg0qS8k6+q7ZIYmPTMs+3bHAtK9AeFhRf7cEkNey+hXy6p8NlSTF2OdjP1APAZUBkQ2Ik+oQ3JJIhd5GSQnjKykHi4vBqxaoagbpvHLri+FJERWo4hCxKZcY+MwITttwwtJImgAbMCa8VTS+DfORiF5arCpB1QIeCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720086995; c=relaxed/simple; bh=BklTIJgxiffcRVC9vd+o5xEH4x5HdvmcihF16hHfO9s=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=TdA3VBzqQW/1AAhSxXNc0/Zd0LC4GzbQyzmdoFmYTPGVVZkUyqk2TS00JvojSMuNOHfOPItMdEgODIfQI9kI6aHymKjhJbjNV2kwIDl/5kX+Q9J+wtYrs+ZLVz5injI91PuSQSckVpBmAlojJ8xGldaFYEbHZf+pgyrIDBxLRG0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8BxK_DNcYZm2uUAAA--.2779S3; Thu, 04 Jul 2024 17:56:29 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxssTKcYZmlew6AA--.59854S2; Thu, 04 Jul 2024 17:56:28 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn, chenglulu@loongson.cn Subject: [PATCH 1/2] LoongArch: TFmode is not allowed to be stored in the float register. Date: Thu, 4 Jul 2024 17:56:23 +0800 Message-Id: <20240704095624.10023-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxssTKcYZmlew6AA--.59854S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoW7WFWxWr18try7CrW3WFykZwc_yoW5Jr47pr y7uwnxtr48JFZxGrWqq345WFsxAr9rGrW2vayS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ELO_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org PR target/115752 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_hard_regno_mode_ok_uncached): Replace UNITS_PER_FPVALUE with UNITS_PER_HWFPVALUE. * config/loongarch/loongarch.h (UNITS_PER_FPVALUE): Delete. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr115752.c: New test. --- gcc/config/loongarch/loongarch.cc | 2 +- gcc/config/loongarch/loongarch.h | 7 ------- gcc/testsuite/gcc.target/loongarch/pr115752.c | 8 ++++++++ 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/pr115752.c diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index e2ff2af89e2..803ed0575bd 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -6705,7 +6705,7 @@ loongarch_hard_regno_mode_ok_uncached (unsigned int regno, machine_mode mode) if (mclass == MODE_FLOAT || mclass == MODE_COMPLEX_FLOAT || mclass == MODE_VECTOR_FLOAT) - return size <= UNITS_PER_FPVALUE; + return size <= UNITS_PER_HWFPVALUE; /* Allow integer modes that fit into a single register. We need to put integers into FPRs when using instructions like CVT diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index b9323aba394..5efeae53be6 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -146,13 +146,6 @@ along with GCC; see the file COPYING3. If not see #define UNITS_PER_HWFPVALUE \ (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FP_REG) -/* The largest size of value that can be held in floating-point - registers. */ -#define UNITS_PER_FPVALUE \ - (TARGET_SOFT_FLOAT ? 0 \ - : TARGET_SINGLE_FLOAT ? UNITS_PER_FP_REG \ - : LA_LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT) - /* The number of bytes in a double. */ #define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT) diff --git a/gcc/testsuite/gcc.target/loongarch/pr115752.c b/gcc/testsuite/gcc.target/loongarch/pr115752.c new file mode 100644 index 00000000000..df4bae524f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/pr115752.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ + +long double +test (long double xx) +{ + __asm ("" :: "f"(xx)); /* { dg-error "inconsistent operand constraints in an 'asm'" } */ + return xx + 1; +}