1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=x86_64-- -run-pass=register-coalescer -o - %s | FileCheck %s
4 # Test the implicit operands and operand flags on remateralized
5 # instructions folding into a sub or super register def.
7 # Test a full register def at %t1 rematerializing into a subregister
8 # use. The subregister dest operand should be dead, with an
9 # implicit-def of the full physical register.
12 name: rematerialize_super_register_into_subreg_def
13 tracksRegLiveness: true
15 ; CHECK-LABEL: name: rematerialize_super_register_into_subreg_def
17 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
19 ; CHECK-NEXT: %t3:gr64 = MOV64ri32 -11
20 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
21 ; CHECK-NEXT: JCC_1 %bb.2, 4, implicit killed $eflags
22 ; CHECK-NEXT: JMP_1 %bb.1
25 ; CHECK-NEXT: successors: %bb.1(0x80000000)
27 ; CHECK-NEXT: dead $rax = MOV64ri32 -11, implicit-def $eax
28 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
29 ; CHECK-NEXT: JCC_1 %bb.1, 4, implicit killed $eflags
30 ; CHECK-NEXT: RET 0, $eax
33 ; CHECK-NEXT: successors: %bb.3(0x80000000)
35 ; CHECK-NEXT: %t3:gr64 = ADD64ri8 %t3, 10, implicit-def $eflags
38 ; CHECK-NEXT: $rax = COPY %t3
39 ; CHECK-NEXT: RET 0, $rax
41 %t1:gr64 = MOV64ri32 -11
42 CMP64ri8 %t1, 1, implicit-def $eflags
43 JCC_1 %bb.2, 4, implicit killed $eflags
48 $eax = COPY %t2.sub_32bit
49 CMP64ri8 %t2, 1, implicit-def $eflags
50 JCC_1 %bb.1, 4, implicit killed $eflags
55 %t3:gr64 = ADD64ri8 %t3, 10, implicit-def $eflags
63 # Test an undef subregister def of %t1 rematerializing into a physical
66 name: rematerialize_subregister_into_superreg_def
67 tracksRegLiveness: true
69 ; CHECK-LABEL: name: rematerialize_subregister_into_superreg_def
71 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
73 ; CHECK-NEXT: undef %t3.sub_32bit:gr64_with_sub_8bit = MOV32ri -11
74 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
75 ; CHECK-NEXT: JCC_1 %bb.2, 4, implicit killed $eflags
76 ; CHECK-NEXT: JMP_1 %bb.1
79 ; CHECK-NEXT: successors: %bb.1(0x80000000)
81 ; CHECK-NEXT: dead $eax = MOV32ri -11, implicit-def $rax
82 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
83 ; CHECK-NEXT: JCC_1 %bb.1, 4, implicit killed $eflags
84 ; CHECK-NEXT: RET 0, $rax
87 ; CHECK-NEXT: successors: %bb.3(0x80000000)
89 ; CHECK-NEXT: %t3:gr64_with_sub_8bit = ADD64ri8 %t3, 10, implicit-def $eflags
92 ; CHECK-NEXT: $rax = COPY %t3
93 ; CHECK-NEXT: RET 0, $rax
95 undef %t1.sub_32bit:gr64_with_sub_8bit = MOV32ri -11
96 CMP64ri8 %t1, 1, implicit-def $eflags
97 JCC_1 %bb.2, 4, implicit killed $eflags
103 CMP64ri8 %t2, 1, implicit-def $eflags
104 JCC_1 %bb.1, 4, implicit killed $eflags
109 %t3:gr64 = ADD64ri8 %t3, 10, implicit-def $eflags
117 # Handle that rematerializing an instruction with an implicit def of a
118 # virtual super register into a physical register works.
120 name: rematerialize_subregister_into_superreg_def_with_impdef_physreg
121 tracksRegLiveness: true
123 ; CHECK-LABEL: name: rematerialize_subregister_into_superreg_def_with_impdef_physreg
125 ; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
127 ; CHECK-NEXT: undef %t3.sub_32bit:gr64_with_sub_8bit = MOV32ri -11, implicit-def %t3
128 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
129 ; CHECK-NEXT: JCC_1 %bb.2, 4, implicit killed $eflags
130 ; CHECK-NEXT: JMP_1 %bb.1
133 ; CHECK-NEXT: successors: %bb.1(0x80000000)
135 ; CHECK-NEXT: dead $eax = MOV32ri -11, implicit-def $rax
136 ; CHECK-NEXT: CMP64ri8 %t3, 1, implicit-def $eflags
137 ; CHECK-NEXT: JCC_1 %bb.1, 4, implicit killed $eflags
138 ; CHECK-NEXT: RET 0, $rax
141 ; CHECK-NEXT: successors: %bb.3(0x80000000)
143 ; CHECK-NEXT: %t3:gr64_with_sub_8bit = ADD64ri8 %t3, 10, implicit-def $eflags
146 ; CHECK-NEXT: $rax = COPY %t3
147 ; CHECK-NEXT: RET 0, $rax
149 undef %t1.sub_32bit:gr64_with_sub_8bit = MOV32ri -11, implicit-def %t1
150 CMP64ri8 %t1, 1, implicit-def $eflags
151 JCC_1 %bb.2, 4, implicit killed $eflags
157 CMP64ri8 %t2, 1, implicit-def $eflags
158 JCC_1 %bb.1, 4, implicit killed $eflags
163 %t3:gr64 = ADD64ri8 %t3, 10, implicit-def $eflags