From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org, josmyers@redhat.com,
segher@kernel.crashing.org, bergner@linux.ibm.com,
richard.sandiford@arm.com, jakub@redhat.com,
jeffreyalaw@gmail.com
Subject: Re: [PATCH 09/52] Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode_for_floating_type
Date: Mon, 3 Jun 2024 17:36:55 +0800 [thread overview]
Message-ID: <55406c9d-5c82-0b6e-e4ee-5dfec3b0b4ed@linux.ibm.com> (raw)
In-Reply-To: <CAFiYyc0U2uVk6274p5zObWLDBTS_ZpHeqkXqC6YvK9bVQF2Oww@mail.gmail.com>
Hi Richi,
on 2024/6/3 14:49, Richard Biener wrote:
> On Mon, Jun 3, 2024 at 5:02 AM Kewen Lin <linkw@linux.ibm.com> wrote:
>>
>> Currently how we determine which mode will be used for a
>> floating point type is that for a given type precision
>> (size) call mode_for_size to get the first mode which has
>> this size in the specified class. On Powerpc, we have
>> three modes (TF/KF/IF) having the same mode precision 128
>> (see[1]), so the processing forces us to have to place TF
>> at the first place, it would require us to make more
>> adjustment in some generic code to avoid some unexpected
>> mode conversions and it would be even worse if we get rid
>> of TF eventually one day. And as Joseph pointed out in [2],
>> "floating types should have their mode, not a poorly
>> defined precision value", as Joseph and Richi suggested,
>> this patch is to introduce one hook mode_for_floating_type
>> which returns the corresponding mode for type float, double
>> or long double. The default implementation returns SFmode
>> for float and DFmode for double or long double. For ports
>> which need special treatment, there are some other patches
>> for their own port specific implementation (referring to
>> how {,LONG_}DOUBLE_TYPE_SIZE get used there). For all
>> generic uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE, depending
>> on the context, some of them are replaced with TYPE_PRECISION
>> of the according type node, some other are replaced with
>> GET_MODE_PRECISION on the mode from mode_for_floating_type.
>> This patch also poisons {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE,
>> so most defines of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE in port
>> specific are removed, but there are still some which are
>> good to be kept for readability then they get renamed with
>> port specific prefix.
>>
>> [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651017.html
>> [2] https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651209.html
>>
>> gcc/ChangeLog:
>>
>> * coretypes.h (enum tree_index): Forward declaration.
>> * defaults.h (FLOAT_TYPE_SIZE): Remove.
>> (DOUBLE_TYPE_SIZE): Likewise.
>> (LONG_DOUBLE_TYPE_SIZE): Likewise.
>> * doc/rtl.texi: Update document by replacing {FLOAT,DOUBLE}_TYPE_SIZE
>> with C type {float,double}.
>> * doc/tm.texi.in: Document new hook mode_for_floating_type, remove
>> document entries for {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE and
>> update document for WIDEST_HARDWARE_FP_SIZE.
>> * doc/tm.texi: Regenerate.
>> * emit-rtl.cc (init_emit_once): Replace DOUBLE_TYPE_SIZE by
>> calling targetm.c.mode_for_floating_type with TI_DOUBLE_TYPE.
>> * real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use TYPE_PRECISION of
>> long_double_type_node to replace LONG_DOUBLE_TYPE_SIZE.
>> * system.h (FLOAT_TYPE_SIZE): Poison.
>> (DOUBLE_TYPE_SIZE): Likewise.
>> (LONG_DOUBLE_TYPE_SIZE): Likewise.
>> * target.def (mode_for_floating_type): New hook.
>> * targhooks.cc (default_mode_for_floating_type): New function.
>> (default_scalar_mode_supported_p): Update macros
>> {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling
>> targetm.c.mode_for_floating_type with
>> TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE.
>> * targhooks.h (default_mode_for_floating_type): New declaration.
>> * tree-core.h (enum tree_index): Specify underlying type unsigned
>> to sync with forward declaration in coretypes.h.
>> (NUM_FLOATN_TYPES): Explicitly convert to int.
>> (NUM_FLOATNX_TYPES): Likewise.
>> (NUM_FLOATN_NX_TYPES): Likewise.
>> * tree.cc (build_common_tree_nodes): Update macros
>> {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE by calling
>> targetm.c.mode_for_floating_type with
>> TI_{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE and set type mode accordingly.
>> ---
>> gcc/coretypes.h | 1 +
>> gcc/defaults.h | 12 ------------
>> gcc/doc/rtl.texi | 2 +-
>> gcc/doc/tm.texi | 33 +++++++++++++--------------------
>> gcc/doc/tm.texi.in | 27 +++++++--------------------
>> gcc/emit-rtl.cc | 3 ++-
>> gcc/real.h | 7 ++++---
>> gcc/system.h | 3 ++-
>> gcc/target.def | 9 +++++++++
>> gcc/targhooks.cc | 18 +++++++++++++++---
>> gcc/targhooks.h | 1 +
>> gcc/tree-core.h | 13 +++++++------
>> gcc/tree.cc | 18 +++++++++++++++---
>> 13 files changed, 77 insertions(+), 70 deletions(-)
>>
>> diff --git a/gcc/coretypes.h b/gcc/coretypes.h
>> index 1ac6f0abea3..00c1c58bd8c 100644
>> --- a/gcc/coretypes.h
>> +++ b/gcc/coretypes.h
>> @@ -100,6 +100,7 @@ struct gimple;
>> typedef gimple *gimple_seq;
>> struct gimple_stmt_iterator;
>> class code_helper;
>> +enum tree_index : unsigned;
>>
>> /* Forward declare rtx_code, so that we can use it in target hooks without
>> needing to pull in rtl.h. */
>> diff --git a/gcc/defaults.h b/gcc/defaults.h
>> index 92f3e07f742..ac2d25852ab 100644
>> --- a/gcc/defaults.h
>> +++ b/gcc/defaults.h
>> @@ -513,18 +513,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
>> #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
>> #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)
>> -#endif
>> -
>> #ifndef DECIMAL32_TYPE_SIZE
>> #define DECIMAL32_TYPE_SIZE 32
>> #endif
>> diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
>> index aa10b5235b5..d85b6dcbf1a 100644
>> --- a/gcc/doc/rtl.texi
>> +++ b/gcc/doc/rtl.texi
>> @@ -1326,7 +1326,7 @@ whose size is @code{BITS_PER_WORD}, @code{SImode} on 32-bit machines.
>>
>> The only modes which a machine description @i{must} support are
>> @code{QImode}, and the modes corresponding to @code{BITS_PER_WORD},
>> -@code{FLOAT_TYPE_SIZE} and @code{DOUBLE_TYPE_SIZE}.
>> +C type @code{float} and C type type @code{double}.
>
> type type
Oops, thanks for catching, will fix it.
>
> OK with that fixed and no comments from others.
Thanks!
BR,
Kewen
next prev parent reply other threads:[~2024-06-03 9:37 UTC|newest]
Thread overview: 149+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 3:00 [PATCH 00/52] Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook Kewen Lin
2024-06-03 3:00 ` [PATCH 01/52] ada: Replace use of LONG_DOUBLE_TYPE_SIZE Kewen Lin
2024-06-03 8:51 ` Eric Botcazou
2024-06-05 9:32 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 02/52] d: " Kewen Lin
2024-06-03 8:40 ` Iain Buclaw
2024-06-03 8:57 ` Kewen.Lin
2024-06-03 14:39 ` Iain Buclaw
2024-06-04 3:17 ` [PATCH 02/52 v2] " Kewen.Lin
2024-06-04 11:35 ` Iain Buclaw
2024-06-05 9:32 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 03/52] fortran: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-03 20:01 ` [PATCH 03/52] fortran: Replace uses of {FLOAT, {, LONG_}DOUBLE}_TYPE_SIZE Harald Anlauf
2024-06-03 20:01 ` Harald Anlauf
2024-06-05 9:30 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 04/52] go: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-12 9:33 ` Kewen.Lin
2024-06-12 12:32 ` Ian Lance Taylor
2024-06-25 5:38 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 05/52] rust: " Kewen Lin
2024-06-12 9:35 ` PING^1 " Kewen.Lin
2024-06-21 1:48 ` PING^2 " Kewen.Lin
2024-06-21 10:17 ` Arthur Cohen
2024-06-21 10:36 ` Kewen.Lin
2024-06-25 5:42 ` Kewen.Lin
2024-06-25 10:14 ` Arthur Cohen
2024-06-03 3:00 ` [PATCH 06/52] m2: " Kewen Lin
2024-06-03 12:42 ` Gaius Mulley
2024-06-03 18:02 ` Joseph Myers
2024-06-04 3:19 ` Kewen.Lin
2024-06-05 14:22 ` Gaius Mulley
2024-06-06 5:15 ` Kewen.Lin
2024-06-06 18:31 ` Gaius Mulley
2024-06-12 9:31 ` Kewen.Lin
2024-06-15 5:00 ` Gaius Mulley
2024-06-17 6:07 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 07/52] darwin: Replace use of LONG_DOUBLE_TYPE_SIZE Kewen Lin
2024-06-04 6:21 ` Iain Sandoe
2024-06-05 9:29 ` Kewen.Lin
2024-06-03 3:00 ` [PATCH 08/52] vms: " Kewen Lin
2024-06-12 9:36 ` PING^1 " Kewen.Lin
2024-06-03 3:00 ` [PATCH 09/52] Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode_for_floating_type Kewen Lin
2024-06-03 6:49 ` Richard Biener
2024-06-03 9:36 ` Kewen.Lin [this message]
2024-06-03 17:59 ` [PATCH 09/52] Replace {FLOAT, {, LONG_}DOUBLE}_TYPE_SIZE " Joseph Myers
2024-06-04 3:27 ` [PATCH 09/52 v2] " Kewen.Lin
2024-06-25 5:20 ` Kewen.Lin
2024-06-03 3:01 ` [PATCH 10/52] jit: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-13 7:14 ` PING^1 " Kewen.Lin
2024-06-13 13:44 ` David Malcolm
2024-06-14 2:16 ` Kewen.Lin
2024-06-24 6:23 ` Kewen.Lin
2024-06-24 22:25 ` David Malcolm
2024-06-03 3:01 ` [PATCH 11/52] arc: Remove macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-13 7:14 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 12/52] bpf: " Kewen Lin
2024-06-13 7:15 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 13/52] epiphany: " Kewen Lin
2024-06-13 7:15 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 14/52] fr30: " Kewen Lin
2024-06-03 11:43 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 15/52] frv: " Kewen Lin
2024-06-03 13:31 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 16/52] ft32: " Kewen Lin
2024-06-13 7:15 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 17/52] gcn: " Kewen Lin
2024-06-03 9:14 ` [PATCH 17/52] gcn: Remove macros {FLOAT, DOUBLE, LONG_DOUBLE}_TYPE_SIZE Andrew Stubbs
2024-06-03 9:41 ` Kewen.Lin
2024-06-03 9:57 ` Jakub Jelinek
2024-06-03 3:01 ` [PATCH 18/52] iq2000: Remove macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-03 13:32 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 19/52] lm32: " Kewen Lin
2024-06-13 7:15 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 20/52] m32c: " Kewen Lin
2024-06-03 13:33 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 21/52] m32r: " Kewen Lin
2024-06-03 13:33 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 22/52] microblaze: " Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-13 17:37 ` Michael Eager
2024-06-03 3:01 ` [PATCH 23/52] mmix: " Kewen Lin
2024-06-06 1:41 ` Hans-Peter Nilsson
2024-06-06 2:11 ` Kewen.Lin
2024-06-03 3:01 ` [PATCH 24/52] moxie: " Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 25/52] msp430: " Kewen Lin
2024-06-03 13:34 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 26/52] nds32: " Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 27/52] nios2: " Kewen Lin
2024-06-06 16:23 ` Sandra Loosemore
2024-06-03 3:01 ` [PATCH 28/52] nvptx: " Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 29/52] or1k: " Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-20 14:18 ` Stafford Horne
2024-06-03 3:01 ` [PATCH 30/52] pdp11: Remove macro LONG_DOUBLE_TYPE_SIZE Kewen Lin
2024-06-13 7:16 ` PING^1 " Kewen.Lin
2024-06-13 20:07 ` Paul Koning
2024-06-14 3:22 ` [PATCH 30/52 v2] pdp11: Remove macro {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE Kewen.Lin
2024-06-14 15:20 ` Paul Koning
2024-06-17 2:01 ` Kewen.Lin
2024-06-17 18:05 ` Paul Koning
2024-06-03 3:01 ` [PATCH 31/52] pru: Remove macros {FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-03 15:59 ` Dimitar Dimitrov
2024-06-03 3:01 ` [PATCH 32/52] stormy16: " Kewen Lin
2024-06-03 13:35 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 33/52] visium: " Kewen Lin
2024-06-13 7:17 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 34/52] xtensa: " Kewen Lin
2024-06-03 21:08 ` augustine.sterling
2024-06-03 3:01 ` [PATCH 35/52] rs6000: New hook implementation rs6000_c_mode_for_floating_type Kewen Lin
2024-06-03 3:01 ` [PATCH 36/52] aarch64: New hook implementation aarch64_c_mode_for_floating_type Kewen Lin
2024-06-03 10:32 ` Richard Sandiford
2024-06-03 3:01 ` [PATCH 37/52] alpha: New hook implementation alpha_c_mode_for_floating_type Kewen Lin
2024-06-13 7:42 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 38/52] avr: New hook implementation avr_c_mode_for_floating_type Kewen Lin
2024-06-13 7:42 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 39/52] i386: New hook implementation ix86_c_mode_for_floating_type Kewen Lin
2024-06-03 7:12 ` Uros Bizjak
2024-06-03 3:01 ` [PATCH 40/52] ia64: New hook implementation ia64_c_mode_for_floating_type Kewen Lin
2024-06-13 7:42 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 41/52] riscv: New hook implementation riscv_c_mode_for_floating_type Kewen Lin
2024-06-03 5:14 ` Kito Cheng
2024-06-03 3:01 ` [PATCH 42/52] rl78: New hook implementation rl78_c_mode_for_floating_type Kewen Lin
2024-06-13 7:42 ` PING^1 " Kewen.Lin
2024-06-13 7:46 ` Richard Biener
2024-06-03 3:01 ` [PATCH 43/52] rx: New hook implementation rx_c_mode_for_floating_type Kewen Lin
2024-06-03 13:36 ` Nick Clifton
2024-06-03 3:01 ` [PATCH 44/52] s390: New hook implementation s390_c_mode_for_floating_type Kewen Lin
2024-06-13 7:43 ` PING^1 " Kewen.Lin
2024-06-14 5:40 ` Andreas Krebbel
2024-06-03 3:01 ` [PATCH 45/52] sh: New hook implementation sh_c_mode_for_floating_type Kewen Lin
2024-06-03 3:16 ` Oleg Endo
2024-06-03 3:01 ` [PATCH 46/52] h8300: New hook implementation h8300_c_mode_for_floating_type Kewen Lin
2024-06-13 7:43 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 47/52] loongarch: New hook implementation loongarch_c_mode_for_floating_type Kewen Lin
2024-06-04 1:45 ` Lulu Cheng
2024-06-03 3:01 ` [PATCH 48/52] m68k: New hook implementation m68k_c_mode_for_floating_type Kewen Lin
2024-06-13 7:43 ` PING^1 " Kewen.Lin
2024-06-03 3:01 ` [PATCH 49/52] mips: New hook implementation mips_c_mode_for_floating_type Kewen Lin
2024-06-04 1:16 ` YunQiang Su
2024-06-03 3:01 ` [PATCH 50/52] pa: New hook implementation pa_c_mode_for_floating_type Kewen Lin
2024-06-04 18:55 ` John David Anglin
2024-06-03 3:01 ` [PATCH 51/52] sparc: New hook implementation sparc_c_mode_for_floating_type Kewen Lin
2024-06-03 9:02 ` Eric Botcazou
2024-06-03 9:37 ` Kewen.Lin
2024-06-03 3:01 ` [PATCH 52/52] bfin: Rename macros {FLOAT,DOUBLE}_TYPE_SIZE Kewen Lin
2024-06-13 7:43 ` PING^1 " Kewen.Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55406c9d-5c82-0b6e-e4ee-5dfec3b0b4ed@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=josmyers@redhat.com \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).