[Bug target/88100] no warning reported when value for vec_splat_{su}{8,16} would overflow
helijia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 20 02:36:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88100
--- Comment #4 from Li Jia He <helijia at gcc dot gnu.org> ---
Author: helijia
Date: Wed Feb 20 02:35:39 2019
New Revision: 269033
URL: https://gcc.gnu.org/viewcvs?rev=269033&root=gcc&view=rev
Log:
[rs6000] fix PR 88100, range check for vec_splat_{su}{8,16,32}
GCC revision 259524 implemented range check for the vec_splat_{su}{8,16,32}
builtins. However, as a consequence of the implementation, the range check
is not done correctly for the expected vspltis[bhw] instructions. The result
is that we may not get a valid error message if the valid range of the data
is exceeded.
Although the input of the function prototype of vec_splat_{su}{8,16,32} is
const int, the actual data usage range is limited to the data range of 5 bits
signed. We should limit the int_cst.val[0] data to the 5 bit signed data range
without any modification in the input arg0 parameter. However, the sext_hwi
function intercepts the data of TREE_INT_CST_LOW (arg0) as size bits in the
sext_hwi (TREE_INT_CST_LOW (arg0), size) statement. This will cause some of
the excess data to fall within the range of 5 bits signed, so that the correct
diagnostic information cannot be generated, we need to remove the sext_hwi to
ensure that the input data has not been modified.
This patch fix range check for the vec_splat_s[8,16,32] builtins. The argument
must be a 5-bit const int as specified for the vspltis[bhw] instructions.
for gcc/ChangeLog
PR target/88100
* gcc/config/rs6000/rs6000.c (rs6000_gimple_fold_builtin)
<case ALTIVEC_BUILTIN_VSPLTISB, ALTIVEC_BUILTIN_VSPLTISH,
ALTIVEC_BUILTIN_VSPLTISW>: Don't convert the operand before
range checking it.
for gcc/testsuite/ChangeLog
PR target/88100
* gcc/testsuite/gcc.target/powerpc/pr88100.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.target/powerpc/pr88100.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-bugs
mailing list