[llvm] [Codegen][LegalizeIntegerTypes] Improve shift through stack (PR #96151)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 05:25:24 PDT 2024


================
@@ -159,59 +147,53 @@ define void @foo3(ptr %a, ptr readonly %b, ptr readonly %c) #0 {
 ; CHECK-LABEL: foo3:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    stwu 1, -64(1)
-; CHECK-NEXT:    stw 28, 48(1) # 4-byte Folded Spill
-; CHECK-NEXT:    li 8, 2048
 ; CHECK-NEXT:    stw 29, 52(1) # 4-byte Folded Spill
-; CHECK-NEXT:    li 6, 0
+; CHECK-NEXT:    li 7, 2048
 ; CHECK-NEXT:    stw 30, 56(1) # 4-byte Folded Spill
-; CHECK-NEXT:    li 7, 7
-; CHECK-NEXT:    mtctr 8
-; CHECK-NEXT:    addi 8, 1, 32
+; CHECK-NEXT:    li 6, 0
+; CHECK-NEXT:    mtctr 7
+; CHECK-NEXT:    addi 7, 1, 32
 ; CHECK-NEXT:  .LBB2_1: # %for.body
 ; CHECK-NEXT:    #
+; CHECK-NEXT:    lwz 8, 0(4)
+; CHECK-NEXT:    lwz 12, 12(5)
+; CHECK-NEXT:    lwz 9, 8(4)
 ; CHECK-NEXT:    lwz 10, 4(4)
-; CHECK-NEXT:    lwz 0, 12(5)
-; CHECK-NEXT:    lwz 9, 0(4)
-; CHECK-NEXT:    lwz 11, 8(4)
-; CHECK-NEXT:    lwz 12, 12(4)
-; CHECK-NEXT:    stw 10, 36(1)
-; CHECK-NEXT:    rlwinm 10, 0, 29, 28, 31
+; CHECK-NEXT:    lwz 11, 12(4)
+; CHECK-NEXT:    stw 8, 32(1)
+; CHECK-NEXT:    rlwinm 8, 12, 29, 28, 29
 ; CHECK-NEXT:    stw 6, 28(1)
-; CHECK-NEXT:    sub 10, 8, 10
-; CHECK-NEXT:    stw 6, 24(1)
+; CHECK-NEXT:    sub 8, 7, 8
 ; CHECK-NEXT:    stw 6, 20(1)
+; CHECK-NEXT:    stw 6, 24(1)
 ; CHECK-NEXT:    stw 6, 16(1)
-; CHECK-NEXT:    stw 12, 44(1)
-; CHECK-NEXT:    clrlwi 12, 0, 29
-; CHECK-NEXT:    stw 11, 40(1)
-; CHECK-NEXT:    subfic 29, 12, 32
-; CHECK-NEXT:    stw 9, 32(1)
-; CHECK-NEXT:    nand 9, 0, 7
-; CHECK-NEXT:    lwz 11, 4(10)
-; CHECK-NEXT:    clrlwi 9, 9, 27
-; CHECK-NEXT:    lwz 0, 8(10)
-; CHECK-NEXT:    lwz 30, 0(10)
-; CHECK-NEXT:    lwz 10, 12(10)
-; CHECK-NEXT:    srw 28, 0, 12
-; CHECK-NEXT:    slw 0, 0, 29
-; CHECK-NEXT:    slw 29, 30, 29
-; CHECK-NEXT:    srw 10, 10, 12
-; CHECK-NEXT:    srw 30, 30, 12
-; CHECK-NEXT:    srw 12, 11, 12
-; CHECK-NEXT:    slwi 11, 11, 1
-; CHECK-NEXT:    slw 9, 11, 9
-; CHECK-NEXT:    or 10, 0, 10
-; CHECK-NEXT:    stw 10, 12(3)
-; CHECK-NEXT:    or 10, 29, 12
-; CHECK-NEXT:    or 9, 28, 9
-; CHECK-NEXT:    stw 30, 0(3)
-; CHECK-NEXT:    stw 10, 4(3)
-; CHECK-NEXT:    stw 9, 8(3)
+; CHECK-NEXT:    stw 11, 44(1)
+; CHECK-NEXT:    clrlwi 11, 12, 27
+; CHECK-NEXT:    stw 10, 36(1)
+; CHECK-NEXT:    subfic 0, 11, 32
----------------
arsenm wrote:

I think this is better 

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


More information about the llvm-commits mailing list