On Sun, Jun 19, 2005 at 07:36:15PM +0300, Dorit Naishlos wrote:
> ... because at least for the vector-shift case I need to
> check that the shift operand is constant, and only then return
> optab_shri/shli.

This isn't true.  Just because the altivec patterns don't accept
anything other than a constant doesn't mean that the pattern can't
be valid for other operands.  The operation is completely specified
by its code.

Adding the operations to optab_for_tree_code is the right approach.

Ideally we'd also update tree-vect-generic to handle this new operation;
its behaviour with this code at present is actively wrong.  For the
moment we should add an assert

---
        compute_type = TREE_TYPE (type);
    }

+ gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
  rhs = expand_vector_operation (bsi, type, compute_type, rhs, code);
  if (lang_hooks.types_compatible_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
---

which should verify that we only generate this operation when we have
the expectation that the backend will handle it.


r~

Reply via email to