From 4317a2fa5139e7c4398e15213d73ad66e0f98c32 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 6 May 2008 08:41:08 -0700 Subject: [PATCH] re PR target/35657 (Alignments of DFP types aren't consistent) 2008-05-06 H.J. Lu PR target/35657 * config/i386/i386.c (contains_128bit_aligned_vector_p): Renamed to ... (contains_aligned_value_p): This. Handle _Decimal128. (ix86_function_arg_boundary): Only align _Decimal128 to its natural boundary and handle it properly. From-SVN: r134987 --- gcc/ChangeLog | 45 +++++++++++++++++++++++++----------------- gcc/config/i386/i386.c | 22 ++++++++++----------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cb1a41401a..70683471ad2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,23 +1,32 @@ +2008-05-06 H.J. Lu + + PR target/35657 + * config/i386/i386.c (contains_128bit_aligned_vector_p): Renamed + to ... + (contains_aligned_value_p): This. Handle _Decimal128. + (ix86_function_arg_boundary): Only align _Decimal128 to its + natural boundary and handle it properly. + 2008-05-06 Martin Jambor - * ipa-cp.c (ipcp_method_orig_node): Renamed to ipcp_get_orig_node. - (ipcp_method_is_cloned): Renamed to ipcp_node_is_clone - (ipcp_method_set_orig_node): Removed. - (ipcp_cval_get_cvalue_type): Removed. - (ipcp_method_get_scale): Renamed to ipcp_get_node_scale. - (ipcp_method_set_scale): Renamed to ipcp_set_node_scale. - (ipcp_cval_set_cvalue_type): Removed. - (ipcp_cval_get_cvalue): Removed. - (ipcp_cval_set_cvalue): Removed. - (ipcp_type_is_const): Renamed to ipcp_lat_is_const. - (ipcp_cval_equal_cvalues): Renamed to ipcp_lats_are_equal - (ipcp_lats_are_equal): Changed parameters to two ipcp_lattice's - (ipcp_cval_meet): Renamed to ipa_lattice_meet - (ipcp_cval_changed): Changed to use ipcp_lat_is_const - (ipcp_method_cval): Renamed to ipcp_get_ith_lattice - (ipcp_get_ith_lattice): Changed parameters. - (ipcp_cval_compute): Renamed to ipcp_lattice_from_jfunc - (ipcp_lattice_from_jfunc): Changed parameters. + * ipa-cp.c (ipcp_method_orig_node): Renamed to ipcp_get_orig_node. + (ipcp_method_is_cloned): Renamed to ipcp_node_is_clone + (ipcp_method_set_orig_node): Removed. + (ipcp_cval_get_cvalue_type): Removed. + (ipcp_method_get_scale): Renamed to ipcp_get_node_scale. + (ipcp_method_set_scale): Renamed to ipcp_set_node_scale. + (ipcp_cval_set_cvalue_type): Removed. + (ipcp_cval_get_cvalue): Removed. + (ipcp_cval_set_cvalue): Removed. + (ipcp_type_is_const): Renamed to ipcp_lat_is_const. + (ipcp_cval_equal_cvalues): Renamed to ipcp_lats_are_equal + (ipcp_lats_are_equal): Changed parameters to two ipcp_lattice's + (ipcp_cval_meet): Renamed to ipa_lattice_meet + (ipcp_cval_changed): Changed to use ipcp_lat_is_const + (ipcp_method_cval): Renamed to ipcp_get_ith_lattice + (ipcp_get_ith_lattice): Changed parameters. + (ipcp_cval_compute): Renamed to ipcp_lattice_from_jfunc + (ipcp_lattice_from_jfunc): Changed parameters. (ipcp_redirect): Local lattice pointer instead of lattice type variable. (ipcp_method_cval_print): Added temporary variable info. (ipcp_redirect): Removed already unused local variable caller. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a61bfb7f154..d0ebd80822e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4579,12 +4579,12 @@ ix86_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, } /* Return true when TYPE should be 128bit aligned for 32bit argument passing - ABI. Only called if TARGET_SSE. */ + ABI. */ static bool -contains_128bit_aligned_vector_p (tree type) +contains_aligned_value_p (tree type) { enum machine_mode mode = TYPE_MODE (type); - if (SSE_REG_MODE_P (mode) + if (((TARGET_SSE && SSE_REG_MODE_P (mode)) || mode == TDmode) && (!TYPE_USER_ALIGN (type) || TYPE_ALIGN (type) > 128)) return true; if (TYPE_ALIGN (type) < 128) @@ -4605,7 +4605,7 @@ contains_128bit_aligned_vector_p (tree type) for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { if (TREE_CODE (field) == FIELD_DECL - && contains_128bit_aligned_vector_p (TREE_TYPE (field))) + && contains_aligned_value_p (TREE_TYPE (field))) return true; } break; @@ -4613,7 +4613,7 @@ contains_128bit_aligned_vector_p (tree type) case ARRAY_TYPE: /* Just for use if some languages passes arrays by value. */ - if (contains_128bit_aligned_vector_p (TREE_TYPE (type))) + if (contains_aligned_value_p (TREE_TYPE (type))) return true; break; @@ -4637,8 +4637,8 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type) align = GET_MODE_ALIGNMENT (mode); if (align < PARM_BOUNDARY) align = PARM_BOUNDARY; - /* Decimal floating point is aligned to its natural boundary. */ - if (!TARGET_64BIT && !VALID_DFP_MODE_P (mode)) + /* In 32bit, only _Decimal128 is aligned to its natural boundary. */ + if (!TARGET_64BIT && mode != TDmode) { /* i386 ABI defines all arguments to be 4 byte aligned. We have to make an exception for SSE modes since these require 128bit @@ -4647,16 +4647,14 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type) The handling here differs from field_alignment. ICC aligns MMX arguments to 4 byte boundaries, while structure fields are aligned to 8 byte boundaries. */ - if (!TARGET_SSE) - align = PARM_BOUNDARY; - else if (!type) + if (!type) { - if (!SSE_REG_MODE_P (mode)) + if (!(TARGET_SSE && SSE_REG_MODE_P (mode)) && mode != TDmode) align = PARM_BOUNDARY; } else { - if (!contains_128bit_aligned_vector_p (type)) + if (!contains_aligned_value_p (type)) align = PARM_BOUNDARY; } } -- 2.30.2