From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 3CDAC3948A71 for ; Mon, 3 Jun 2024 03:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3CDAC3948A71 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 3CDAC3948A71 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=1717383769; cv=none; b=OAZw+2rCM4EUvfuFuIFCiW879hWrEGMecOq7M8pQE+OUU8ufKiyar/6QfpDSYtPi68gm20mZsj5Vk9irAlWFQZs/kq5o104fHUQgWSubh1VaXUx90T/QSAMNW9ChUnanbJwMom2HFdgx8+oOWCe4ru5AzRZF4+P2cRMA6aVwEQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717383769; c=relaxed/simple; bh=f/9odLP1ekVUPO7cEkk94yj5OBZkStCmhLTVin6bdRY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SwE0lAo9YQgNonZ5wEs61D3uJ19cj6cbKXhK5+sZVDpkystH89hwLe9fMOa5Bbz9sVFAh9XDkSYnYZ8Ncq5m3UjR0CW8AD1R+ry8V+Vib3mc0v5o6t5YbWQT9BfJZVxAfpXPalUOfv5n18hiu5VwodQXbGShZq4uulvMyoSz0qU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4532wTb4028453; Mon, 3 Jun 2024 03:02:44 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=m+YGpI6CTYtlBm0A7GIlFCNSrr68wE3Vr7HlOd0YeEw=; b=DexfPBXcsyfSzjDkQGAkpfPaEE1KtUXWA8el+teeplYePw5hwbpq9iUtcpoqVrjNOZ5V jFI9/vrlhRJAoOOvD1pLFb/CUuktP8FAE7RyExvFXSnIoQJM8Vshjg/F0NkEtDq3NFvO +jMhV3emFfsbylkTS9SoajFBBXsanpYQeG8rqysfBELzh5ma4QMAYV2pHHpyy+EYd4Wi hnskD63aDeRFPF2Szb/n5o0ZUkCrNdEJ6EKyHENaBpSLnWhUysMjqPU2MOLbmk1lW2Qo +Lf4rsgHuQxxeEuYJ5LWgV4rq+PyJlt5cm/SPLrUvNTKlVfLC9YJtofsM31sjFnzpXrX WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh5gn0098-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:43 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 45332hJ9003852; Mon, 3 Jun 2024 03:02:43 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yh5gn0096-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:43 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4532kKTL026899; Mon, 3 Jun 2024 03:02:42 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ygffmn9vp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 03:02:42 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45332c2g51577294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2024 03:02:40 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E67E2004E; Mon, 3 Jun 2024 03:02:38 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEE7920040; Mon, 3 Jun 2024 03:02:37 +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:37 +0000 (GMT) From: Kewen Lin To: gcc-patches@gcc.gnu.org Cc: linkw@linux.ibm.com, jeffreyalaw@gmail.com, dave.anglin@bell.net Subject: [PATCH 50/52] pa: New hook implementation pa_c_mode_for_floating_type Date: Sun, 2 Jun 2024 22:01:40 -0500 Message-ID: <90f8ca6a30d4c01e0acd358b271a348daebbdc64.1717134752.git.linkw@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: oJJQu9FgTANduR_pudnn4Ub_Qt7yS3Pa X-Proofpoint-ORIG-GUID: uqweRN-zkt1E3zjucXK7aXSiwFGgzUXd 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 mlxlogscore=999 priorityscore=1501 malwarescore=0 bulkscore=0 clxscore=1011 impostorscore=0 phishscore=0 lowpriorityscore=0 spamscore=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 List-Id: This is to add new port specific hook implementation pa_c_mode_for_floating_type, as we remove defines in defaults.h for {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, this also defines them in pa.h but with PA_ prefix since we poison {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE. gcc/ChangeLog: * config/pa/pa.cc (pa_c_mode_for_floating_type): New function. (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. (pa_scalar_mode_supported_p): Rename FLOAT_TYPE_SIZE to PA_FLOAT_TYPE_SIZE, rename DOUBLE_TYPE_SIZE to PA_DOUBLE_TYPE_SIZE and rename LONG_DOUBLE_TYPE_SIZE to PA_LONG_DOUBLE_TYPE_SIZE. * config/pa/pa.h (PA_FLOAT_TYPE_SIZE): New macro. (PA_DOUBLE_TYPE_SIZE): Likewise. (PA_LONG_DOUBLE_TYPE_SIZE): Likewise. * config/pa/pa-64.h (FLOAT_TYPE_SIZE): Rename to ... (PA_FLOAT_TYPE_SIZE): ... this. (DOUBLE_TYPE_SIZE): Rename to ... (PA_DOUBLE_TYPE_SIZE): ... this. (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. * config/pa/pa-hpux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... (PA_LONG_DOUBLE_TYPE_SIZE): ... this. --- gcc/config/pa/pa-64.h | 12 ++++++------ gcc/config/pa/pa-hpux.h | 3 ++- gcc/config/pa/pa.cc | 21 ++++++++++++++++++--- gcc/config/pa/pa.h | 6 ++++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/gcc/config/pa/pa-64.h b/gcc/config/pa/pa-64.h index ea9d86ee7d4..b676468d2ce 100644 --- a/gcc/config/pa/pa-64.h +++ b/gcc/config/pa/pa-64.h @@ -58,12 +58,12 @@ along with GCC; see the file COPYING3. If not see #define LONG_TYPE_SIZE 64 #undef LONG_LONG_TYPE_SIZE #define LONG_LONG_TYPE_SIZE 64 -#undef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE 32 -#undef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE 64 -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 128 +#undef PA_FLOAT_TYPE_SIZE +#define PA_FLOAT_TYPE_SIZE 32 +#undef PA_DOUBLE_TYPE_SIZE +#define PA_DOUBLE_TYPE_SIZE 64 +#undef PA_LONG_DOUBLE_TYPE_SIZE +#define PA_LONG_DOUBLE_TYPE_SIZE 128 /* ?!? This needs to be made compile-time selectable. diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h index a7421d68ca0..accef447523 100644 --- a/gcc/config/pa/pa-hpux.h +++ b/gcc/config/pa/pa-hpux.h @@ -34,7 +34,8 @@ along with GCC; see the file COPYING3. If not see #define SIZE_TYPE "unsigned int" #define PTRDIFF_TYPE "int" -#define LONG_DOUBLE_TYPE_SIZE 128 +#undef PA_LONG_DOUBLE_TYPE_SIZE +#define PA_LONG_DOUBLE_TYPE_SIZE 128 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode) /* GCC always defines __STDC__. HP C++ compilers don't define it. This diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index a7af6b8c121..ab4bfc5d0c2 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -194,6 +194,7 @@ static rtx pa_internal_arg_pointer (void); static bool pa_can_eliminate (const int, const int); static void pa_conditional_register_usage (void); static machine_mode pa_c_mode_for_suffix (char); +static machine_mode pa_c_mode_for_floating_type (enum tree_index); static section *pa_function_section (tree, enum node_frequency, bool, bool); static bool pa_cannot_force_const_mem (machine_mode, rtx); static bool pa_legitimate_constant_p (machine_mode, rtx); @@ -398,6 +399,8 @@ static size_t n_deferred_plabels = 0; #define TARGET_CONDITIONAL_REGISTER_USAGE pa_conditional_register_usage #undef TARGET_C_MODE_FOR_SUFFIX #define TARGET_C_MODE_FOR_SUFFIX pa_c_mode_for_suffix +#undef TARGET_C_MODE_FOR_FLOATING_TYPE +#define TARGET_C_MODE_FOR_FLOATING_TYPE pa_c_mode_for_floating_type #undef TARGET_ASM_FUNCTION_SECTION #define TARGET_ASM_FUNCTION_SECTION pa_function_section @@ -6728,11 +6731,11 @@ pa_scalar_mode_supported_p (scalar_mode mode) return false; case MODE_FLOAT: - if (precision == FLOAT_TYPE_SIZE) + if (precision == PA_FLOAT_TYPE_SIZE) return true; - if (precision == DOUBLE_TYPE_SIZE) + if (precision == PA_DOUBLE_TYPE_SIZE) return true; - if (precision == LONG_DOUBLE_TYPE_SIZE) + if (precision == PA_LONG_DOUBLE_TYPE_SIZE) return true; return false; @@ -10808,6 +10811,18 @@ pa_c_mode_for_suffix (char suffix) return VOIDmode; } +/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return TFmode or DFmode + for TI_LONG_DOUBLE_TYPE which is for long double type, go with the + default one for the others. */ + +static machine_mode +pa_c_mode_for_floating_type (enum tree_index ti) +{ + if (ti == TI_LONG_DOUBLE_TYPE) + return PA_LONG_DOUBLE_TYPE_SIZE == 64 ? DFmode : TFmode; + return default_mode_for_floating_type (ti); +} + /* Target hook for function_section. */ static section * diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 127a0d1966d..7e45c358895 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1306,3 +1306,9 @@ do { \ /* An integer expression for the size in bits of the largest integer machine mode that should actually be used. We allow pairs of registers. */ #define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TARGET_64BIT ? TImode : DImode) + +/* Define these macros as default for all subtargets, add PA_ prefix + as {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE get poisoned. */ +#define PA_FLOAT_TYPE_SIZE BITS_PER_WORD +#define PA_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#define PA_LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -- 2.43.0