[llvm] r237423 - Add SDNodes for umin, umax, smin and smax.

Matt Arsenault arsenm2 at gmail.com
Wed Jun 3 13:59:27 PDT 2015


> On May 15, 2015, at 2:03 AM, James Molloy <james.molloy at arm.com> wrote:
> 
> 
> -  for (unsigned i = 0; i != NumValues; ++i)
> +  // Min/max matching is only viable if all output VTs are the same.
> +  if (std::equal(ValueVTs.begin(), ValueVTs.end(), ValueVTs.begin())) {
> +    Value *LHS, *RHS;
> +    SelectPatternFlavor SPF = matchSelectPattern(const_cast<User*>(&I), LHS, RHS);
> +    ISD::NodeType Opc = ISD::DELETED_NODE;
> +    switch (SPF) {
> +    case SPF_UMAX: Opc = ISD::UMAX; break;
> +    case SPF_UMIN: Opc = ISD::UMIN; break;
> +    case SPF_SMAX: Opc = ISD::SMAX; break;
> +    case SPF_SMIN: Opc = ISD::SMIN; break;
> +    default: break;
> +    }
> +

Hi,

I’m trying to port R600’s target nodes to use this and hitting a problem from this. matchSelectPattern always matches, even if the condition has multiple uses. If you do something else to the condition besides the min/max, this increases the instruction count. What is the intended behavior / other uses of matchSelectPattern? Should it be rejecting cases with multiple condition uses, or should these cases be filtered out here in SelectionDAGBuilder?

-Matt



More information about the llvm-commits mailing list