1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -verify-machineinstrs -mtriple aarch64--- -run-pass=instruction-select -global-isel %s -o - | FileCheck %s
4 name: test_loop_phi_fpr_to_gpr
10 tracksRegLiveness: true
12 machineFunctionInfo: {}
14 ; CHECK-LABEL: name: test_loop_phi_fpr_to_gpr
16 ; CHECK: successors: %bb.1(0x80000000)
17 ; CHECK: [[DEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
18 ; CHECK: [[DEF1:%[0-9]+]]:gpr64common = IMPLICIT_DEF
19 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 2143289344
20 ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY [[MOVi32imm]]
22 ; CHECK: successors: %bb.2(0x80000000)
23 ; CHECK: [[DEF2:%[0-9]+]]:gpr32 = IMPLICIT_DEF
24 ; CHECK: [[ANDSWri:%[0-9]+]]:gpr32 = ANDSWri [[DEF]], 0, implicit-def $nzcv
25 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[DEF2]], [[DEF2]], 1, implicit $nzcv
27 ; CHECK: successors: %bb.2(0x80000000)
28 ; CHECK: [[PHI:%[0-9]+]]:gpr32 = PHI [[CSELWr]], %bb.1, %8, %bb.2
29 ; CHECK: [[FCVTHSr:%[0-9]+]]:fpr16 = FCVTHSr [[COPY]]
30 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, [[FCVTHSr]], %subreg.hsub
31 ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
32 ; CHECK: STRHHui [[PHI]], [[DEF1]], 0 :: (store (s16) into `half* undef`)
35 successors: %bb.1(0x80000000)
37 %0:gpr(s1) = G_IMPLICIT_DEF
38 %4:gpr(p0) = G_IMPLICIT_DEF
39 %8:fpr(s32) = G_FCONSTANT float 0x7FF8000000000000
42 successors: %bb.2(0x80000000)
44 %6:gpr(s32) = G_IMPLICIT_DEF
45 %7:gpr(s32) = G_SELECT %0(s1), %6, %6
46 %1:gpr(s16) = G_TRUNC %7(s32)
49 successors: %bb.2(0x80000000)
51 %3:gpr(s16) = G_PHI %1(s16), %bb.1, %5(s16), %bb.2
52 %5:fpr(s16) = G_FPTRUNC %8(s32)
53 G_STORE %3(s16), %4(p0) :: (store (s16) into `half* undef`)
58 name: test_loop_phi_gpr_to_fpr
64 tracksRegLiveness: true
66 machineFunctionInfo: {}
68 ; CHECK-LABEL: name: test_loop_phi_gpr_to_fpr
70 ; CHECK: successors: %bb.1(0x80000000)
71 ; CHECK: [[DEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
72 ; CHECK: [[DEF1:%[0-9]+]]:gpr64common = IMPLICIT_DEF
73 ; CHECK: [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 2143289344
74 ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY [[MOVi32imm]]
76 ; CHECK: successors: %bb.2(0x80000000)
77 ; CHECK: [[DEF2:%[0-9]+]]:gpr32 = IMPLICIT_DEF
78 ; CHECK: [[ANDSWri:%[0-9]+]]:gpr32 = ANDSWri [[DEF]], 0, implicit-def $nzcv
79 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[DEF2]], [[DEF2]], 1, implicit $nzcv
80 ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY [[CSELWr]]
81 ; CHECK: [[COPY2:%[0-9]+]]:fpr16 = COPY [[COPY1]].hsub
83 ; CHECK: successors: %bb.2(0x80000000)
84 ; CHECK: [[PHI:%[0-9]+]]:fpr16 = PHI %7, %bb.2, [[COPY2]], %bb.1
85 ; CHECK: [[FCVTHSr:%[0-9]+]]:fpr16 = FCVTHSr [[COPY]]
86 ; CHECK: STRHui [[PHI]], [[DEF1]], 0 :: (store (s16) into `half* undef`)
89 successors: %bb.1(0x80000000)
91 %0:gpr(s1) = G_IMPLICIT_DEF
92 %4:gpr(p0) = G_IMPLICIT_DEF
93 %8:fpr(s32) = G_FCONSTANT float 0x7FF8000000000000
96 successors: %bb.2(0x80000000)
98 %6:gpr(s32) = G_IMPLICIT_DEF
99 %7:gpr(s32) = G_SELECT %0(s1), %6, %6
100 %1:gpr(s16) = G_TRUNC %7(s32)
103 successors: %bb.2(0x80000000)
105 %3:fpr(s16) = G_PHI %5(s16), %bb.2, %1(s16), %bb.1
106 %5:fpr(s16) = G_FPTRUNC %8(s32)
107 G_STORE %3(s16), %4(p0) :: (store (s16) into `half* undef`)
115 regBankSelected: true
116 tracksRegLiveness: true
119 ; The copy we insert in bb.4 should appear after all the phi instructions.
121 ; CHECK-LABEL: name: multiple_phis
123 ; CHECK: successors: %bb.1(0x40000000), %bb.5(0x40000000)
124 ; CHECK: liveins: $w0, $w1, $x2
125 ; CHECK: %ptr:gpr64sp = COPY $x2
126 ; CHECK: %cond_1:gpr32 = IMPLICIT_DEF
127 ; CHECK: %gpr_1:gpr32 = IMPLICIT_DEF
128 ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY %gpr_1
129 ; CHECK: [[COPY1:%[0-9]+]]:fpr16 = COPY [[COPY]].hsub
130 ; CHECK: TBNZW %cond_1, 0, %bb.5
133 ; CHECK: successors: %bb.2(0x40000000), %bb.3(0x40000000)
134 ; CHECK: %cond_2:gpr32 = IMPLICIT_DEF
135 ; CHECK: TBNZW %cond_2, 0, %bb.3
138 ; CHECK: successors: %bb.4(0x80000000)
139 ; CHECK: %gpr_2:gpr32 = IMPLICIT_DEF
142 ; CHECK: successors: %bb.4(0x80000000)
143 ; CHECK: %fpr:fpr16 = IMPLICIT_DEF
145 ; CHECK: successors: %bb.5(0x80000000)
146 ; CHECK: %fp_phi:fpr16 = PHI %fpr, %bb.3, [[COPY1]], %bb.2
147 ; CHECK: %gp_phi1:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
148 ; CHECK: %gp_phi2:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
149 ; CHECK: %gp_phi3:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
150 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, %fp_phi, %subreg.hsub
151 ; CHECK: [[COPY2:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
153 ; CHECK: %use_fp_phi:gpr32 = PHI %gpr_1, %bb.0, [[COPY2]], %bb.4
154 ; CHECK: %use_gp_phi1:gpr32 = PHI %gpr_1, %bb.0, %gp_phi1, %bb.4
155 ; CHECK: %use_gp_phi2:gpr32 = PHI %gpr_1, %bb.0, %gp_phi2, %bb.4
156 ; CHECK: %use_gp_phi3:gpr32 = PHI %gpr_1, %bb.0, %gp_phi3, %bb.4
157 ; CHECK: STRHHui %use_fp_phi, %ptr, 0 :: (store (s16))
158 ; CHECK: STRHHui %use_gp_phi1, %ptr, 0 :: (store (s16))
159 ; CHECK: STRHHui %use_gp_phi2, %ptr, 0 :: (store (s16))
160 ; CHECK: STRHHui %use_gp_phi3, %ptr, 0 :: (store (s16))
161 ; CHECK: RET_ReallyLR
163 successors: %bb.2, %bb.6
164 liveins: $w0, $w1, $x2
165 %ptr:gpr(p0) = COPY $x2
166 %cond_1:gpr(s1) = G_IMPLICIT_DEF
167 %gpr_1:gpr(s16) = G_IMPLICIT_DEF
168 G_BRCOND %cond_1(s1), %bb.6
171 successors: %bb.3, %bb.4
172 %cond_2:gpr(s1) = G_IMPLICIT_DEF
173 G_BRCOND %cond_2(s1), %bb.4
176 %gpr_2:gpr(s16) = G_IMPLICIT_DEF
179 %fpr:fpr(s16) = G_IMPLICIT_DEF
181 %fp_phi:fpr(s16) = G_PHI %fpr(s16), %bb.4, %gpr_1(s16), %bb.3
182 %gp_phi1:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
183 %gp_phi2:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
184 %gp_phi3:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
186 %use_fp_phi:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %fp_phi(s16), %bb.5
187 %use_gp_phi1:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi1(s16), %bb.5
188 %use_gp_phi2:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi2(s16), %bb.5
189 %use_gp_phi3:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi3(s16), %bb.5
190 G_STORE %use_fp_phi(s16), %ptr(p0) :: (store (s16))
191 G_STORE %use_gp_phi1(s16), %ptr(p0) :: (store (s16))
192 G_STORE %use_gp_phi2(s16), %ptr(p0) :: (store (s16))
193 G_STORE %use_gp_phi3(s16), %ptr(p0) :: (store (s16))