From: Jakub Jelinek Date: Tue, 30 May 2017 08:07:30 +0000 (+0200) Subject: backport: re PR rtl-optimization/79901 (ICE in prepare_cmp_insn, at optabs.c:3904) X-Git-Tag: releases/gcc-5.5.0~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dd17f6abf9045072858c958237031e002fcbefd;p=thirdparty%2Fgcc.git backport: re PR rtl-optimization/79901 (ICE in prepare_cmp_insn, at optabs.c:3904) Backported from mainline 2017-03-07 Jakub Jelinek PR rtl-optimization/79901 * expr.c (expand_expr_real_2): For vector MIN/MAX, if there is no min/max expander, expand it using expand_vec_cond_expr. From-SVN: r248654 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67739ea67bad..6eb34c77a833 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2017-05-30 Jakub Jelinek Backported from mainline + 2017-03-07 Jakub Jelinek + + PR rtl-optimization/79901 + * expr.c (expand_expr_real_2): For vector MIN/MAX, if there is no + min/max expander, expand it using expand_vec_cond_expr. + 2017-03-03 Jakub Jelinek PR target/79807 diff --git a/gcc/expr.c b/gcc/expr.c index e92d781e3949..164f9e9c26c7 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8852,6 +8852,18 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, if (temp != 0) return temp; + /* For vector MIN , expand it a VEC_COND_EXPR + and similarly for MAX . */ + if (VECTOR_TYPE_P (type)) + { + tree t0 = make_tree (type, op0); + tree t1 = make_tree (type, op1); + tree comparison = build2 (code == MIN_EXPR ? LE_EXPR : GE_EXPR, + type, t0, t1); + return expand_vec_cond_expr (type, comparison, t0, t1, + original_target); + } + /* At this point, a MEM target is no longer useful; we will get better code without it. */