Use tree_vector_builder::new_binary_operation for folding
commitcb97ae984585b3f396197da7ccbbb05ccc56eec2
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Dec 2017 18:41:35 +0000 (7 18:41 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Dec 2017 18:41:35 +0000 (7 18:41 +0000)
treed1df9bee6f0c02966cfbd1044066b3e1bcea9f8e
parent6af4f299001b76e9902d2b6b6c7978d255d55d44
Use tree_vector_builder::new_binary_operation for folding

This patch makes fold-const.c operate directly on the VECTOR_CST
encoding when folding an operation that has two VECTOR_CST inputs.

2017-12-07  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* tree-vector-builder.h
(tree_vector_builder::new_binary_operation): Declare.
* tree-vector-builder.c
(tree_vector_builder::new_binary_operation): New function.
* fold-const.c (fold_relational_const): Use it.
(const_binop): Likewise.  Check that both input vectors have
the same number of elements, thus excluding things like WIDEN_SUM.
Check whether it is possible to operate directly on the encodings
of stepped inputs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255477 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/fold-const.c
gcc/tree-vector-builder.c
gcc/tree-vector-builder.h