patch to fix constant math - 5th patch - the main rtl work
Kenneth Zadeck
zadeck@naturalbridge.com
Wed Feb 27 12:40:00 GMT 2013
This patch fixes the rtl level so that the constant math performed is
independent of the host compiler.
This patch improves the rtl level in two ways:
1) This patch unifies the way that constant math is preformed. Without
this patch, there are a large number of checks to see if a constant fit
in a one or two HOST_WIDE_INTs. In many cases, transformations were
not done or done differently depending on the results of the test.
Now, virtually all constant math at the rtl level use the wide-int class
and so there are no host dependent differences on how the math is
done. This means that TImode is now better supported on 64bit host
compiling to 64 bit targets.
2) This patch conditionally introduces a new rtl class, the WIDE_INT
that holds integer constants that do not fit into a CONST_INT. For
those targets that define TARGET_SUPPORTS_WIDE_INT, this removes the
punning of using CONST_DOUBLE to hold both floats and ints that are
larger than two HOST_WIDE_INTS. If the target defines this, then (at
least at the rtl level) TImode can be used without iceing or getting the
wrong answer on a 32 bit host and it makes it possible for the target to
use modes larger than TImode.
Note that we already have 2 public platforms that are beginning to make
use of modes larger than 128 bits. For instance, the x86-64 can now do
vector wide shifts which require 256 bit data types. It would be
unsurprising to see more vector wide operations in the future. This
patch fixes the rtl level so that GCC can support these operations.
This patch was heavily reviewed by Richard Sandiford before he resigned
as a reviewer. It was mostly just waiting on patch 4 to be accepted on
which it depends very heavily.
Ok to commit when stage1 opens?
kenny
On 10/31/2012 05:59 AM, Richard Sandiford wrote:
> Richard Biener <richard.guenther@gmail.com> writes:
>> On Tue, Oct 30, 2012 at 10:05 PM, Kenneth Zadeck
>> <zadeck@naturalbridge.com> wrote:
>>> jakub,
>>>
>>> i am hoping to get the rest of my wide integer conversion posted by nov 5.
>>> I am under some adverse conditions here: hurricane sandy hit her pretty
>>> badly. my house is hooked up to a small generator, and no one has any power
>>> for miles around.
>>>
>>> So far richi has promised to review them. he has sent some comments, but
>>> so far no reviews. Some time after i get the first round of them posted,
>>> i will do a second round that incorporates everyones comments.
>>>
>>> But i would like a little slack here if possible. While this work is a
>>> show stopper for my private port, the patches address serious problems for
>>> many of the public ports, especially ones that have very flexible vector
>>> units. I believe that there are significant set of latent problems
>>> currently with the existing ports that use ti mode that these patches will
>>> fix.
>>>
>>> However, i will do everything in my power to get the first round of the
>>> patches posted by nov 5 deadline.
>> I suppose you are not going to merge your private port for 4.8 and thus
>> the wide-int changes are not a show-stopper for you.
>>
>> That said, I considered the main conversion to be appropriate to be
>> defered for the next stage1. There is no advantage in disrupting the
>> tree more at this stage.
> I would like the wide_int class and rtl stuff to go in 4.8 though.
> IMO it's a significant improvement in its own right, and Kenny
> submitted it well before the deadline.
>
> Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p5-3.diff
Type: text/x-patch
Size: 135195 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20130227/91ca12eb/attachment.bin>
-------------- next part --------------
2013-2-26 Kenneth Zadeck <zadeck@naturalbridge.com>
* alias.c (rtx_equal_for_memref_p): Fixed comment.
* builtins.c (c_getstr, c_readstr, expand_builtin_signbit):
Make to work with any size int.
* combine.c (try_combine, subst): Changed to support any
size integer.
* coretypes.h (hwivec_def, hwivec, const_hwivec): New.
* cse.c (hash_rtx_cb): Added CONST_WIDE_INT case are
modified DOUBLE_INT case.
* cselib.c (rtx_equal_for_cselib_1): Converted cases to
CASE_CONST_UNIQUE.
(cselib_hash_rtx): Added CONST_WIDE_INT case.
* defaults.h (TARGET_SUPPORTS_WIDE_INT): New.
* doc/rtl.texi (CONST_DOUBLE, CONST_WIDE_INT): Updated.
* doc/tm.texi (TARGET_SUPPORTS_WIDE_INT): New.
* doc/tm.texi.in (TARGET_SUPPORTS_WIDE_INT): New.
* dojump.c (prefer_and_bit_test): Use wide int api.
* dwarf2out.c (get_full_len): New function.
(dw_val_equal_p, size_of_loc_descr,
output_loc_operands, print_die, attr_checksum, same_dw_val_p,
size_of_die, value_format, output_die, mem_loc_descriptor,
loc_descriptor, extract_int, add_const_value_attribute,
hash_loc_operands, compare_loc_operands): Add support for wide-ints.
(add_AT_wide): New function.
* dwarf2out.h (enum dw_val_class): Added dw_val_class_wide_int.
* emit-rtl.c (const_wide_int_htab): Add marking.
(const_wide_int_htab_hash, const_wide_int_htab_eq,
lookup_const_wide_int, immed_wide_int_const): New functions.
(const_double_htab_hash, const_double_htab_eq,
rtx_to_double_int, immed_double_const): Conditionally
changed CONST_DOUBLE behavior.
(immed_double_const, init_emit_once): Changed to support wide-int.
* explow.c (plus_constant): Now uses wide-int api.
* expmed.c (mask_rtx, lshift_value): Now uses wide-int.
(expand_mult, expand_smod_pow2): Make to work with any size int.
(make_tree): Added CONST_WIDE_INT case.
* expr.c (convert_modes): Added support for any size int.
(emit_group_load_1): Added todo for place that still does not
allow large ints.
(store_expr, expand_constructor): Fixed comments.
(expand_expr_real_2, expand_expr_real_1,
reduce_to_bit_field_precision, const_vector_from_tree):
Converted to use wide-int api.
* final.c (output_addr_const): Added CONST_WIDE_INT case.
* genemit.c (gen_exp): Added CONST_WIDE_INT case.
* gengenrtl.c (excluded_rtx): Added CONST_WIDE_INT case.
* gengtype.c (wide-int): New type.
* genpreds.c (write_one_predicate_function): Fixed comment.
(add_constraint): Added CONST_WIDE_INT test.
(write_tm_constrs_h): Do not emit hval or lval if target
supports wide integers.
* gensupport.c (std_preds): Added const_wide_int_operand and
const_scalar_int_operand.
* optabs.c (expand_subword_shift, expand_doubleword_shift,
expand_absneg_bit, expand_absneg_bit, expand_copysign_absneg,
expand_copysign_bit): Made to work with any size int.
* postreload.c (reload_cse_simplify_set): Now uses wide-int api.
* print-rtl.c (print_rtx): Added CONST_WIDE_INT case.
* read-rtl.c (validate_const_wide_int): New function.
(read_rtx_code): Added CONST_WIDE_INT case.
* recog.c (const_scalar_int_operand, const_double_operand):
New versions if target supports wide integers.
(const_wide_int_operand): New function.
* rtl.c (DEF_RTL_EXPR): Added CONST_WIDE_INT case.
(rtx_size): Ditto.
(rtx_alloc_stat, hwivec_output_hex, hwivec_check_failed_bounds):
New functions.
(iterative_hash_rtx): Added CONST_WIDE_INT case.
* rtl.def (CONST_WIDE_INT): New.
* rtl.h (hwivec_def): New function.
(HWI_GET_NUM_ELEM, HWI_PUT_NUM_ELEM, CONST_WIDE_INT_P,
CONST_SCALAR_INT_P, XHWIVEC_ELT, HWIVEC_CHECK, CONST_WIDE_INT_VEC,
CONST_WIDE_INT_NUNITS, CONST_WIDE_INT_ELT, rtx_alloc_v): New macros.
(chain_next): Added hwiv case.
(CASE_CONST_SCALAR_INT, CONST_INT, CONST_WIDE_INT): Added new
defs if target supports wide ints.
* rtlanal.c (commutative_operand_precedence, split_double):
Added CONST_WIDE_INT case.
* sched-vis.c (print_value): Added CONST_WIDE_INT case are
modified DOUBLE_INT case.
* sel-sched-ir.c (lhs_and_rhs_separable_p): Fixed comment
* simplify-rtx.c (mode_signbit_p,
simplify_const_unary_operation, simplify_binary_operation_1,
simplify_const_binary_operation,
simplify_const_relational_operation, simplify_immed_subreg):
Make work with any size int. .
* tree-ssa-address.c (addr_for_mem_ref): Changes to use
wide-int rather than double-int.
* tree.c (wide_int_to_tree): New function.
* var-tracking.c (loc_cmp): Added CONST_WIDE_INT case.
* varasm.c (const_rtx_hash_1): Added CONST_WIDE_INT case.
More information about the Gcc
mailing list