[LLVMdev] max/min intrinsics

Redmond, Paul paul.redmond at intel.com
Wed Dec 5 08:26:40 PST 2012

I have been working on a patch to add support for max/min reductions in LoopVectorize. One of the comments that came up in review is that the implementation could be simplified (and less fragile) if max and min intrinsics were recognized rather than looking for compare-select sequences.

The suggestion was to change compare-selects into max and min intrinsic calls during instcombine.

The intrinsics to add are:
declare iN llvm.{smin,smax}.iN(iN %a, iN %b)
declare iN llvm.{umin,umax}.iN(iN %a, iN %b)
declare fN llvm.{fmin,fmax}.fN(fN %a, fN %b)

What does the community think?


More information about the llvm-dev mailing list