[LLVMdev] Instruction pattern type inference problem
Chris Lattner
sabre at nondot.org
Mon Apr 23 15:08:55 PDT 2007
On Sun, 22 Apr 2007, Christopher Lamb wrote:
> 1. Is there a good reason that v2f32 types are excluded from the
> isFloatingPoint filter? Looks like a bug to me.
>
> v2f32 = 22, // 2 x f32
> v4f32 = 23, // 4 x f32 <== start ??
> v2f64 = 24, // 2 x f64 <== end
>
> static inline bool isFloatingPoint(ValueType VT) {
> return (VT >= f32 && VT <= f128) || (VT >= v4f32 && VT <= v2f64);
> }
Definitely a bug. I don't think any existing targets support v2f32 which
is probably why it wasn't noticed.
> 2. My problem seems to stem from what appears to be under-constrained
> typing of patterns. With vectors there is a challenge because
> currently there is no type constraint available to indicate that an
> operand can/cannot be a vector type, or a constraint that operands
> must have the same number of elements (either both scalers or vectors
> with the same number of elements, but not necessarily the same
> element type or element size).
>
> Even with these constraints, it would be difficult to apply them to
> the standard nodes in a general way, though I could be wrong. Should
> standard nodes have vector aware type constraints?
It depends on which nodes you mean. "and" for example, can apply to any
integer type, including vectors. The various compares can only apply to
scalars, as it would be otherwise ambiguous how the comparison is done
(i.e. is it true if all element satisfy the predicate, or if any of
them?)
Do you have a specific example in mind?
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list