1# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass greedy -verify-machineinstrs -o - %s | FileCheck %s 2--- | 3 define i64 @test_subreg_spill_fold() { ret i64 0 } 4 define i64 @test_subreg_spill_fold2() { ret i64 0 } 5 define i64 @test_subreg_spill_fold3() { ret i64 0 } 6 define i64 @test_subreg_fill_fold() { ret i64 0 } 7 define double @test_subreg_fill_fold2() { ret double 0.0 } 8... 9--- 10# CHECK-LABEL: name: test_subreg_spill_fold 11# Ensure that the spilled subreg COPY is eliminated and folded into the spill store. 12name: test_subreg_spill_fold 13registers: 14 - { id: 0, class: gpr64 } 15body: | 16 bb.0: 17 ; CHECK: STRXui $xzr, %stack.0, 0 :: (store 8 into %stack.0) 18 undef %0.sub_32 = COPY $wzr 19 INLINEASM &nop, 1, 12, implicit-def dead $x0, 12, implicit-def dead $x1, 12, implicit-def dead $x2, 12, implicit-def dead $x3, 12, implicit-def dead $x4, 12, implicit-def dead $x5, 12, implicit-def dead $x6, 12, implicit-def dead $x7, 12, implicit-def dead $x8, 12, implicit-def dead $x9, 12, implicit-def dead $x10, 12, implicit-def dead $x11, 12, implicit-def dead $x12, 12, implicit-def dead $x13, 12, implicit-def dead $x14, 12, implicit-def dead $x15, 12, implicit-def dead $x16, 12, implicit-def dead $x17, 12, implicit-def dead $x18, 12, implicit-def dead $x19, 12, implicit-def dead $x20, 12, implicit-def dead $x21, 12, implicit-def dead $x22, 12, implicit-def dead $x23, 12, implicit-def dead $x24, 12, implicit-def dead $x25, 12, implicit-def dead $x26, 12, implicit-def dead $x27, 12, implicit-def dead $x28, 12, implicit-def dead $fp, 12, implicit-def dead $lr, 12, implicit-def $sp 20 $x0 = COPY %0 21 RET_ReallyLR implicit $x0 22... 23--- 24# CHECK-LABEL: name: test_subreg_spill_fold2 25# Similar to test_subreg_spill_fold, but with a %0 register class not containing %WZR. 26name: test_subreg_spill_fold2 27registers: 28 - { id: 0, class: gpr64sp } 29body: | 30 bb.0: 31 ; CHECK: STRXui $xzr, %stack.0, 0 :: (store 8 into %stack.0) 32 undef %0.sub_32 = COPY $wzr 33 INLINEASM &nop, 1, 12, implicit-def dead $x0, 12, implicit-def dead $x1, 12, implicit-def dead $x2, 12, implicit-def dead $x3, 12, implicit-def dead $x4, 12, implicit-def dead $x5, 12, implicit-def dead $x6, 12, implicit-def dead $x7, 12, implicit-def dead $x8, 12, implicit-def dead $x9, 12, implicit-def dead $x10, 12, implicit-def dead $x11, 12, implicit-def dead $x12, 12, implicit-def dead $x13, 12, implicit-def dead $x14, 12, implicit-def dead $x15, 12, implicit-def dead $x16, 12, implicit-def dead $x17, 12, implicit-def dead $x18, 12, implicit-def dead $x19, 12, implicit-def dead $x20, 12, implicit-def dead $x21, 12, implicit-def dead $x22, 12, implicit-def dead $x23, 12, implicit-def dead $x24, 12, implicit-def dead $x25, 12, implicit-def dead $x26, 12, implicit-def dead $x27, 12, implicit-def dead $x28, 12, implicit-def dead $fp, 12, implicit-def dead $lr, 12, implicit-def $sp 34 $x0 = ADDXri %0, 1, 0 35 RET_ReallyLR implicit $x0 36... 37--- 38# CHECK-LABEL: name: test_subreg_spill_fold3 39# Similar to test_subreg_spill_fold, but with a cross register class copy. 40name: test_subreg_spill_fold3 41registers: 42 - { id: 0, class: fpr64 } 43body: | 44 bb.0: 45 ; CHECK: STRXui $xzr, %stack.0, 0 :: (store 8 into %stack.0) 46 undef %0.ssub = COPY $wzr 47 INLINEASM &nop, 1, 12, implicit-def dead $d0, 12, implicit-def dead $d1, 12, implicit-def dead $d2, 12, implicit-def dead $d3, 12, implicit-def dead $d4, 12, implicit-def dead $d5, 12, implicit-def dead $d6, 12, implicit-def dead $d7, 12, implicit-def dead $d8, 12, implicit-def dead $d9, 12, implicit-def dead $d10, 12, implicit-def dead $d11, 12, implicit-def dead $d12, 12, implicit-def dead $d13, 12, implicit-def dead $d14, 12, implicit-def dead $d15, 12, implicit-def dead $d16, 12, implicit-def dead $d17, 12, implicit-def dead $d18, 12, implicit-def dead $d19, 12, implicit-def dead $d20, 12, implicit-def dead $d21, 12, implicit-def dead $d22, 12, implicit-def dead $d23, 12, implicit-def dead $d24, 12, implicit-def dead $d25, 12, implicit-def dead $d26, 12, implicit-def dead $d27, 12, implicit-def dead $d28, 12, implicit-def dead $d29, 12, implicit-def dead $d30, 12, implicit-def $d31 48 $x0 = COPY %0 49 RET_ReallyLR implicit $x0 50... 51--- 52# CHECK-LABEL: name: test_subreg_fill_fold 53# Ensure that the filled COPY is eliminated and folded into the fill load. 54name: test_subreg_fill_fold 55registers: 56 - { id: 0, class: gpr32 } 57 - { id: 1, class: gpr64 } 58body: | 59 bb.0: 60 %0 = COPY $wzr 61 INLINEASM &nop, 1, 12, implicit-def dead $x0, 12, implicit-def dead $x1, 12, implicit-def dead $x2, 12, implicit-def dead $x3, 12, implicit-def dead $x4, 12, implicit-def dead $x5, 12, implicit-def dead $x6, 12, implicit-def dead $x7, 12, implicit-def dead $x8, 12, implicit-def dead $x9, 12, implicit-def dead $x10, 12, implicit-def dead $x11, 12, implicit-def dead $x12, 12, implicit-def dead $x13, 12, implicit-def dead $x14, 12, implicit-def dead $x15, 12, implicit-def dead $x16, 12, implicit-def dead $x17, 12, implicit-def dead $x18, 12, implicit-def dead $x19, 12, implicit-def dead $x20, 12, implicit-def dead $x21, 12, implicit-def dead $x22, 12, implicit-def dead $x23, 12, implicit-def dead $x24, 12, implicit-def dead $x25, 12, implicit-def dead $x26, 12, implicit-def dead $x27, 12, implicit-def dead $x28, 12, implicit-def dead $fp, 12, implicit-def dead $lr, 12, implicit-def $sp 62 ; CHECK: undef %1.sub_32:gpr64 = LDRWui %stack.0, 0 :: (load 4 from %stack.0) 63 undef %1.sub_32 = COPY %0 64 $x0 = COPY %1 65 RET_ReallyLR implicit $x0 66... 67--- 68# CHECK-LABEL: name: test_subreg_fill_fold2 69# Similar to test_subreg_fill_fold, but with a cross-class copy. 70name: test_subreg_fill_fold2 71registers: 72 - { id: 0, class: gpr32 } 73 - { id: 1, class: fpr64 } 74body: | 75 bb.0: 76 %0 = COPY $wzr 77 INLINEASM &nop, 1, 12, implicit-def dead $x0, 12, implicit-def dead $x1, 12, implicit-def dead $x2, 12, implicit-def dead $x3, 12, implicit-def dead $x4, 12, implicit-def dead $x5, 12, implicit-def dead $x6, 12, implicit-def dead $x7, 12, implicit-def dead $x8, 12, implicit-def dead $x9, 12, implicit-def dead $x10, 12, implicit-def dead $x11, 12, implicit-def dead $x12, 12, implicit-def dead $x13, 12, implicit-def dead $x14, 12, implicit-def dead $x15, 12, implicit-def dead $x16, 12, implicit-def dead $x17, 12, implicit-def dead $x18, 12, implicit-def dead $x19, 12, implicit-def dead $x20, 12, implicit-def dead $x21, 12, implicit-def dead $x22, 12, implicit-def dead $x23, 12, implicit-def dead $x24, 12, implicit-def dead $x25, 12, implicit-def dead $x26, 12, implicit-def dead $x27, 12, implicit-def dead $x28, 12, implicit-def dead $fp, 12, implicit-def dead $lr, 12, implicit-def $sp 78 ; CHECK: undef %1.ssub:fpr64 = LDRSui %stack.0, 0 :: (load 4 from %stack.0) 79 undef %1.ssub = COPY %0 80 $d0 = COPY %1 81 RET_ReallyLR implicit $d0 82... 83