[llvm] [RISCV][GISel] Custom promote s32 G_ROTL/ROTR on RV64. (PR #115107)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 11:13:42 PST 2024


================
@@ -166,7 +166,9 @@ define signext i32 @rol_i32_neg_constant_rhs(i32 signext %a) nounwind {
 ;
 ; RV64ZBB-ZBKB-LABEL: rol_i32_neg_constant_rhs:
 ; RV64ZBB-ZBKB:       # %bb.0:
-; RV64ZBB-ZBKB-NEXT:    li a1, -2
+; RV64ZBB-ZBKB-NEXT:    li a1, 1
+; RV64ZBB-ZBKB-NEXT:    slli a1, a1, 32
----------------
topperc wrote:

This is because constant+any_ext is constant folded as a zero extend. TLI to check isSExtCheaperThanZExt is not available in the function that does the constant fold.

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


More information about the llvm-commits mailing list