From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by sourceware.org (Postfix) with ESMTPS id 8E92A395B475 for ; Mon, 3 Jun 2024 09:02:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E92A395B475 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=libertysurf.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=libertysurf.fr ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E92A395B475 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.27.42.2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717405338; cv=none; b=Mu77LRAROf6hNZOSUCo1WG+HpN67V/eFu7TIDGSgGlqk72uxMRkphFLmR17HvW1Frm1CRLms4wWXyHska9s3WvUJasSPHSACAw1ZSHqh8Ly+MIGglOb4mCRIGQBZVbDOK4Gpi9TAE5omjwOFwVsMAYivCWacBdo3O9sB+D/okTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717405338; c=relaxed/simple; bh=/KGuikRaDHLKFdIKYTKaSw/UnxyLcHLu+iPMWsfBb4Q=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Vuw0ciiQk8UK/tOKlYJ4cObL0SukSrHWDjylpEA9/BCpCabsbA8SAUikqzlebjud4Jq56/alCwFZ+KFrxdBX/QhK894DvenZBoZ8lyLWKqtyFC/oVFgQ67aa5PRZB1PLcLks+BSEaQjM8al4VNYbqOv4wYTqDdoTX7z077X2AfQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fomalhaut.localnet (unknown [IPv6:2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp2-g21.free.fr (Postfix) with ESMTPS id 2F62C2003ED; Mon, 3 Jun 2024 11:02:11 +0200 (CEST) From: Eric Botcazou To: Kewen Lin Cc: gcc-patches@gcc.gnu.org, linkw@linux.ibm.com, davem@redhat.com Subject: Re: [PATCH 51/52] sparc: New hook implementation sparc_c_mode_for_floating_type Date: Mon, 03 Jun 2024 11:02:11 +0200 Message-ID: <2327262.ElGaqSPkdT@fomalhaut> In-Reply-To: <9966800639115aedb7524421aa5078663e3fe6fb.1717134752.git.linkw@linux.ibm.com> References: <9966800639115aedb7524421aa5078663e3fe6fb.1717134752.git.linkw@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > * config/sparc/sparc.cc (sparc_c_mode_for_floating_type): New > (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro. > (FLOAT_TYPE_SIZE): Remove. > (DOUBLE_TYPE_SIZE): Likewise. > (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > (sparc_type_code): Replace FLOAT_TYPE_SIZE with TYPE_PRECISION of > float_type_node. > * config/sparc/sparc.h (FLOAT_TYPE_SIZE): Remove. > (DOUBLE_TYPE_SIZE): Remove. > * config/sparc/freebsd.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/linux.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/linux64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/netbsd-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/openbsd64.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/sol2.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/sp-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. > * config/sparc/sp64-elf.h (LONG_DOUBLE_TYPE_SIZE): Rename to ... > (SPARC_LONG_DOUBLE_TYPE_SIZE): ... this. OK, modulo the following tweaks: > --- a/gcc/config/sparc/sparc.cc > +++ b/gcc/config/sparc/sparc.cc > @@ -718,6 +718,7 @@ static bool sparc_vectorize_vec_perm_const > (machine_mode, machine_mode, const vec_perm_indices &); > static bool sparc_can_follow_jump (const rtx_insn *, const rtx_insn *); > static HARD_REG_SET sparc_zero_call_used_regs (HARD_REG_SET); > +static machine_mode sparc_c_mode_for_floating_type (enum tree_index); > > #ifdef SUBTARGET_ATTRIBUTE_TABLE > /* Table of valid machine attributes. */ > @@ -971,6 +972,9 @@ char sparc_hard_reg_printed[8]; > #undef TARGET_ZERO_CALL_USED_REGS > #define TARGET_ZERO_CALL_USED_REGS sparc_zero_call_used_regs > > +#undef TARGET_C_MODE_FOR_FLOATING_TYPE > +#define TARGET_C_MODE_FOR_FLOATING_TYPE sparc_c_mode_for_floating_type > + > struct gcc_target targetm = TARGET_INITIALIZER; > > /* Return the memory reference contained in X if any, zero otherwise. */ > @@ -9824,16 +9828,9 @@ sparc_assemble_integer (rtx x, unsigned int size, int > aligned_p) #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) > #endif > > -#ifndef FLOAT_TYPE_SIZE > -#define FLOAT_TYPE_SIZE BITS_PER_WORD > -#endif > - > -#ifndef DOUBLE_TYPE_SIZE > -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) > -#endif > - > -#ifndef LONG_DOUBLE_TYPE_SIZE > -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) > +/* LONG_DOUBLE_TYPE_SIZE get poisoned, so add SPARC_ prefix. */ > +#ifndef SPARC_LONG_LONG_TYPE_SIZE > +#define SPARC_LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) > #endif > > unsigned long You can delete {SPARC_}LONG_DOUBLE_TYPE_SIZE too. > @@ -9920,7 +9917,7 @@ sparc_type_code (tree type) > /* Carefully distinguish all the standard types of C, > without messing up if the language is not C. */ > > - if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE) > + if (TYPE_PRECISION (type) == TYPE_PRECISION (float_type_node)) > return (qualifiers | 6); > > else > @@ -13984,4 +13981,16 @@ sparc_zero_call_used_regs (HARD_REG_SET > need_zeroed_hardregs) return need_zeroed_hardregs; > } > > +/* 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 > +sparc_c_mode_for_floating_type (enum tree_index ti) > +{ > + if (ti == TI_LONG_DOUBLE_TYPE) > + return SPARC_LONG_DOUBLE_TYPE_SIZE == 128 ? TFmode : DFmode; > + return default_mode_for_floating_type (ti); > +} > + > #include "gt-sparc.h" I think that TI_LONG_DOUBLE_TYPE is self-explanatory so just: /* Implement TARGET_C_MODE_FOR_FLOATING_TYPE. Return TFmode or DFmode for TI_LONG_DOUBLE_TYPE and the default for others. -- Eric Botcazou