Fix folding of vector mask EQ/NE expressions
commita90455f4475f9dcdba4fe14ef1ab70c726ae06ed
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jan 2018 17:57:17 +0000 (13 17:57 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jan 2018 17:57:17 +0000 (13 17:57 +0000)
treec7d81773fba7399e72265ef818081c1fb946baa9
parent599c8d3e6b63b359647f40cbfd53568655694f6d
Fix folding of vector mask EQ/NE expressions

fold_binary_loc assumed that if the type of the result wasn't a vector,
the operands wouldn't be either.  This isn't necessarily true for
EQ_EXPR and NE_EXPR of vector masks, which can return a single scalar
for the mask as a whole.

2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* fold-const.c (fold_binary_loc): Check the argument types
rather than the result type when testing for a vector operation.

gcc/testsuite/
* gcc.target/aarch64/sve/vec_bool_cmp_1.c: New test.
* gcc.target/aarch64/sve/vec_bool_cmp_1_run.c: Likweise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256616 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/vec_bool_cmp_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/vec_bool_cmp_1_run.c [new file with mode: 0644]