[llvm] [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (PR #107432)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 22:37:08 PDT 2024


================
@@ -1065,10 +1065,13 @@ def RDTIME_D : RDTIME_2R<0x00006800>;
 
 /// Generic pattern classes
 
+def sexti32 : ComplexPattern<i64, 1, "selectSExti32">;
+def zexti32 : ComplexPattern<i64, 1, "selectZExti32">;
+
 class PatGprGpr<SDPatternOperator OpNode, LAInst Inst>
     : Pat<(OpNode GPR:$rj, GPR:$rk), (Inst GPR:$rj, GPR:$rk)>;
 class PatGprGpr_32<SDPatternOperator OpNode, LAInst Inst>
-    : Pat<(sext_inreg (OpNode GPR:$rj, GPR:$rk), i32), (Inst GPR:$rj, GPR:$rk)>;
+    : Pat<(sext_inreg (OpNode (sexti32 GPR:$rj), (sexti32 GPR:$rk)), i32), (Inst GPR:$rj, GPR:$rk)>;
----------------
topperc wrote:

Here's the patch https://reviews.llvm.org/D57096 Maybe it wasn't a correctness fix, but it did use sexti32 on the operands before that change.

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


More information about the llvm-commits mailing list