From patchwork Mon Jun 3 03:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1942626 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=ULCVKmxM; dkim-atps=neutral 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 4VszKG0jr2z20Q1 for ; Mon, 3 Jun 2024 13:11:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56FE339540A7 for ; Mon, 3 Jun 2024 03:11:44 +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 0A534394800E for ; Mon, 3 Jun 2024 03:02:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A534394800E 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 0A534394800E 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=1717383763; cv=none; b=ADynoCuJ8mF31ujuxRdv1VDn1b1Pj0Ov35a5a+hER11p6HrMUKxqiP5fgnEJl8v8IK3hbU7Cx4N+hmddQuDKB1GCuh7nezColzD4YYA2d8x5vE+8VQPVTzWfJO0u2SJgFSZCXaPkx8MGzhXKkwnN8zdpnGpgy3jnYFbQFiTu1IA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717383763; c=relaxed/simple; bh=abdGde+uHJOv5Xo4MblOEsM6rCaHYTjJLIzquhIq9P0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jvv372xswnoEQVCf0wq9X/1GZq5KNyq1QLocE2313STK/nCb2UF7AvLYnX4aZJAC7/RJ05Fwa8hKxfBTOM79udVtFGRW7Brub7TIv9ASaaqS3jMb0Gr29BixvuYW2qrzVRPDL+UZJJwgVKgznf1v0hDHD2Ga8/Ff95SrGCswNjA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4532RO1c020534 for ; Mon, 3 Jun 2024 03:02:41 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=oSC5Ooa8HZJI8fhMaUDjAoLTRgTgGQdabJW9RBoZD2g=; b=ULCVKmxMjb8A+SDY2EkeQKt2YPmRe6To+PHof8gaPmRMu8VCk2ELfJGt8fmEw+MxfEae iz+pQlUZQKmmkBHYSKfEUE72ZCje80Y3tQqWrComylWgd54vARRsOXvNy0bu79TSK55j YiyWY0GYgUWM1JAfyxluhVQUNWVMf9E1UoGpQ3Odq2AlHwz8k3pK8LsqtjsCvBBN9Lz6 eOaYpqdrPjrd9if2sA2LAtVisRXPHOiCCek/xIRiu64GcU0I6pStqO4tj9cMazMnDGw0 vqEifyPaWZJkXnyEM5S77GsoUM/BkkEtn0lbZgR195Cz8guDBqokgI7DIGMzQ0DDhbFb 9g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh52d81vc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 03 Jun 2024 03:02:41 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 45332ev5006814 for ; Mon, 3 Jun 2024 03:02:40 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh52d81va-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:40 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4531QPJJ008479; Mon, 3 Jun 2024 03:02:40 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ygec0dm4f-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 smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45332YEh13107694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2024 03:02:36 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58FF92006A; Mon, 3 Jun 2024 03:02:34 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A87302005A; Mon, 3 Jun 2024 03:02:33 +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:33 +0000 (GMT) From: Kewen Lin To: gcc-patches@gcc.gnu.org Cc: linkw@linux.ibm.com, jeffreyalaw@gmail.com Subject: [PATCH 46/52] h8300: New hook implementation h8300_c_mode_for_floating_type Date: Sun, 2 Jun 2024 22:01:36 -0500 Message-ID: <35df84c1002156995ee9d88f4743fc4050b8004c.1717134752.git.linkw@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: QPBme-flJhewfDcvlILuygqYSdCwhpJ7 X-Proofpoint-GUID: uCFx9JRKT234w7DeG86cme06xcS3EpjG 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 priorityscore=1501 malwarescore=0 spamscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 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 h8300_c_mode_for_floating_type, remove useless macro defines for {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE and add new macro DOUBLE_TYPE_MODE which some subtarget can redefine. gcc/ChangeLog: * config/h8300/h8300.cc (h8300_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/h8300/h8300.h (FLOAT_TYPE_SIZE): Remove. (DOUBLE_TYPE_SIZE): Remove. (LONG_DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. * config/h8300/linux.h (DOUBLE_TYPE_SIZE): Remove. (DOUBLE_TYPE_MODE): New macro. --- gcc/config/h8300/h8300.cc | 15 +++++++++++++++ gcc/config/h8300/h8300.h | 4 +--- gcc/config/h8300/linux.h | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc index 9ac6d52f9d6..7ab26f2b7f9 100644 --- a/gcc/config/h8300/h8300.cc +++ b/gcc/config/h8300/h8300.cc @@ -5601,6 +5601,18 @@ h8300_ok_for_sibcall_p (tree fndecl, tree) return 1; } +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return SFmode or DFmode + for TI_{LONG_,}DOUBLE_TYPE which is for {long,} double type, go with + the default one for the others. */ + +static machine_mode +h8300_c_mode_for_floating_type (enum tree_index ti) +{ + if (ti == TI_DOUBLE_TYPE || ti == TI_LONG_DOUBLE_TYPE) + return DOUBLE_TYPE_MODE; + return default_mode_for_floating_type (ti); +} + /* Return TRUE if OP is a PRE_INC or PRE_DEC instruction using REG, FALSE otherwise. */ @@ -5721,4 +5733,7 @@ pre_incdec_with_reg (rtx op, unsigned int reg) #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL h8300_ok_for_sibcall_p +#undef TARGET_C_MODE_FOR_FLOATING_TYPE +#define TARGET_C_MODE_FOR_FLOATING_TYPE h8300_c_mode_for_floating_type + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index bb0bf7404e0..d25689ccec8 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -149,9 +149,7 @@ extern const char * const *h8_reg_names; #define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16) #define LONG_TYPE_SIZE 32 #define LONG_LONG_TYPE_SIZE 64 -#define FLOAT_TYPE_SIZE 32 -#define DOUBLE_TYPE_SIZE 32 -#define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE +#define DOUBLE_TYPE_MODE SFmode #define MAX_FIXED_MODE_SIZE 32 diff --git a/gcc/config/h8300/linux.h b/gcc/config/h8300/linux.h index 326c481b512..6e21db37655 100644 --- a/gcc/config/h8300/linux.h +++ b/gcc/config/h8300/linux.h @@ -36,8 +36,8 @@ along with GCC; see the file COPYING3. If not see #define TARGET_DEFAULT (MASK_QUICKCALL | MASK_INT32 | MASK_H8300H) /* Width of a word, in units (bytes). */ -#undef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE 64 +#undef DOUBLE_TYPE_MODE +#define DOUBLE_TYPE_MODE DFmode #undef DEFAULT_SIGNED_CHAR #define DEFAULT_SIGNED_CHAR 1