Jakub Jelinek <jakub at gcc dot> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-04-10
                 CC|                            | at gmail dot com,
                   |                            |itsimbal at gcc dot,
                   |                            |jakub at gcc dot,
                   |                            |jkoval at gcc dot,
                   |                            |kyukhin at gcc dot
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot> ---
The builtins have different behavior from the C shifts on vectors, where shift
counts < 0 or >= element bitsize are just undefined.

What the i386 backend could do (and should do) is extend ix86_fold_builtin
and/or ix86_gimple_fold_builtin to optimize these builtins.

For the shifts in particular, if the shift count (treated as unsigned) is equal
to the element size or larger, return a zero vector, and if it is 0, return the
first operand, or if first argument is VECTOR_CST and second argument is
INTEGER_CST, compute it into VECTOR_CST.  Similarly for VECTOR_CST second
operand, handle the VECTOR_CST, VECTOR_CST operands, or when all elts of the
latter one are equal, or all are >= element size.  Many other MD builtins
should be folded too.

Reply via email to