This backport contains 1 patch from gcc main stream tree. The commit id of these patchs list as following in the order of time. 0001-widening_mul-restrict-ops-to-be-defined-in-the-same-.patch: d21dff5b4fee51ae432143065bededfc763dc344 diff -Nurp a/gcc/testsuite/gcc.dg/pr94269.c b/gcc/testsuite/gcc.dg/pr94269.c --- a/gcc/testsuite/gcc.dg/pr94269.c 1970-01-01 08:00:00.000000000 +0800 +++ b/gcc/testsuite/gcc.dg/pr94269.c 2020-04-17 17:04:50.608000000 +0800 @@ -0,0 +1,26 @@ +/* { dg-do compile { target aarch64*-*-* } } */ +/* { dg-options "-O2 -ftree-loop-vectorize -funsafe-math-optimizations -march=armv8.2-a+sve -msve-vector-bits=256" } */ + +float +foo(long n, float *x, int inc_x, + float *y, int inc_y) +{ + float dot = 0.0; + int ix = 0, iy = 0; + + if (n < 0) { + return dot; + } + + int i = 0; + while (i < n) { + dot += y[iy] * x[ix]; + ix += inc_x; + iy += inc_y; + i++; + } + + return dot; +} + +/* { dg-final { scan-assembler-not "smaddl" { target aarch64*-*-* } } } */ diff -Nurp a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c --- a/gcc/tree-ssa-math-opts.c 2020-04-17 16:43:59.540000000 +0800 +++ b/gcc/tree-ssa-math-opts.c 2020-04-17 16:48:34.072036000 +0800 @@ -2721,11 +2721,14 @@ convert_plusminus_to_widen (gimple_stmt_ multiply-and-accumulate instructions. If the widened-multiplication result has more than one uses, it is - probably wiser not to do the conversion. */ + probably wiser not to do the conversion. Also restrict this operation + to single basic block to avoid moving the multiply to a different block + with a higher execution frequency. */ if (code == PLUS_EXPR && (rhs1_code == MULT_EXPR || rhs1_code == WIDEN_MULT_EXPR)) { if (!has_single_use (rhs1) + || gimple_bb (rhs1_stmt) != gimple_bb (stmt) || !is_widening_mult_p (rhs1_stmt, &type1, &mult_rhs1, &type2, &mult_rhs2)) return false; @@ -2735,6 +2738,7 @@ convert_plusminus_to_widen (gimple_stmt_ else if (rhs2_code == MULT_EXPR || rhs2_code == WIDEN_MULT_EXPR) { if (!has_single_use (rhs2) + || gimple_bb (rhs2_stmt) != gimple_bb (stmt) || !is_widening_mult_p (rhs2_stmt, &type1, &mult_rhs1, &type2, &mult_rhs2)) return false; diff -Nurp a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_1.c b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_1.c --- a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_1.c 2020-03-31 09:51:36.000000000 +0800 +++ b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_1.c 2020-04-29 10:55:44.937471475 +0800 @@ -17,7 +17,6 @@ f (TYPE *x, TYPE *y, unsigned short n, l /* { dg-final { scan-assembler {\tstr\tw[0-9]+} } } */ /* Should multiply by (VF-1)*4 rather than (257-1)*4. */ /* { dg-final { scan-assembler-not {, 1024} } } */ -/* { dg-final { scan-assembler-not {\t.bfiz\t} } } */ /* { dg-final { scan-assembler-not {lsl[^\n]*[, ]10} } } */ /* { dg-final { scan-assembler-not {\tcmp\tx[0-9]+, 0} } } */ /* { dg-final { scan-assembler-not {\tcmp\tw[0-9]+, 0} } } */