diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2016-11-25 08:20:40 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2016-11-25 08:20:40 +0000 |
commit | 664e69688d7681be99aaa900ef193d3196e4b7d1 (patch) | |
tree | a7b23a5d0e95bc25c88e837668f6932f8b95681d /gcc/tree.c | |
parent | 84db1406e6d9b6d68bf45612348a8094b25e708b (diff) | |
download | gcc-664e69688d7681be99aaa900ef193d3196e4b7d1.zip gcc-664e69688d7681be99aaa900ef193d3196e4b7d1.tar.gz gcc-664e69688d7681be99aaa900ef193d3196e4b7d1.tar.bz2 |
Set mode of decimal floats before calling layout_type
Previously decimal floating-point types were created and laid
out as binary floating-point types, then the caller changed
the mode to a decimal mode later. The problem with that
approach is that not all targets support an equivalent binary
floating-point mode. When they didn't, we would give the
type BLKmode and lay it out as a zero-sized type.
This probably had no effect in practice. If a target doesn't
support a binary mode then it's unlikely to support the decimal
equivalent either. However, with the stricter mode checking
added by later patches, we would assert if a scalar floating-
point type didn't have a scalar floating-point mode.
gcc/
2016-11-16 Richard Sandiford <richard.sandiford@arm.com>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* stor-layout.c (layout_type): Allow the caller to set the mode of
a float type. Only choose one here if the mode is still VOIDmode.
* tree.c (build_common_tree_nodes): Set the type mode of decimal
floats before calling layout_type.
* config/rs6000/rs6000.c (rs6000_init_builtins): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r242862
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -10436,20 +10436,20 @@ build_common_tree_nodes (bool signed_char) /* Decimal float types. */ dfloat32_type_node = make_node (REAL_TYPE); TYPE_PRECISION (dfloat32_type_node) = DECIMAL32_TYPE_SIZE; - layout_type (dfloat32_type_node); SET_TYPE_MODE (dfloat32_type_node, SDmode); + layout_type (dfloat32_type_node); dfloat32_ptr_type_node = build_pointer_type (dfloat32_type_node); dfloat64_type_node = make_node (REAL_TYPE); TYPE_PRECISION (dfloat64_type_node) = DECIMAL64_TYPE_SIZE; - layout_type (dfloat64_type_node); SET_TYPE_MODE (dfloat64_type_node, DDmode); + layout_type (dfloat64_type_node); dfloat64_ptr_type_node = build_pointer_type (dfloat64_type_node); dfloat128_type_node = make_node (REAL_TYPE); TYPE_PRECISION (dfloat128_type_node) = DECIMAL128_TYPE_SIZE; - layout_type (dfloat128_type_node); SET_TYPE_MODE (dfloat128_type_node, TDmode); + layout_type (dfloat128_type_node); dfloat128_ptr_type_node = build_pointer_type (dfloat128_type_node); complex_integer_type_node = build_complex_type (integer_type_node, true); |