83 lines
3.4 KiB
Diff
83 lines
3.4 KiB
Diff
From 364cff1c26b9d1ef017e4bd2b080e1ca53f14694 Mon Sep 17 00:00:00 2001
|
|
From: Richard Sandiford <richard.sandiford@arm.com>
|
|
Date: Tue, 12 May 2020 09:01:12 +0100
|
|
Subject: [PATCH 09/26] tree-vect-generic: Tweak build_replicated_const
|
|
[PR94980 2/3]
|
|
|
|
This patch makes build_replicated_const take the number of bits
|
|
in VALUE rather than calculating the width from the element type.
|
|
The callers can then use vector_element_bits to calculate the
|
|
correct element size from the vector type.
|
|
|
|
2020-05-12 Richard Sandiford <richard.sandiford@arm.com>
|
|
|
|
gcc/
|
|
PR tree-optimization/94980
|
|
* tree-vect-generic.c (build_replicated_const): Take the number
|
|
of bits as a parameter, instead of the type of the elements.
|
|
(do_plus_minus): Update accordingly, using vector_element_bits
|
|
to calculate the correct number of bits.
|
|
(do_negate): Likewise.
|
|
|
|
Reference commit in GCC: 14605b6bd8c37fffd8065c5c3fe6b1b9d7b2a294
|
|
Signed-off-by: Pronin Alexander 00812787 <pronin.alexander@huawei.com>
|
|
---
|
|
gcc/tree-vect-generic.c | 15 ++++++++-------
|
|
1 file changed, 8 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
|
|
index 0ec4412bc..82fb0ae7c 100644
|
|
--- a/gcc/tree-vect-generic.c
|
|
+++ b/gcc/tree-vect-generic.c
|
|
@@ -67,11 +67,10 @@ subparts_gt (tree type1, tree type2)
|
|
}
|
|
|
|
/* Build a constant of type TYPE, made of VALUE's bits replicated
|
|
- every TYPE_SIZE (INNER_TYPE) bits to fit TYPE's precision. */
|
|
+ every WIDTH bits to fit TYPE's precision. */
|
|
static tree
|
|
-build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
|
|
+build_replicated_const (tree type, unsigned int width, HOST_WIDE_INT value)
|
|
{
|
|
- int width = tree_to_uhwi (TYPE_SIZE (inner_type));
|
|
int n = (TYPE_PRECISION (type) + HOST_BITS_PER_WIDE_INT - 1)
|
|
/ HOST_BITS_PER_WIDE_INT;
|
|
unsigned HOST_WIDE_INT low, mask;
|
|
@@ -214,13 +213,14 @@ do_plus_minus (gimple_stmt_iterator *gsi, tree word_type, tree a, tree b,
|
|
tree bitpos ATTRIBUTE_UNUSED, tree bitsize ATTRIBUTE_UNUSED,
|
|
enum tree_code code, tree type ATTRIBUTE_UNUSED)
|
|
{
|
|
+ unsigned int width = vector_element_bits (TREE_TYPE (a));
|
|
tree inner_type = TREE_TYPE (TREE_TYPE (a));
|
|
unsigned HOST_WIDE_INT max;
|
|
tree low_bits, high_bits, a_low, b_low, result_low, signs;
|
|
|
|
max = GET_MODE_MASK (TYPE_MODE (inner_type));
|
|
- low_bits = build_replicated_const (word_type, inner_type, max >> 1);
|
|
- high_bits = build_replicated_const (word_type, inner_type, max & ~(max >> 1));
|
|
+ low_bits = build_replicated_const (word_type, width, max >> 1);
|
|
+ high_bits = build_replicated_const (word_type, width, max & ~(max >> 1));
|
|
|
|
a = tree_vec_extract (gsi, word_type, a, bitsize, bitpos);
|
|
b = tree_vec_extract (gsi, word_type, b, bitsize, bitpos);
|
|
@@ -247,13 +247,14 @@ do_negate (gimple_stmt_iterator *gsi, tree word_type, tree b,
|
|
enum tree_code code ATTRIBUTE_UNUSED,
|
|
tree type ATTRIBUTE_UNUSED)
|
|
{
|
|
+ unsigned int width = vector_element_bits (TREE_TYPE (b));
|
|
tree inner_type = TREE_TYPE (TREE_TYPE (b));
|
|
HOST_WIDE_INT max;
|
|
tree low_bits, high_bits, b_low, result_low, signs;
|
|
|
|
max = GET_MODE_MASK (TYPE_MODE (inner_type));
|
|
- low_bits = build_replicated_const (word_type, inner_type, max >> 1);
|
|
- high_bits = build_replicated_const (word_type, inner_type, max & ~(max >> 1));
|
|
+ low_bits = build_replicated_const (word_type, width, max >> 1);
|
|
+ high_bits = build_replicated_const (word_type, width, max & ~(max >> 1));
|
|
|
|
b = tree_vec_extract (gsi, word_type, b, bitsize, bitpos);
|
|
|
|
--
|
|
2.27.0
|
|
|