[PATCH] D149731: [IR] New function llvm::createMinMaxSelectCmpOp for creating min/max operation in select-cmp form

Mel Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 02:17:16 PDT 2023


Mel-Chen added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:943
 
+Value *llvm::createMinMaxSelectCmpOp(IRBuilderBase &Builder, RecurKind RK,
+                                     Value *Left, Value *Right) {
----------------
xbolva00 wrote:
> We have intrinsics for min and max. Do not emit cmp select form..
I am aware that we can use intrinsic to represent min max operations, but this patch aims to preserve the ability to express min max operations in select-cmp form. This is necessary for the vectorization feature I am currently developing. It is important to emphasize that this patch does not enforce the use of select-cmp form for min max operations, but rather provides an additional option.


================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:952
   }
-  CmpInst::Predicate Pred = getMinMaxReductionPredicate(RK);
-  Value *Cmp = Builder.CreateCmp(Pred, Left, Right, "rdx.minmax.cmp");
----------------
xbolva00 wrote:
> Why we dont use intrinsic in all cases?
Refer to [[ https://reviews.llvm.org/D148221 | D148221 ]].
My understanding is that for fp min max there are still some FMF issues to be handled.
@RKSimon


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149731/new/

https://reviews.llvm.org/D149731



More information about the llvm-commits mailing list