1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-post-select-optimize -verify-machineinstrs %s -o - | FileCheck %s
4 name: test_fcmp_dead_cc
9 tracksRegLiveness: true
15 liveins: $w1, $x0, $s0, $s1
17 ; CHECK-LABEL: name: test_fcmp_dead_cc
18 ; CHECK: liveins: $w1, $x0, $s0, $s1
19 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
20 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
21 ; CHECK: [[COPY2:%[0-9]+]]:fpr32 = COPY $s0
22 ; CHECK: [[COPY3:%[0-9]+]]:fpr32 = COPY $s1
23 ; CHECK: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
24 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv
25 ; CHECK: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
26 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def $nzcv
27 ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr]], 1, 31
28 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
29 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
30 ; CHECK: $w0 = COPY [[CSELWr]]
31 ; CHECK: RET_ReallyLR implicit $w0
37 FCMPSrr %3, %4, implicit-def $nzcv
38 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
39 FCMPSrr %3, %4, implicit-def $nzcv
40 %14:gpr32common = UBFMWri %12, 1, 31
41 %60:gpr32 = MOVi32imm 1
42 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
44 RET_ReallyLR implicit $w0
48 name: test_fcmp_64_dead_cc
53 tracksRegLiveness: true
59 liveins: $w1, $x0, $d0, $d1
61 ; CHECK-LABEL: name: test_fcmp_64_dead_cc
62 ; CHECK: liveins: $w1, $x0, $d0, $d1
63 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
64 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
65 ; CHECK: [[COPY2:%[0-9]+]]:fpr64 = COPY $d0
66 ; CHECK: [[COPY3:%[0-9]+]]:fpr64 = COPY $d1
67 ; CHECK: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
68 ; CHECK: FCMPDrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv
69 ; CHECK: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
70 ; CHECK: FCMPDrr [[COPY2]], [[COPY3]], implicit-def $nzcv
71 ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr]], 1, 31
72 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
73 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
74 ; CHECK: $w0 = COPY [[CSELWr]]
75 ; CHECK: RET_ReallyLR implicit $w0
81 FCMPDrr %3, %4, implicit-def $nzcv
82 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
83 FCMPDrr %3, %4, implicit-def $nzcv
84 %14:gpr32common = UBFMWri %12, 1, 31
85 %60:gpr32 = MOVi32imm 1
86 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
88 RET_ReallyLR implicit $w0
92 name: test_fcmp_dead_cc_3_fcmps
97 tracksRegLiveness: true
103 liveins: $w1, $x0, $s0, $s1
105 ; CHECK-LABEL: name: test_fcmp_dead_cc_3_fcmps
106 ; CHECK: liveins: $w1, $x0, $s0, $s1
107 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
108 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
109 ; CHECK: [[COPY2:%[0-9]+]]:fpr32 = COPY $s0
110 ; CHECK: [[COPY3:%[0-9]+]]:fpr32 = COPY $s1
111 ; CHECK: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
112 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv
113 ; CHECK: [[SUBWrr:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
114 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def dead $nzcv
115 ; CHECK: [[SUBWrr1:%[0-9]+]]:gpr32 = SUBWrr [[COPY1]], [[COPY4]]
116 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def $nzcv
117 ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBWrr1]], 1, 31
118 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
119 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
120 ; CHECK: $w0 = COPY [[CSELWr]]
121 ; CHECK: RET_ReallyLR implicit $w0
126 %26:gpr32 = COPY $wzr
127 FCMPSrr %3, %4, implicit-def $nzcv
128 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
129 FCMPSrr %3, %4, implicit-def $nzcv
130 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
131 FCMPSrr %3, %4, implicit-def $nzcv
132 %14:gpr32common = UBFMWri %12, 1, 31
133 %60:gpr32 = MOVi32imm 1
134 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
136 RET_ReallyLR implicit $w0
140 name: test_impdef_made_dead
143 regBankSelected: true
145 tracksRegLiveness: true
151 liveins: $w1, $x0, $s0, $s1
152 ; Check that any dead imp-defs of NZCV are marked as such.
153 ; CHECK-LABEL: name: test_impdef_made_dead
154 ; CHECK: liveins: $w1, $x0, $s0, $s1
155 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
156 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
157 ; CHECK: [[COPY2:%[0-9]+]]:fpr32 = COPY $s0
158 ; CHECK: [[COPY3:%[0-9]+]]:fpr32 = COPY $s1
159 ; CHECK: [[COPY4:%[0-9]+]]:gpr32 = COPY $wzr
160 ; CHECK: [[SUBSWrr:%[0-9]+]]:gpr32 = SUBSWrr [[COPY1]], [[COPY4]], implicit-def dead $nzcv
161 ; CHECK: FCMPSrr [[COPY2]], [[COPY3]], implicit-def $nzcv
162 ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32common = UBFMWri [[SUBSWrr]], 1, 31
163 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 1
164 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[UBFMWri]], [[MOVi32imm]], 8, implicit $nzcv
165 ; CHECK: %ret:gpr32 = SUBSWrr [[CSELWr]], [[SUBSWrr]], implicit-def dead $nzcv
166 ; CHECK: $w0 = COPY [[CSELWr]]
167 ; CHECK: RET_ReallyLR implicit $w0
172 %26:gpr32 = COPY $wzr
173 %12:gpr32 = SUBSWrr %2, %26, implicit-def $nzcv
174 FCMPSrr %3, %4, implicit-def $nzcv
175 %14:gpr32common = UBFMWri %12, 1, 31
176 %60:gpr32 = MOVi32imm 1
177 %16:gpr32 = CSELWr %14, %60, 8, implicit $nzcv
178 %ret:gpr32 = SUBSWrr %16, %12, implicit-def $nzcv
180 RET_ReallyLR implicit $w0