This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add a partial_integral_type_p helper function
- From: Jeff Law <law at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, gcc-patches at gcc dot gnu dot org, richard dot sandiford at linaro dot org
- Date: Mon, 4 Sep 2017 00:03:06 -0600
- Subject: Re: Add a partial_integral_type_p helper function
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AE0E2C058EAA
- References: <87inhlmgyj.fsf@linaro.org> <df176a9f-3ce7-9008-d4a2-2fc1ce0d86cc@gmail.com>
On 08/25/2017 10:48 AM, Martin Sebor wrote:
> On 08/18/2017 02:13 AM, Richard Sandiford wrote:
>> This patch adds a partial_integral_type_p function, to go along
>> with the full_integral_type_p added by the previous patch.
>>
>> Of the changes that didn't previously have an INTEGRAL_TYPE_P check:
>>
>> - the convert_to_integer_1 hunks are dominated by a case version
>> of INTEGRAL_TYPE_P.
>>
>> - the merge_ranges hunk is dominated by an ENUMERAL_TYPE case.
>>
>> - vectorizable_reduction has the comment:
>>
>> /* Do not try to vectorize bit-precision reductions. */
>>
>> and so I think was only concerned with integers.
>>
>> - vectorizable_assignment has the comment:
>>
>> /* We do not handle bit-precision changes. */
>>
>> and the later:
>>
>> /* But a conversion that does not change the bit-pattern is ok. */
>> && !((TYPE_PRECISION (TREE_TYPE (scalar_dest))
>> > TYPE_PRECISION (TREE_TYPE (op)))
>> && TYPE_UNSIGNED (TREE_TYPE (op)))
>>
>> would only make sense if OP is also an integral type.
>>
>> - vectorizable_shift is inherently restricted to integers.
>>
>> Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install?
>>
>> Richard
>>
>>
>> 2017-08-17 Richard Sandiford <richard.sandiford@linaro.org>
>> Alan Hayward <alan.hayward@arm.com>
>> David Sherwood <david.sherwood@arm.com>
>>
>> gcc/
>> * tree.h (partial_integral_type_p): New function.
>> * convert.c (convert_to_integer_1): Use it.
>> * expr.c (store_fieldexpand_expr_real_2, expand_expr_real_1):
>> Likewise.
>> * fold-const.c (merge_ranges): Likewise.
>> * tree-ssa-math-opts.c (convert_mult_to_fma): Likewise.
>> * tree-tailcall.c (process_assignment): Likewise.
>> * tree-vect-loop.c (vectorizable_reduction): Likewise.
>> * tree-vect-stmts.c (vectorizable_conversion): Likewise.
>> (vectorizable_assignment, vectorizable_shift): Likewise.
>>
>> Index: gcc/tree.h
>> ===================================================================
>> --- gcc/tree.h 2017-08-18 08:35:58.031690315 +0100
>> +++ gcc/tree.h 2017-08-18 08:36:07.208306339 +0100
>> @@ -5414,4 +5414,13 @@ full_integral_type_p (const_tree t)
>> return INTEGRAL_TYPE_P (t) && scalar_type_is_full_p (t);
>> }
>>
>> +/* Return true if T is an integral type that has fewer bits than
>> + its underlying mode. */
>
> May I suggest to rephrase that as "has fewer bits of precision
> than..." to make it clear what those bits refer to? Alternatively.
> "type whose precision is less than that of its underlying mode."
Can't hurt to be a bit more precise for those who haven't had the
pleasure of dealing with partial modes.
Jeff