1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
2 # RUN: llc -mtriple=x86_64-pc-linux-gnu -verify-coalescing -run-pass=register-coalescer -o - %s | FileCheck %s
4 # The %1 = MOV32r0 is rematerialized as a subregister of %2. The
5 # implicit-def %1 operand needs to have an undef added, just like the
9 name: remat_into_subregister_set_undef_implicit_operand_subregisters
10 tracksRegLiveness: true
12 ; CHECK-LABEL: name: remat_into_subregister_set_undef_implicit_operand_subregisters
14 ; CHECK-NEXT: successors: %bb.1(0x80000000)
15 ; CHECK-NEXT: liveins: $rdi
17 ; CHECK-NEXT: undef [[MOV32r0_:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def [[MOV32r0_]]
18 ; CHECK-NEXT: [[MOV32r0_1:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags, implicit-def [[MOV32r0_1]]
19 ; CHECK-NEXT: undef [[MOV32r0_2:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def undef [[MOV32r0_2]].sub_32bit, implicit-def [[MOV32r0_2]]
22 ; CHECK-NEXT: successors: %bb.2(0x80000000)
24 ; CHECK-NEXT: [[MOV32r0_2:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = XOR32ri [[MOV32r0_2]].sub_32bit, 1, implicit-def dead $eflags
27 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.3(0x40000000)
29 ; CHECK-NEXT: JCC_1 %bb.4, 5, implicit killed undef $eflags
32 ; CHECK-NEXT: successors: %bb.4(0x80000000)
36 ; CHECK-NEXT: successors: %bb.1(0x80000000)
38 ; CHECK-NEXT: dead [[MOV32rr:%[0-9]+]]:gr32 = MOV32rr [[MOV32r0_1]]
39 ; CHECK-NEXT: dead [[SHL64ri:%[0-9]+]]:gr64_nosp = SHL64ri [[MOV32r0_]], 4, implicit-def dead $eflags
40 ; CHECK-NEXT: [[MOV32r0_1:%[0-9]+]]:gr32 = COPY [[MOV32r0_2]].sub_32bit
41 ; CHECK-NEXT: JMP_1 %bb.1
45 undef %0.sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def %0
46 %1:gr32 = MOV32r0 implicit-def dead $eflags, implicit-def %1
47 undef %2.sub_32bit:gr64_with_sub_8bit = COPY %1, implicit-def %2
50 %2.sub_32bit:gr64_with_sub_8bit = XOR32ri %2.sub_32bit, 1, implicit-def dead $eflags
53 JCC_1 %bb.4, 5, implicit killed undef $eflags
58 dead %3:gr32 = MOV32rr %1
59 dead %4:gr64_nosp = SHL64ri %0, 4, implicit-def dead $eflags
60 %1:gr32 = COPY %2.sub_32bit
65 # Same, except the implicit-def on the original instruction already
66 # has a subregister index.
69 name: remat_into_subregister_set_undef_implicit_operand_subregisters_with_subreg
70 tracksRegLiveness: true
72 ; CHECK-LABEL: name: remat_into_subregister_set_undef_implicit_operand_subregisters_with_subreg
74 ; CHECK-NEXT: successors: %bb.1(0x80000000)
75 ; CHECK-NEXT: liveins: $rdi
77 ; CHECK-NEXT: undef [[MOV32r0_:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def [[MOV32r0_]]
78 ; CHECK-NEXT: [[MOV32r0_1:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags, implicit-def undef [[MOV32r0_1]].sub_8bit
79 ; CHECK-NEXT: undef [[MOV32r0_2:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def undef [[MOV32r0_2]].sub_8bit, implicit-def [[MOV32r0_2]]
82 ; CHECK-NEXT: successors: %bb.2(0x80000000)
84 ; CHECK-NEXT: [[MOV32r0_2:%[0-9]+]].sub_32bit:gr64_with_sub_8bit = XOR32ri [[MOV32r0_2]].sub_32bit, 1, implicit-def dead $eflags
87 ; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.3(0x40000000)
89 ; CHECK-NEXT: JCC_1 %bb.4, 5, implicit killed undef $eflags
92 ; CHECK-NEXT: successors: %bb.4(0x80000000)
96 ; CHECK-NEXT: successors: %bb.1(0x80000000)
98 ; CHECK-NEXT: dead [[MOV32rr:%[0-9]+]]:gr32 = MOV32rr [[MOV32r0_1]]
99 ; CHECK-NEXT: dead [[SHL64ri:%[0-9]+]]:gr64_nosp = SHL64ri [[MOV32r0_]], 4, implicit-def dead $eflags
100 ; CHECK-NEXT: [[MOV32r0_1:%[0-9]+]]:gr32 = COPY [[MOV32r0_2]].sub_32bit
101 ; CHECK-NEXT: JMP_1 %bb.1
105 undef %0.sub_32bit:gr64_with_sub_8bit = MOV32r0 implicit-def dead $eflags, implicit-def %0
106 %1:gr32 = MOV32r0 implicit-def dead $eflags, undef implicit-def %1.sub_8bit
107 undef %2.sub_32bit:gr64_with_sub_8bit = COPY %1, implicit-def %2
110 %2.sub_32bit:gr64_with_sub_8bit = XOR32ri %2.sub_32bit, 1, implicit-def dead $eflags
113 JCC_1 %bb.4, 5, implicit killed undef $eflags
118 dead %3:gr32 = MOV32rr %1
119 dead %4:gr64_nosp = SHL64ri %0, 4, implicit-def dead $eflags
120 %1:gr32 = COPY %2.sub_32bit