IBM Z: Change vector copysign to use bitwise operations
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 7 Oct 2020 14:51:21 +0000 (16:51 +0200)
committerIlya Leoshkevich <iii@linux.ibm.com>
Mon, 12 Oct 2020 10:18:53 +0000 (12:18 +0200)
commita1a10a0b8c4e161070f88de3af9d20f9f866a23f
tree2bdc90abfa45dffb4990e0adaa86750b9674305d
parentedafa96b8210227b0c6a2d539aa41ce529805441
IBM Z: Change vector copysign to use bitwise operations

The vector copysign pattern incorrectly assumes that vector
if_then_else operates on bits, not on elements.  This can theoretically
mislead the optimizers.  Fix by changing it to use bitwise operations,
like commit 2930bb321794 ("PR94613: Fix vec_sel builtin for IBM Z") did
for vec_sel builtin.

gcc/ChangeLog:

2020-10-07  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/s390-protos.h (s390_build_signbit_mask): New
function.
* config/s390/s390.c (s390_contiguous_bitmask_vector_p):
Bitcast the argument to an integral mode.
(s390_expand_vec_init): Do not call
s390_contiguous_bitmask_vector_p with a scalar argument.
(s390_build_signbit_mask): New function.
* config/s390/vector.md (copysign<mode>3): Use bitwise
operations.
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/vector.md