]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Ensure vec_sld shift count in allowable range [PR109082]
authorKewen Lin <linkw@linux.ibm.com>
Mon, 27 Mar 2023 02:42:23 +0000 (21:42 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Mon, 27 Mar 2023 02:42:23 +0000 (21:42 -0500)
commitf33fc0775706e4db80d584c477608e28f4da0a6f
treeba46658dc9c57c168bc1f4103a04bbce494b63e7
parent50a36a9541526708881f2ac0c4f180506bcf80bb
rs6000: Ensure vec_sld shift count in allowable range [PR109082]

As PR109082 shows, some uses of vec_sld in emmintrin.h don't
strictly guarantee the given shift count is in the range
0-15 (inclusive).  This patch is to make the argument
range constraint honored for those uses.

PR target/109082

gcc/ChangeLog:

* config/rs6000/emmintrin.h (_mm_bslli_si128): Check __N is not less
than zero when calling vec_sld.
(_mm_bsrli_si128): Return __A if __N is zero, check __N is bigger than
zero when calling vec_sld.
(_mm_slli_si128): Return __A if _imm5 is zero, check _imm5 is bigger
than zero when calling vec_sld.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr109082.c: New test.
gcc/config/rs6000/emmintrin.h
gcc/testsuite/gcc.target/powerpc/pr109082.c [new file with mode: 0644]