File: preselect-process-phis.mir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (215 lines) | stat: -rw-r--r-- 8,052 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -verify-machineinstrs -mtriple aarch64--- -run-pass=instruction-select -global-isel-abort=1 %s -o - | FileCheck %s
---
name:            test_loop_phi_fpr_to_gpr
alignment:       4
legalized:       true
regBankSelected: true
selected:        false
failedISel:      false
tracksRegLiveness: true
liveins:         []
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: test_loop_phi_fpr_to_gpr
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF1:%[0-9]+]]:gpr64common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 2143289344
  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:fpr32 = COPY [[MOVi32imm]]
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[DEF2:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[ANDSWri:%[0-9]+]]:gpr32 = ANDSWri [[DEF]], 0, implicit-def $nzcv
  ; CHECK-NEXT:   [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[DEF2]], [[DEF2]], 1, implicit $nzcv
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[PHI:%[0-9]+]]:gpr32 = PHI [[CSELWr]], %bb.1, %8, %bb.2
  ; CHECK-NEXT:   [[FCVTHSr:%[0-9]+]]:fpr16 = nofpexcept FCVTHSr [[COPY]]
  ; CHECK-NEXT:   [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, [[FCVTHSr]], %subreg.hsub
  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
  ; CHECK-NEXT:   STRHHui [[PHI]], [[DEF1]], 0 :: (store (s16) into `ptr undef`)
  ; CHECK-NEXT:   B %bb.2
  bb.0:
    successors: %bb.1(0x80000000)

    %0:gpr(s32) = G_IMPLICIT_DEF
    %4:gpr(p0) = G_IMPLICIT_DEF
    %8:fpr(s32) = G_FCONSTANT float 0x7FF8000000000000

  bb.1:
    successors: %bb.2(0x80000000)

    %6:gpr(s32) = G_IMPLICIT_DEF
    %7:gpr(s32) = G_SELECT %0(s32), %6, %6
    %1:gpr(s16) = G_TRUNC %7(s32)

  bb.2:
    successors: %bb.2(0x80000000)

    %3:gpr(s16) = G_PHI %1(s16), %bb.1, %5(s16), %bb.2
    %5:fpr(s16) = G_FPTRUNC %8(s32)
    G_STORE %3(s16), %4(p0) :: (store (s16) into `ptr undef`)
    G_BR %bb.2

...
---
name:            test_loop_phi_gpr_to_fpr
alignment:       4
legalized:       true
regBankSelected: true
selected:        false
failedISel:      false
tracksRegLiveness: true
liveins:         []
machineFunctionInfo: {}
body:             |
  ; CHECK-LABEL: name: test_loop_phi_gpr_to_fpr
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.1(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[DEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[DEF1:%[0-9]+]]:gpr64common = IMPLICIT_DEF
  ; CHECK-NEXT:   [[MOVi32imm:%[0-9]+]]:gpr32 = MOVi32imm 2143289344
  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:fpr32 = COPY [[MOVi32imm]]
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[DEF2:%[0-9]+]]:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[ANDSWri:%[0-9]+]]:gpr32 = ANDSWri [[DEF]], 0, implicit-def $nzcv
  ; CHECK-NEXT:   [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[DEF2]], [[DEF2]], 1, implicit $nzcv
  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:fpr32 = COPY [[CSELWr]]
  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:fpr16 = COPY [[COPY1]].hsub
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   [[PHI:%[0-9]+]]:fpr16 = PHI %7, %bb.2, [[COPY2]], %bb.1
  ; CHECK-NEXT:   [[FCVTHSr:%[0-9]+]]:fpr16 = nofpexcept FCVTHSr [[COPY]]
  ; CHECK-NEXT:   STRHui [[PHI]], [[DEF1]], 0 :: (store (s16) into `ptr undef`)
  ; CHECK-NEXT:   B %bb.2
  bb.0:
    successors: %bb.1(0x80000000)

    %0:gpr(s32) = G_IMPLICIT_DEF
    %4:gpr(p0) = G_IMPLICIT_DEF
    %8:fpr(s32) = G_FCONSTANT float 0x7FF8000000000000

  bb.1:
    successors: %bb.2(0x80000000)

    %6:gpr(s32) = G_IMPLICIT_DEF
    %7:gpr(s32) = G_SELECT %0(s32), %6, %6
    %1:gpr(s16) = G_TRUNC %7(s32)

  bb.2:
    successors: %bb.2(0x80000000)

    %3:fpr(s16) = G_PHI %5(s16), %bb.2, %1(s16), %bb.1
    %5:fpr(s16) = G_FPTRUNC %8(s32)
    G_STORE %3(s16), %4(p0) :: (store (s16) into `ptr undef`)
    G_BR %bb.2

...
---
name:            multiple_phis
alignment:       4
legalized:       true
regBankSelected: true
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: multiple_phis
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.1(0x40000000), %bb.5(0x40000000)
  ; CHECK-NEXT:   liveins: $w0, $w1, $x2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   %ptr:gpr64sp = COPY $x2
  ; CHECK-NEXT:   %cond_1:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   %gpr_1:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   [[COPY:%[0-9]+]]:fpr32 = COPY %gpr_1
  ; CHECK-NEXT:   [[COPY1:%[0-9]+]]:fpr16 = COPY [[COPY]].hsub
  ; CHECK-NEXT:   TBNZW %cond_1, 0, %bb.5
  ; CHECK-NEXT:   B %bb.1
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   %cond_2:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   TBNZW %cond_2, 0, %bb.3
  ; CHECK-NEXT:   B %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   %gpr_2:gpr32 = IMPLICIT_DEF
  ; CHECK-NEXT:   B %bb.4
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   successors: %bb.4(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   %fpr:fpr16 = IMPLICIT_DEF
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.4:
  ; CHECK-NEXT:   successors: %bb.5(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   %fp_phi:fpr16 = PHI %fpr, %bb.3, [[COPY1]], %bb.2
  ; CHECK-NEXT:   %gp_phi1:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
  ; CHECK-NEXT:   %gp_phi2:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
  ; CHECK-NEXT:   %gp_phi3:gpr32 = PHI %gpr_1, %bb.3, %gpr_2, %bb.2
  ; CHECK-NEXT:   [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, %fp_phi, %subreg.hsub
  ; CHECK-NEXT:   [[COPY2:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.5:
  ; CHECK-NEXT:   %use_fp_phi:gpr32 = PHI %gpr_1, %bb.0, [[COPY2]], %bb.4
  ; CHECK-NEXT:   %use_gp_phi1:gpr32 = PHI %gpr_1, %bb.0, %gp_phi1, %bb.4
  ; CHECK-NEXT:   %use_gp_phi2:gpr32 = PHI %gpr_1, %bb.0, %gp_phi2, %bb.4
  ; CHECK-NEXT:   %use_gp_phi3:gpr32 = PHI %gpr_1, %bb.0, %gp_phi3, %bb.4
  ; CHECK-NEXT:   STRHHui %use_fp_phi, %ptr, 0 :: (store (s16))
  ; CHECK-NEXT:   STRHHui %use_gp_phi1, %ptr, 0 :: (store (s16))
  ; CHECK-NEXT:   STRHHui %use_gp_phi2, %ptr, 0 :: (store (s16))
  ; CHECK-NEXT:   STRHHui %use_gp_phi3, %ptr, 0 :: (store (s16))
  ; CHECK-NEXT:   RET_ReallyLR

  ; The copy we insert in bb.4 should appear after all the phi instructions.

  bb.1:
    successors: %bb.2, %bb.6
    liveins: $w0, $w1, $x2
    %ptr:gpr(p0) = COPY $x2
    %cond_1:gpr(s32) = G_IMPLICIT_DEF
    %gpr_1:gpr(s16) = G_IMPLICIT_DEF
    G_BRCOND %cond_1(s32), %bb.6
    G_BR %bb.2
  bb.2:
    successors: %bb.3, %bb.4
    %cond_2:gpr(s32) = G_IMPLICIT_DEF
    G_BRCOND %cond_2(s32), %bb.4
    G_BR %bb.3
  bb.3:
    %gpr_2:gpr(s16) = G_IMPLICIT_DEF
    G_BR %bb.5
  bb.4:
    %fpr:fpr(s16) = G_IMPLICIT_DEF
  bb.5:
    %fp_phi:fpr(s16) = G_PHI %fpr(s16), %bb.4, %gpr_1(s16), %bb.3
    %gp_phi1:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
    %gp_phi2:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
    %gp_phi3:gpr(s16) = G_PHI %gpr_1(s16), %bb.4, %gpr_2(s16), %bb.3
  bb.6:
    %use_fp_phi:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %fp_phi(s16), %bb.5
    %use_gp_phi1:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi1(s16), %bb.5
    %use_gp_phi2:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi2(s16), %bb.5
    %use_gp_phi3:gpr(s16) = G_PHI %gpr_1(s16), %bb.1, %gp_phi3(s16), %bb.5
    G_STORE %use_fp_phi(s16), %ptr(p0) :: (store (s16))
    G_STORE %use_gp_phi1(s16), %ptr(p0) :: (store (s16))
    G_STORE %use_gp_phi2(s16), %ptr(p0) :: (store (s16))
    G_STORE %use_gp_phi3(s16), %ptr(p0) :: (store (s16))
    RET_ReallyLR
...