On February 10, 2017 8:45:09 PM GMT+01:00, Jakub Jelinek <ja...@redhat.com> wrote: >Hi! > >UBSAN_*_OVERFLOW ifns on vector types prefer to just check in a loop >for overflow, but perform the vector arithmetics on vectors. The >advantage >is that the partial results don't have to be inserted one by one into >the >result vector. >This requires that there is an instruction to perform that. We were >checking that, except that I forgot that the vector type could have an >scalar integral mode (like TImode), at which point it actually would >perform >say TImode addition rather than V16QImode addition. > >Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok >for >trunk?
OK. Richard. >2017-02-10 Jakub Jelinek <ja...@redhat.com> > > PR middle-end/79454 > * internal-fn.c (expand_vector_ubsan_overflow): Use piece-wise > result computation whenever lhs doesn't have vector mode, not > just when it has BLKmode. > >--- gcc/internal-fn.c.jj 2017-02-09 14:55:34.000000000 +0100 >+++ gcc/internal-fn.c 2017-02-10 15:58:50.724312535 +0100 >@@ -1909,7 +1909,7 @@ expand_vector_ubsan_overflow (location_t > { > optab op; > lhsr = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); >- if (GET_MODE (lhsr) == BLKmode >+ if (!VECTOR_MODE_P (GET_MODE (lhsr)) > || (op = optab_for_tree_code (code, TREE_TYPE (arg0), > optab_default)) == unknown_optab > || (optab_handler (op, TYPE_MODE (TREE_TYPE (arg0))) > > Jakub