From patchwork Mon Jun 3 03:01:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1942634 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=Q27fuzYj; 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 4VszLj1mS1z20Q1 for ; Mon, 3 Jun 2024 13:13:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D1B13952515 for ; Mon, 3 Jun 2024 03:12:59 +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 B001C394743F; Mon, 3 Jun 2024 03:02:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B001C394743F 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 B001C394743F 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=1717383760; cv=none; b=o6mvieIxDGKUFA4a1CZqxXbObMeYtz8CaW0ucyfhl7cAbqckUXoBEpP8COKlxNjEZpvyRZhTvxGqXIdrs8GnGetZkOfP7v8LBAOFHi/Ma009TCXJpOorGqqp1wZT9t+u7psozGyAKNWqNqYcvyRYjenWgrlF611DCTVwLYb3cto= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717383760; c=relaxed/simple; bh=RfRxePalUueJA5F35oQJbPn6vwjeudI+wn5drplYpJU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e3UgCbk+5Q+S6rzWvjMPiQJNVplf0ID/5Juzn84vD54oHjIjPCQ5Z8QTPEG94q/eqTjUFtfX6Mwg5LKRgSNd71XQyVDx0dF60fKcQ9GJZ9i6cFT56s4TG7mVwrlltQ9mTNfBZTy3OXzAw7uuQ5XEPjrOUHMT2UFlA3YFbb+GV0U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4532ZLDH029590; Mon, 3 Jun 2024 03:02:38 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=Zi6yaQuVk+OYXvZys9xp7yVvxGPq1ijE7Z8eMXyd6u0=; b=Q27fuzYjv/64mLKO4jYmQFePWQcqw2AAVVUJfgJvP1JuycqxilvR9brUCgB0YgeSd2sT GajxVEKti5FFHev5e98BmZN/j40KHB860AVla2h8qqe/ITx1FvavXsrrQrLIn9uEA9uk DRRd1H0G396tcpb3HRNU8UXuXtZ9v/07c20YGYqdkZHY49X4eYujW6vWP4JqtY8flRs2 JTX9wbxPq3q0Ht+/i9ll5obTrc/hNJ5VsZPf2Uf66qqvfLFN4Yw1BMQzJ19F49tNCUHf bCbrcO+Muz9BkMLTC8PP/bAz2Vm+wBwE/THM8RQx4zo8kSi9KIo9rY6kdn62303z6Chi Nw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh4ug8275-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:37 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4530Vt6V026652; Mon, 3 Jun 2024 03:02:37 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yggp2mxw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:37 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45332XWT52363716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2024 03:02:35 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5751320040; Mon, 3 Jun 2024 03:02:33 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8787C2004E; Mon, 3 Jun 2024 03:02:32 +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:32 +0000 (GMT) From: Kewen Lin To: gcc-patches@gcc.gnu.org Cc: linkw@linux.ibm.com, aoliva@gcc.gnu.org, olegendo@gcc.gnu.org Subject: [PATCH 45/52] sh: New hook implementation sh_c_mode_for_floating_type Date: Sun, 2 Jun 2024 22:01:35 -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-ORIG-GUID: 5feJ-6xDvTJNXzjzu9u13EQpyXWO1yvq X-Proofpoint-GUID: 5feJ-6xDvTJNXzjzu9u13EQpyXWO1yvq 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 suspectscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1011 mlxlogscore=915 malwarescore=0 mlxscore=0 adultscore=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 remove macro LONG_DOUBLE_TYPE_SIZE define in sh port, and add new port specific hook implementation sh_c_mode_for_floating_type. gcc/ChangeLog: * config/sh/sh.cc (sh_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. * config/sh/sh.h (LONG_DOUBLE_TYPE_SIZE): Remove. --- gcc/config/sh/sh.cc | 18 ++++++++++++++++++ gcc/config/sh/sh.h | 10 ---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc index ef3c2e6791d..bc017420381 100644 --- a/gcc/config/sh/sh.cc +++ b/gcc/config/sh/sh.cc @@ -328,6 +328,7 @@ static unsigned int sh_hard_regno_nregs (unsigned int, machine_mode); static bool sh_hard_regno_mode_ok (unsigned int, machine_mode); static bool sh_modes_tieable_p (machine_mode, machine_mode); static bool sh_can_change_mode_class (machine_mode, machine_mode, reg_class_t); +static machine_mode sh_c_mode_for_floating_type (enum tree_index); TARGET_GNU_ATTRIBUTES (sh_attribute_table, { @@ -664,6 +665,9 @@ TARGET_GNU_ATTRIBUTES (sh_attribute_table, #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed +#undef TARGET_C_MODE_FOR_FLOATING_TYPE +#define TARGET_C_MODE_FOR_FLOATING_TYPE sh_c_mode_for_floating_type + struct gcc_target targetm = TARGET_INITIALIZER; @@ -10674,6 +10678,20 @@ sh_can_change_mode_class (machine_mode from, machine_mode to, return true; } +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return SFmode or DFmode + for TI_DOUBLE_TYPE which is for double type, go with the default one + for the others. */ + +static machine_mode +sh_c_mode_for_floating_type (enum tree_index ti) +{ + /* Since the SH2e has only `float' support, it is desirable to make all + floating point types equivalent to `float'. */ + if (ti == TI_DOUBLE_TYPE) + return TARGET_FPU_SINGLE_ONLY ? SFmode : DFmode; + return default_mode_for_floating_type (ti); +} + /* Return true if registers in machine mode MODE will likely be allocated to registers in small register classes. */ bool diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 7d3a3f08338..53cad85d122 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -425,9 +425,6 @@ extern const sh_atomic_model& selected_atomic_model (void); /* Width in bits of a `long long'. */ #define LONG_LONG_TYPE_SIZE 64 -/* Width in bits of a `long double'. */ -#define LONG_DOUBLE_TYPE_SIZE 64 - /* Width of a word, in units (bytes). */ #define UNITS_PER_WORD (4) #define MIN_UNITS_PER_WORD 4 @@ -1433,13 +1430,6 @@ extern bool current_function_interrupt; Do not define this if the table should contain absolute addresses. */ #define CASE_VECTOR_PC_RELATIVE 1 -/* Define it here, so that it doesn't get bumped to 64-bits on SHmedia. */ -#define FLOAT_TYPE_SIZE 32 - -/* Since the SH2e has only `float' support, it is desirable to make all - floating point types equivalent to `float'. */ -#define DOUBLE_TYPE_SIZE (TARGET_FPU_SINGLE_ONLY ? 32 : 64) - /* 'char' is signed by default. */ #define DEFAULT_SIGNED_CHAR 1