[llvm] [BPF] Use mul for certain div/mod operations (PR #110712)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 12:23:22 PDT 2024


================
@@ -118,7 +118,9 @@ class BPFTargetLowering : public TargetLowering {
     return Op.size() >= 8 ? MVT::i64 : MVT::i32;
   }
 
-  bool isIntDivCheap(EVT VT, AttributeList Attr) const override { return true; }
+  bool isIntDivCheap(EVT VT, AttributeList Attr) const override {
+    return false;
----------------
4ast wrote:

> I think it's better to keep this "cheap" when cpuv4 is enabled. 

No. Integer div is the slowest operation in pretty much every cpu architecture.

https://github.com/llvm/llvm-project/pull/110712


More information about the llvm-commits mailing list