From 466183763cd52169d326f0c3a651e8e46adc8b73 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 12 Nov 2019 09:22:29 +0100 Subject: [PATCH] re PR target/92449 (ICE in extract_insn, at recog.c:2311) PR target/92449 * tree-complex.c (expand_complex_multiplication): If !HONOR_NANS, don't emit UNORDERED_EXPR guarded libcall. Formatting fixes. From-SVN: r278081 --- gcc/ChangeLog | 4 ++++ gcc/tree-complex.c | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39c9f6f4cff..b912abcb613 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-11-12 Jakub Jelinek + PR target/92449 + * tree-complex.c (expand_complex_multiplication): If !HONOR_NANS, + don't emit UNORDERED_EXPR guarded libcall. Formatting fixes. + PR tree-optimization/92452 * tree-vrp.c (vrp_prop::check_array_ref): If TRUNC_DIV_EXPR folds into NULL_TREE, set up_bound to NULL_TREE instead of computing diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index d4b053d68e1..804edd11e53 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -1144,6 +1144,16 @@ expand_complex_multiplication (gimple_stmt_iterator *gsi, tree type, return; } + if (!HONOR_NANS (inner_type)) + { + /* If we are not worrying about NaNs expand to + (ar*br - ai*bi) + i(ar*bi + br*ai) directly. */ + expand_complex_multiplication_components (gsi, inner_type, + ar, ai, br, bi, + &rr, &ri); + break; + } + /* Else, expand x = a * b into x = (ar*br - ai*bi) + i(ar*bi + br*ai); if (isunordered (__real__ x, __imag__ x)) @@ -1151,7 +1161,7 @@ expand_complex_multiplication (gimple_stmt_iterator *gsi, tree type, tree tmpr, tmpi; expand_complex_multiplication_components (gsi, inner_type, ar, ai, - br, bi, &tmpr, &tmpi); + br, bi, &tmpr, &tmpi); gimple *check = gimple_build_cond (UNORDERED_EXPR, tmpr, tmpi, @@ -1167,13 +1177,12 @@ expand_complex_multiplication (gimple_stmt_iterator *gsi, tree type, = insert_cond_bb (gsi_bb (*gsi), gsi_stmt (*gsi), check, profile_probability::very_unlikely ()); - gimple_stmt_iterator cond_bb_gsi = gsi_last_bb (cond_bb); gsi_insert_after (&cond_bb_gsi, gimple_build_nop (), GSI_NEW_STMT); tree libcall_res = expand_complex_libcall (&cond_bb_gsi, type, ar, ai, br, - bi, MULT_EXPR, false); + bi, MULT_EXPR, false); tree cond_real = gimplify_build1 (&cond_bb_gsi, REALPART_EXPR, inner_type, libcall_res); tree cond_imag = gimplify_build1 (&cond_bb_gsi, IMAGPART_EXPR, @@ -1190,20 +1199,18 @@ expand_complex_multiplication (gimple_stmt_iterator *gsi, tree type, edge orig_to_join = find_edge (orig_bb, join_bb); gphi *real_phi = create_phi_node (rr, gsi_bb (*gsi)); - add_phi_arg (real_phi, cond_real, cond_to_join, - UNKNOWN_LOCATION); + add_phi_arg (real_phi, cond_real, cond_to_join, UNKNOWN_LOCATION); add_phi_arg (real_phi, tmpr, orig_to_join, UNKNOWN_LOCATION); gphi *imag_phi = create_phi_node (ri, gsi_bb (*gsi)); - add_phi_arg (imag_phi, cond_imag, cond_to_join, - UNKNOWN_LOCATION); + add_phi_arg (imag_phi, cond_imag, cond_to_join, UNKNOWN_LOCATION); add_phi_arg (imag_phi, tmpi, orig_to_join, UNKNOWN_LOCATION); } else /* If we are not worrying about NaNs expand to (ar*br - ai*bi) + i(ar*bi + br*ai) directly. */ expand_complex_multiplication_components (gsi, inner_type, ar, ai, - br, bi, &rr, &ri); + br, bi, &rr, &ri); break; default: -- 2.30.2