[PATCH] D143578: [VP] Add vp.powi and a pass for expanding vp.powi before DAG.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 11:58:38 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/ExpandPowi.cpp:82
+      ExpTy, Intrinsic::vp_and, {Exp, ConstantInt::get(ExpTy, 1), True, EVL});
+  // FIXME: Use vp.icmp.
+  Value *IsOdd = Builder.CreateICmpNE(And1, ConstantInt::get(ExpTy, 0));
----------------
fakepaper56 wrote:
> fakepaper56 wrote:
> > craig.topper wrote:
> > > What's preventing using vp.icmp?
> > It is only that I don't know how to construct vp.icmp/vp.fcmp instructions.
> I don't understand how make predicate to a pointer of `Value`.
Should be something like this code from IRBuilder with the assert removed.

```
  Value *getConstrainedFPPredicate(CmpInst::Predicate Predicate) {               
    assert(CmpInst::isFPPredicate(Predicate) &&                                  
           Predicate != CmpInst::FCMP_FALSE &&                                   
           Predicate != CmpInst::FCMP_TRUE &&                                    
           "Invalid constrained FP comparison predicate!");                      
                                                                                 
    StringRef PredicateStr = CmpInst::getPredicateName(Predicate);               
    auto *PredicateMDS = MDString::get(Context, PredicateStr);                   
                                                                                 
    return MetadataAsValue::get(Context, PredicateMDS);                          
  } 
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143578



More information about the llvm-commits mailing list