From 7d23434bbe5fcf17afa0f57f7cbddf985c8425cb Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Tue, 4 Jan 2005 07:56:51 +0000 Subject: [PATCH] tree-vectorizer.c (vect_strip_conversions): New function. 2005-01-03 Ira Rosen * tree-vectorizer.c (vect_strip_conversions): New function. (vect_analyze_offset_expr): Call vect_strip_conversions. Add check for binary class. From-SVN: r92888 --- gcc/ChangeLog | 6 +++++ gcc/tree-vectorizer.c | 59 ++++++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9439885c26..51d5225ef6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-03 Ira Rosen + + * tree-vectorizer.c (vect_strip_conversions): New function. + (vect_analyze_offset_expr): Call vect_strip_conversions. Add + check for binary class. + 2005-01-03 Daniel Berlin Fix PR debug/17924 diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index bd826d0127c..d2333352df6 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -230,6 +230,7 @@ static tree vect_get_memtag_and_dr (tree, tree, bool, loop_vec_info, tree, struct data_reference **); static bool vect_analyze_offset_expr (tree, struct loop *, tree, tree *, tree *, tree *); +static tree vect_strip_conversion (tree); /* Utility functions for the code transformation. */ static tree vect_create_destination_var (tree, tree); @@ -1339,6 +1340,32 @@ vect_get_ptr_offset (tree ref ATTRIBUTE_UNUSED, } +/* Function vect_strip_conversions + + Strip conversions that don't narrow the mode. */ + +static tree +vect_strip_conversion (tree expr) +{ + tree to, ti, oprnd0; + + while (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR) + { + to = TREE_TYPE (expr); + oprnd0 = TREE_OPERAND (expr, 0); + ti = TREE_TYPE (oprnd0); + + if (!INTEGRAL_TYPE_P (to) || !INTEGRAL_TYPE_P (ti)) + return NULL_TREE; + if (GET_MODE_SIZE (TYPE_MODE (to)) < GET_MODE_SIZE (TYPE_MODE (ti))) + return NULL_TREE; + + expr = oprnd0; + } + return expr; +} + + /* Function vect_analyze_offset_expr Given an offset expression EXPR received from get_inner_reference, analyze @@ -1391,22 +1418,10 @@ vect_analyze_offset_expr (tree expr, tree init, evolution, def_stmt; /* Strip conversions that don't narrow the mode. */ - while (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR) - { - tree to, ti; - - to = TREE_TYPE (expr); - oprnd0 = TREE_OPERAND (expr, 0); - ti = TREE_TYPE (oprnd0); - - if (!INTEGRAL_TYPE_P (to) || !INTEGRAL_TYPE_P (ti)) - return false; - if (GET_MODE_SIZE (TYPE_MODE (to)) < GET_MODE_SIZE (TYPE_MODE (ti))) - return false; + expr = vect_strip_conversion (expr); + if (!expr) + return false; - expr = oprnd0; - } - *step = NULL_TREE; *misalign = NULL_TREE; *initial_offset = NULL_TREE; @@ -1463,6 +1478,16 @@ vect_analyze_offset_expr (tree expr, } /* Recursive computation. */ + if (!BINARY_CLASS_P (expr)) + { + /* We expect to get binary expressions (PLUS/MINUS and MULT). */ + if (vect_debug_details (NULL)) + { + fprintf (dump_file, "Not binary expression "); + print_generic_expr (dump_file, expr, TDF_SLIM); + } + return false; + } oprnd0 = TREE_OPERAND (expr, 0); oprnd1 = TREE_OPERAND (expr, 1); @@ -1483,6 +1508,10 @@ vect_analyze_offset_expr (tree expr, FORNOW: We don't support such cases. */ return false; + /* Strip conversions that don't narrow the mode. */ + left_offset = vect_strip_conversion (left_offset); + if (!left_offset) + return false; /* Misalignment computation. */ if (SSA_VAR_P (left_offset)) { -- 2.30.2