[llvm] 94f7600 - [AArch64] Add tests for merging LDRSWpre-LDR pairs

Zhuojia Shen via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 09:47:17 PDT 2023


Author: Zhuojia Shen
Date: 2023-07-18T09:46:46-07:00
New Revision: 94f76004d53d4c5fe98d9e5d0dc8292cc04218fa

URL: https://github.com/llvm/llvm-project/commit/94f76004d53d4c5fe98d9e5d0dc8292cc04218fa
DIFF: https://github.com/llvm/llvm-project/commit/94f76004d53d4c5fe98d9e5d0dc8292cc04218fa.diff

LOG: [AArch64] Add tests for merging LDRSWpre-LDR pairs

This patch adds MIR test cases that test merging an LDRSWpre-LDR
instruction pair into an LDPSWpre instruction.  This optimization is
currently missing and will be added a subsequent patch (D152407), so all
test cases are no merge for now.

Differential Revision: https://reviews.llvm.org/D152564

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir b/llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir
index 5662975150b302..c0d0d2b441be46 100644
--- a/llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir
+++ b/llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir
@@ -585,3 +585,193 @@ body:             |
     STRSui killed renamable $s1, renamable $x1, 1 :: (store (s32))
     RET undef $lr
 ...
+
+
+---
+name:            21-ldrswpre-ldrswui-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 21-ldrswpre-ldrswui-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
+    renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            22-ldrswpre-ldurswi-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 22-ldrswpre-ldurswi-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
+    renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            23-ldrswui-ldrswpre-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 23-ldrswui-ldrswpre-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            24-ldurswi-ldrswpre-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 24-ldurswi-ldrswpre-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    renamable $x2 = LDURSWi renamable $x1, 4 :: (load (s32))
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            25-ldrswpre-ldrswpre-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 25-ldrswpre-ldrswpre-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: early-clobber renamable $x1, dead renamable $x0 = LDRSWpre renamable $x1, 48, implicit $w1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, dead renamable $x2 = LDRSWpre renamable $x1, 1, implicit $w1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, dead renamable $x0 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, dead renamable $x2 = LDRSWpre renamable $x1, 12, implicit $w1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
+    ; CHECK: early-clobber renamable $x1, renamable $x2 = LDRSWpre renamable $x1, 16, implicit $w1 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 48 :: (load (s32))
+    early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 1 :: (load (s32))
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
+    early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 12 :: (load (s32))
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
+    early-clobber renamable $x1, renamable $x2 = LDRSWpre killed renamable $x1, 16 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            26-ldrswpre-ldrwui-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 26-ldrswpre-ldrwui-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: early-clobber renamable $x1, renamable $x0 = LDRSWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: renamable $w2 = LDRWui renamable $x1, 1, implicit-def $x2 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    early-clobber renamable $x1, renamable $x0 = LDRSWpre killed renamable $x1, 40 :: (load (s32))
+    renamable $w2 = LDRWui renamable $x1, 1 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...
+
+
+---
+name:            27-ldrwpre-ldrswui-no-merge
+tracksRegLiveness: true
+liveins:
+  - { reg: '$x0' }
+  - { reg: '$x1' }
+  - { reg: '$x2' }
+machineFunctionInfo:
+  hasRedZone:      false
+body:             |
+  bb.0:
+    liveins: $x0, $x1, $x2
+    ; CHECK-LABEL: name: 27-ldrwpre-ldrswui-no-merge
+    ; CHECK: liveins: $x0, $x1, $x2
+    ; CHECK: early-clobber renamable $x1, renamable $w0 = LDRWpre renamable $x1, 40, implicit $w1 :: (load (s32))
+    ; CHECK: renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    ; CHECK: STPXi renamable $x0, renamable $x2, renamable $x1, 0 :: (store (s64))
+    ; CHECK: RET undef $lr
+    early-clobber renamable $x1, renamable $w0 = LDRWpre killed renamable $x1, 40 :: (load (s32))
+    renamable $x2 = LDRSWui renamable $x1, 1 :: (load (s32))
+    STRXui killed renamable $x0, renamable $x1, 0 :: (store (s64))
+    STRXui killed renamable $x2, renamable $x1, 1 :: (store (s64))
+    RET undef $lr
+...


        


More information about the llvm-commits mailing list