From patchwork Mon Jun 3 03:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1942635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=MTUK8ilf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4VszMl1tdtz20Q1 for ; Mon, 3 Jun 2024 13:13:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78C9D39540B7 for ; Mon, 3 Jun 2024 03:13:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 578DA39484B0 for ; Mon, 3 Jun 2024 03:02:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 578DA39484B0 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 578DA39484B0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717383764; cv=none; b=UIhoyjbuUdt4OxrnViAL+Mok80FKJNAdL46bQxUc/LT05RveslstzyPQbD4FGS52rws5atKA1YgTJIFClB0f3HtjOV4Ga0E3c3ZNOwqBjdqWTWAeyHUkeLZtJRdtbSRdKzOgtjsDmZhEmUolJFnC1kmIfJ7sX1R67J460NhxndQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717383764; c=relaxed/simple; bh=SGNSLMecweLJUg42h4j1z4itKbljXmEpFtAH0nw2Glg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=CAIptiZIVrJOouBAFJfmVJ77BTdjfHg5u0O3kB0uSlIQooKEc8ncrvclzqaDb3ZJ82/WKIBVuQ6UbYnhy8nB9xxtcxsOvdv+XcROOgOPoCviVf/blOMsGIBwTOVv0Gi0uCFEHQhRmBu6JDkaBm5nOGRLdfcImuqODFJbnKaivtg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4532rK9r009592; Mon, 3 Jun 2024 03:02:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=0zwfeIQomz1yiAsc/VD6/09d/SLPynhXBRk/uQGCjTc=; b=MTUK8ilfulVPeCKpERurLCmUOzkC69PdmjZ69URKpAWD46csl6egnbcXUhbFCpkWMOG6 A0BDlyZkFfD5QcaVk2fe94WWv8j7YWo7XYrWdviOyAFl44gSiMkRKjtTkVqlyvWP1nK9 AuzB7PbMsjrcPlHZPo29PsZQQSEvQCXBntlHs9sO+dU5+RotLKub++5azLey6B+3OSGs Anx6O0h3EI1KY2zKGiTSD0YHdqupWpPc+CUxHMYkeTtcJDPh2yHWVCRh/ptY4tQsBvus lGuiJKgBPNSv1Ew8Av8bmd9eNwai3Qv51gy0n8do+mz6sOLWwDaDC9mdTYP7x7jQmc7J lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh5e8g0nq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:41 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 45332fvZ024161; Mon, 3 Jun 2024 03:02:41 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh5e8g0nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:41 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 452NeqvU022807; Mon, 3 Jun 2024 03:02:40 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ygg6kw452-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:40 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45332akF57541088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2024 03:02:38 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92A5920043; Mon, 3 Jun 2024 03:02:36 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A44C720040; Mon, 3 Jun 2024 03:02:35 +0000 (GMT) Received: from trout.aus.stglabs.ibm.com (unknown [9.40.194.100]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 3 Jun 2024 03:02:35 +0000 (GMT) From: Kewen Lin To: gcc-patches@gcc.gnu.org Cc: linkw@linux.ibm.com, jeffreyalaw@gmail.com, schwab@linux-m68k.org, phdm@macqel.be Subject: [PATCH 48/52] m68k: New hook implementation m68k_c_mode_for_floating_type Date: Sun, 2 Jun 2024 22:01:38 -0500 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: crGOAlRUJze3pcd-V2q6owub4tE8UcnR X-Proofpoint-ORIG-GUID: po4iA0JbUP6v9w3c_YkekKhQY6y-yFNE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-06-02_15,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 spamscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 phishscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxscore=0 mlxlogscore=877 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406030025 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 This is to add new port specific hook implementation m68k_c_mode_for_floating_type, remove macro LONG_DOUBLE_TYPE_SIZE and add new macro LONG_DOUBLE_TYPE_MODE which some subtarget can redefine. gcc/ChangeLog: * config/m68k/m68k.cc (m68k_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/m68k/m68k.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. * config/m68k/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_MODE): New macro. --- gcc/config/m68k/m68k.cc | 16 ++++++++++++++++ gcc/config/m68k/m68k.h | 4 ++-- gcc/config/m68k/netbsd-elf.h | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gcc/config/m68k/m68k.cc b/gcc/config/m68k/m68k.cc index b1c9238949f..79ba4d5343c 100644 --- a/gcc/config/m68k/m68k.cc +++ b/gcc/config/m68k/m68k.cc @@ -198,6 +198,7 @@ static machine_mode m68k_promote_function_mode (const_tree, machine_mode, int *, const_tree, int); static void m68k_asm_final_postscan_insn (FILE *, rtx_insn *insn, rtx [], int); static HARD_REG_SET m68k_zero_call_used_regs (HARD_REG_SET); +static machine_mode m68k_c_mode_for_floating_type (enum tree_index); /* Initialize the GCC target structure. */ @@ -365,6 +366,9 @@ static HARD_REG_SET m68k_zero_call_used_regs (HARD_REG_SET); #undef TARGET_ZERO_CALL_USED_REGS #define TARGET_ZERO_CALL_USED_REGS m68k_zero_call_used_regs +#undef TARGET_C_MODE_FOR_FLOATING_TYPE +#define TARGET_C_MODE_FOR_FLOATING_TYPE m68k_c_mode_for_floating_type + TARGET_GNU_ATTRIBUTES (m68k_attribute_table, { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, @@ -7212,4 +7216,16 @@ m68k_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs) return need_zeroed_hardregs; } +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return XFmode or DFmode + for TI_LONG_DOUBLE_TYPE which is for long double type, go with the + default one for the others. */ + +static machine_mode +m68k_c_mode_for_floating_type (enum tree_index ti) +{ + if (ti == TI_LONG_DOUBLE_TYPE) + return LONG_DOUBLE_TYPE_MODE; + return default_mode_for_floating_type (ti); +} + #include "gt-m68k.h" diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 1aa89f1789b..0d571997143 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -278,8 +278,8 @@ along with GCC; see the file COPYING3. If not see /* "long double" is the same as "double" on ColdFire and fido targets. */ -#define LONG_DOUBLE_TYPE_SIZE \ - ((TARGET_COLDFIRE || TARGET_FIDOA) ? 64 : 80) +#define LONG_DOUBLE_TYPE_MODE \ + ((TARGET_COLDFIRE || TARGET_FIDOA) ? DFmode : XFmode) #define BITS_BIG_ENDIAN 1 #define BYTES_BIG_ENDIAN 1 diff --git a/gcc/config/m68k/netbsd-elf.h b/gcc/config/m68k/netbsd-elf.h index 5239f09b4cc..6fc5ad1a0a6 100644 --- a/gcc/config/m68k/netbsd-elf.h +++ b/gcc/config/m68k/netbsd-elf.h @@ -36,8 +36,8 @@ along with GCC; see the file COPYING3. If not see while (0) /* Don't try using XFmode on the 68010. */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (TARGET_68020 ? 80 : 64) +#undef LONG_DOUBLE_TYPE_MODE +#define LONG_DOUBLE_TYPE_MODE (TARGET_68020 ? XFmode : DFmode) #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \