1
2
3 package riscv64
4
5 import "internal/buildcfg"
6 import "math"
7 import "math/bits"
8 import "cmd/compile/internal/types"
9 import "cmd/compile/internal/ssa/block"
10 import "cmd/compile/internal/ssa/ssaop"
11 import "cmd/compile/internal/ssa"
12
13 func RewriteValue(v *ssa.Value) bool {
14 switch v.Op {
15 case ssaop.OpAbs:
16 v.Op = ssaop.OpRISCV64FABSD
17 return true
18 case ssaop.OpAdd16:
19 v.Op = ssaop.OpRISCV64ADD
20 return true
21 case ssaop.OpAdd32:
22 v.Op = ssaop.OpRISCV64ADD
23 return true
24 case ssaop.OpAdd32F:
25 v.Op = ssaop.OpRISCV64FADDS
26 return true
27 case ssaop.OpAdd64:
28 v.Op = ssaop.OpRISCV64ADD
29 return true
30 case ssaop.OpAdd64F:
31 v.Op = ssaop.OpRISCV64FADDD
32 return true
33 case ssaop.OpAdd8:
34 v.Op = ssaop.OpRISCV64ADD
35 return true
36 case ssaop.OpAddPtr:
37 v.Op = ssaop.OpRISCV64ADD
38 return true
39 case ssaop.OpAddr:
40 return rewriteValue_OpAddr(v)
41 case ssaop.OpAnd16:
42 v.Op = ssaop.OpRISCV64AND
43 return true
44 case ssaop.OpAnd32:
45 v.Op = ssaop.OpRISCV64AND
46 return true
47 case ssaop.OpAnd64:
48 v.Op = ssaop.OpRISCV64AND
49 return true
50 case ssaop.OpAnd8:
51 v.Op = ssaop.OpRISCV64AND
52 return true
53 case ssaop.OpAndB:
54 v.Op = ssaop.OpRISCV64AND
55 return true
56 case ssaop.OpAtomicAdd32:
57 v.Op = ssaop.OpRISCV64LoweredAtomicAdd32
58 return true
59 case ssaop.OpAtomicAdd64:
60 v.Op = ssaop.OpRISCV64LoweredAtomicAdd64
61 return true
62 case ssaop.OpAtomicAnd32:
63 v.Op = ssaop.OpRISCV64LoweredAtomicAnd32
64 return true
65 case ssaop.OpAtomicAnd32value:
66 v.Op = ssaop.OpRISCV64LoweredAtomicAnd32value
67 return true
68 case ssaop.OpAtomicAnd64value:
69 v.Op = ssaop.OpRISCV64LoweredAtomicAnd64value
70 return true
71 case ssaop.OpAtomicAnd8:
72 return rewriteValue_OpAtomicAnd8(v)
73 case ssaop.OpAtomicCompareAndSwap32:
74 return rewriteValue_OpAtomicCompareAndSwap32(v)
75 case ssaop.OpAtomicCompareAndSwap64:
76 v.Op = ssaop.OpRISCV64LoweredAtomicCas64
77 return true
78 case ssaop.OpAtomicExchange32:
79 v.Op = ssaop.OpRISCV64LoweredAtomicExchange32
80 return true
81 case ssaop.OpAtomicExchange64:
82 v.Op = ssaop.OpRISCV64LoweredAtomicExchange64
83 return true
84 case ssaop.OpAtomicLoad32:
85 v.Op = ssaop.OpRISCV64LoweredAtomicLoad32
86 return true
87 case ssaop.OpAtomicLoad64:
88 v.Op = ssaop.OpRISCV64LoweredAtomicLoad64
89 return true
90 case ssaop.OpAtomicLoad8:
91 v.Op = ssaop.OpRISCV64LoweredAtomicLoad8
92 return true
93 case ssaop.OpAtomicLoadPtr:
94 v.Op = ssaop.OpRISCV64LoweredAtomicLoad64
95 return true
96 case ssaop.OpAtomicOr32:
97 v.Op = ssaop.OpRISCV64LoweredAtomicOr32
98 return true
99 case ssaop.OpAtomicOr32value:
100 v.Op = ssaop.OpRISCV64LoweredAtomicOr32value
101 return true
102 case ssaop.OpAtomicOr64value:
103 v.Op = ssaop.OpRISCV64LoweredAtomicOr64value
104 return true
105 case ssaop.OpAtomicOr8:
106 return rewriteValue_OpAtomicOr8(v)
107 case ssaop.OpAtomicStore32:
108 v.Op = ssaop.OpRISCV64LoweredAtomicStore32
109 return true
110 case ssaop.OpAtomicStore64:
111 v.Op = ssaop.OpRISCV64LoweredAtomicStore64
112 return true
113 case ssaop.OpAtomicStore8:
114 v.Op = ssaop.OpRISCV64LoweredAtomicStore8
115 return true
116 case ssaop.OpAtomicStorePtrNoWB:
117 v.Op = ssaop.OpRISCV64LoweredAtomicStore64
118 return true
119 case ssaop.OpAvg64u:
120 return rewriteValue_OpAvg64u(v)
121 case ssaop.OpBitLen16:
122 return rewriteValue_OpBitLen16(v)
123 case ssaop.OpBitLen32:
124 return rewriteValue_OpBitLen32(v)
125 case ssaop.OpBitLen64:
126 return rewriteValue_OpBitLen64(v)
127 case ssaop.OpBitLen8:
128 return rewriteValue_OpBitLen8(v)
129 case ssaop.OpBswap16:
130 return rewriteValue_OpBswap16(v)
131 case ssaop.OpBswap32:
132 return rewriteValue_OpBswap32(v)
133 case ssaop.OpBswap64:
134 v.Op = ssaop.OpRISCV64REV8
135 return true
136 case ssaop.OpClosureCall:
137 v.Op = ssaop.OpRISCV64CALLclosure
138 return true
139 case ssaop.OpCom16:
140 v.Op = ssaop.OpRISCV64NOT
141 return true
142 case ssaop.OpCom32:
143 v.Op = ssaop.OpRISCV64NOT
144 return true
145 case ssaop.OpCom64:
146 v.Op = ssaop.OpRISCV64NOT
147 return true
148 case ssaop.OpCom8:
149 v.Op = ssaop.OpRISCV64NOT
150 return true
151 case ssaop.OpCondSelect:
152 return rewriteValue_OpCondSelect(v)
153 case ssaop.OpConst16:
154 return rewriteValue_OpConst16(v)
155 case ssaop.OpConst32:
156 return rewriteValue_OpConst32(v)
157 case ssaop.OpConst32F:
158 v.Op = ssaop.OpRISCV64FMOVFconst
159 return true
160 case ssaop.OpConst64:
161 return rewriteValue_OpConst64(v)
162 case ssaop.OpConst64F:
163 v.Op = ssaop.OpRISCV64FMOVDconst
164 return true
165 case ssaop.OpConst8:
166 return rewriteValue_OpConst8(v)
167 case ssaop.OpConstBool:
168 return rewriteValue_OpConstBool(v)
169 case ssaop.OpConstNil:
170 return rewriteValue_OpConstNil(v)
171 case ssaop.OpCopysign:
172 v.Op = ssaop.OpRISCV64FSGNJD
173 return true
174 case ssaop.OpCtz16:
175 return rewriteValue_OpCtz16(v)
176 case ssaop.OpCtz16NonZero:
177 v.Op = ssaop.OpCtz64
178 return true
179 case ssaop.OpCtz32:
180 v.Op = ssaop.OpRISCV64CTZW
181 return true
182 case ssaop.OpCtz32NonZero:
183 v.Op = ssaop.OpCtz64
184 return true
185 case ssaop.OpCtz64:
186 v.Op = ssaop.OpRISCV64CTZ
187 return true
188 case ssaop.OpCtz64NonZero:
189 v.Op = ssaop.OpCtz64
190 return true
191 case ssaop.OpCtz8:
192 return rewriteValue_OpCtz8(v)
193 case ssaop.OpCtz8NonZero:
194 v.Op = ssaop.OpCtz64
195 return true
196 case ssaop.OpCvt32Fto32:
197 v.Op = ssaop.OpRISCV64FCVTWS
198 return true
199 case ssaop.OpCvt32Fto64:
200 v.Op = ssaop.OpRISCV64FCVTLS
201 return true
202 case ssaop.OpCvt32Fto64F:
203 v.Op = ssaop.OpRISCV64FCVTDS
204 return true
205 case ssaop.OpCvt32to32F:
206 v.Op = ssaop.OpRISCV64FCVTSW
207 return true
208 case ssaop.OpCvt32to64F:
209 v.Op = ssaop.OpRISCV64FCVTDW
210 return true
211 case ssaop.OpCvt64Fto32:
212 v.Op = ssaop.OpRISCV64FCVTWD
213 return true
214 case ssaop.OpCvt64Fto32F:
215 v.Op = ssaop.OpRISCV64FCVTSD
216 return true
217 case ssaop.OpCvt64Fto64:
218 v.Op = ssaop.OpRISCV64FCVTLD
219 return true
220 case ssaop.OpCvt64to32F:
221 v.Op = ssaop.OpRISCV64FCVTSL
222 return true
223 case ssaop.OpCvt64to64F:
224 v.Op = ssaop.OpRISCV64FCVTDL
225 return true
226 case ssaop.OpCvtBoolToUint8:
227 v.Op = ssaop.OpCopy
228 return true
229 case ssaop.OpDiv16:
230 return rewriteValue_OpDiv16(v)
231 case ssaop.OpDiv16u:
232 return rewriteValue_OpDiv16u(v)
233 case ssaop.OpDiv32:
234 return rewriteValue_OpDiv32(v)
235 case ssaop.OpDiv32F:
236 v.Op = ssaop.OpRISCV64FDIVS
237 return true
238 case ssaop.OpDiv32u:
239 v.Op = ssaop.OpRISCV64DIVUW
240 return true
241 case ssaop.OpDiv64:
242 return rewriteValue_OpDiv64(v)
243 case ssaop.OpDiv64F:
244 v.Op = ssaop.OpRISCV64FDIVD
245 return true
246 case ssaop.OpDiv64u:
247 v.Op = ssaop.OpRISCV64DIVU
248 return true
249 case ssaop.OpDiv8:
250 return rewriteValue_OpDiv8(v)
251 case ssaop.OpDiv8u:
252 return rewriteValue_OpDiv8u(v)
253 case ssaop.OpEq16:
254 return rewriteValue_OpEq16(v)
255 case ssaop.OpEq32:
256 return rewriteValue_OpEq32(v)
257 case ssaop.OpEq32F:
258 v.Op = ssaop.OpRISCV64FEQS
259 return true
260 case ssaop.OpEq64:
261 return rewriteValue_OpEq64(v)
262 case ssaop.OpEq64F:
263 v.Op = ssaop.OpRISCV64FEQD
264 return true
265 case ssaop.OpEq8:
266 return rewriteValue_OpEq8(v)
267 case ssaop.OpEqB:
268 return rewriteValue_OpEqB(v)
269 case ssaop.OpEqPtr:
270 return rewriteValue_OpEqPtr(v)
271 case ssaop.OpFMA:
272 v.Op = ssaop.OpRISCV64FMADDD
273 return true
274 case ssaop.OpGetCallerPC:
275 v.Op = ssaop.OpRISCV64LoweredGetCallerPC
276 return true
277 case ssaop.OpGetCallerSP:
278 v.Op = ssaop.OpRISCV64LoweredGetCallerSP
279 return true
280 case ssaop.OpGetClosurePtr:
281 v.Op = ssaop.OpRISCV64LoweredGetClosurePtr
282 return true
283 case ssaop.OpHmul32:
284 return rewriteValue_OpHmul32(v)
285 case ssaop.OpHmul32u:
286 return rewriteValue_OpHmul32u(v)
287 case ssaop.OpHmul64:
288 v.Op = ssaop.OpRISCV64MULH
289 return true
290 case ssaop.OpHmul64u:
291 v.Op = ssaop.OpRISCV64MULHU
292 return true
293 case ssaop.OpInterCall:
294 v.Op = ssaop.OpRISCV64CALLinter
295 return true
296 case ssaop.OpIsInBounds:
297 v.Op = ssaop.OpLess64U
298 return true
299 case ssaop.OpIsNonNil:
300 v.Op = ssaop.OpRISCV64SNEZ
301 return true
302 case ssaop.OpIsSliceInBounds:
303 v.Op = ssaop.OpLeq64U
304 return true
305 case ssaop.OpLeq16:
306 return rewriteValue_OpLeq16(v)
307 case ssaop.OpLeq16U:
308 return rewriteValue_OpLeq16U(v)
309 case ssaop.OpLeq32:
310 return rewriteValue_OpLeq32(v)
311 case ssaop.OpLeq32F:
312 v.Op = ssaop.OpRISCV64FLES
313 return true
314 case ssaop.OpLeq32U:
315 return rewriteValue_OpLeq32U(v)
316 case ssaop.OpLeq64:
317 return rewriteValue_OpLeq64(v)
318 case ssaop.OpLeq64F:
319 v.Op = ssaop.OpRISCV64FLED
320 return true
321 case ssaop.OpLeq64U:
322 return rewriteValue_OpLeq64U(v)
323 case ssaop.OpLeq8:
324 return rewriteValue_OpLeq8(v)
325 case ssaop.OpLeq8U:
326 return rewriteValue_OpLeq8U(v)
327 case ssaop.OpLess16:
328 return rewriteValue_OpLess16(v)
329 case ssaop.OpLess16U:
330 return rewriteValue_OpLess16U(v)
331 case ssaop.OpLess32:
332 return rewriteValue_OpLess32(v)
333 case ssaop.OpLess32F:
334 v.Op = ssaop.OpRISCV64FLTS
335 return true
336 case ssaop.OpLess32U:
337 return rewriteValue_OpLess32U(v)
338 case ssaop.OpLess64:
339 v.Op = ssaop.OpRISCV64SLT
340 return true
341 case ssaop.OpLess64F:
342 v.Op = ssaop.OpRISCV64FLTD
343 return true
344 case ssaop.OpLess64U:
345 v.Op = ssaop.OpRISCV64SLTU
346 return true
347 case ssaop.OpLess8:
348 return rewriteValue_OpLess8(v)
349 case ssaop.OpLess8U:
350 return rewriteValue_OpLess8U(v)
351 case ssaop.OpLoad:
352 return rewriteValue_OpLoad(v)
353 case ssaop.OpLocalAddr:
354 return rewriteValue_OpLocalAddr(v)
355 case ssaop.OpLsh16x16:
356 return rewriteValue_OpLsh16x16(v)
357 case ssaop.OpLsh16x32:
358 return rewriteValue_OpLsh16x32(v)
359 case ssaop.OpLsh16x64:
360 return rewriteValue_OpLsh16x64(v)
361 case ssaop.OpLsh16x8:
362 return rewriteValue_OpLsh16x8(v)
363 case ssaop.OpLsh32x16:
364 return rewriteValue_OpLsh32x16(v)
365 case ssaop.OpLsh32x32:
366 return rewriteValue_OpLsh32x32(v)
367 case ssaop.OpLsh32x64:
368 return rewriteValue_OpLsh32x64(v)
369 case ssaop.OpLsh32x8:
370 return rewriteValue_OpLsh32x8(v)
371 case ssaop.OpLsh64x16:
372 return rewriteValue_OpLsh64x16(v)
373 case ssaop.OpLsh64x32:
374 return rewriteValue_OpLsh64x32(v)
375 case ssaop.OpLsh64x64:
376 return rewriteValue_OpLsh64x64(v)
377 case ssaop.OpLsh64x8:
378 return rewriteValue_OpLsh64x8(v)
379 case ssaop.OpLsh8x16:
380 return rewriteValue_OpLsh8x16(v)
381 case ssaop.OpLsh8x32:
382 return rewriteValue_OpLsh8x32(v)
383 case ssaop.OpLsh8x64:
384 return rewriteValue_OpLsh8x64(v)
385 case ssaop.OpLsh8x8:
386 return rewriteValue_OpLsh8x8(v)
387 case ssaop.OpMax32F:
388 v.Op = ssaop.OpRISCV64LoweredFMAXS
389 return true
390 case ssaop.OpMax64:
391 return rewriteValue_OpMax64(v)
392 case ssaop.OpMax64F:
393 v.Op = ssaop.OpRISCV64LoweredFMAXD
394 return true
395 case ssaop.OpMax64u:
396 return rewriteValue_OpMax64u(v)
397 case ssaop.OpMin32F:
398 v.Op = ssaop.OpRISCV64LoweredFMINS
399 return true
400 case ssaop.OpMin64:
401 return rewriteValue_OpMin64(v)
402 case ssaop.OpMin64F:
403 v.Op = ssaop.OpRISCV64LoweredFMIND
404 return true
405 case ssaop.OpMin64u:
406 return rewriteValue_OpMin64u(v)
407 case ssaop.OpMod16:
408 return rewriteValue_OpMod16(v)
409 case ssaop.OpMod16u:
410 return rewriteValue_OpMod16u(v)
411 case ssaop.OpMod32:
412 return rewriteValue_OpMod32(v)
413 case ssaop.OpMod32u:
414 v.Op = ssaop.OpRISCV64REMUW
415 return true
416 case ssaop.OpMod64:
417 return rewriteValue_OpMod64(v)
418 case ssaop.OpMod64u:
419 v.Op = ssaop.OpRISCV64REMU
420 return true
421 case ssaop.OpMod8:
422 return rewriteValue_OpMod8(v)
423 case ssaop.OpMod8u:
424 return rewriteValue_OpMod8u(v)
425 case ssaop.OpMove:
426 return rewriteValue_OpMove(v)
427 case ssaop.OpMul16:
428 v.Op = ssaop.OpRISCV64MULW
429 return true
430 case ssaop.OpMul32:
431 v.Op = ssaop.OpRISCV64MULW
432 return true
433 case ssaop.OpMul32F:
434 v.Op = ssaop.OpRISCV64FMULS
435 return true
436 case ssaop.OpMul64:
437 v.Op = ssaop.OpRISCV64MUL
438 return true
439 case ssaop.OpMul64F:
440 v.Op = ssaop.OpRISCV64FMULD
441 return true
442 case ssaop.OpMul64uhilo:
443 v.Op = ssaop.OpRISCV64LoweredMuluhilo
444 return true
445 case ssaop.OpMul64uover:
446 v.Op = ssaop.OpRISCV64LoweredMuluover
447 return true
448 case ssaop.OpMul8:
449 v.Op = ssaop.OpRISCV64MULW
450 return true
451 case ssaop.OpNeg16:
452 v.Op = ssaop.OpRISCV64NEG
453 return true
454 case ssaop.OpNeg32:
455 v.Op = ssaop.OpRISCV64NEG
456 return true
457 case ssaop.OpNeg32F:
458 v.Op = ssaop.OpRISCV64FNEGS
459 return true
460 case ssaop.OpNeg64:
461 v.Op = ssaop.OpRISCV64NEG
462 return true
463 case ssaop.OpNeg64F:
464 v.Op = ssaop.OpRISCV64FNEGD
465 return true
466 case ssaop.OpNeg8:
467 v.Op = ssaop.OpRISCV64NEG
468 return true
469 case ssaop.OpNeq16:
470 return rewriteValue_OpNeq16(v)
471 case ssaop.OpNeq32:
472 return rewriteValue_OpNeq32(v)
473 case ssaop.OpNeq32F:
474 v.Op = ssaop.OpRISCV64FNES
475 return true
476 case ssaop.OpNeq64:
477 return rewriteValue_OpNeq64(v)
478 case ssaop.OpNeq64F:
479 v.Op = ssaop.OpRISCV64FNED
480 return true
481 case ssaop.OpNeq8:
482 return rewriteValue_OpNeq8(v)
483 case ssaop.OpNeqB:
484 return rewriteValue_OpNeqB(v)
485 case ssaop.OpNeqPtr:
486 return rewriteValue_OpNeqPtr(v)
487 case ssaop.OpNilCheck:
488 v.Op = ssaop.OpRISCV64LoweredNilCheck
489 return true
490 case ssaop.OpNot:
491 v.Op = ssaop.OpRISCV64SEQZ
492 return true
493 case ssaop.OpOffPtr:
494 return rewriteValue_OpOffPtr(v)
495 case ssaop.OpOr16:
496 v.Op = ssaop.OpRISCV64OR
497 return true
498 case ssaop.OpOr32:
499 v.Op = ssaop.OpRISCV64OR
500 return true
501 case ssaop.OpOr64:
502 v.Op = ssaop.OpRISCV64OR
503 return true
504 case ssaop.OpOr8:
505 v.Op = ssaop.OpRISCV64OR
506 return true
507 case ssaop.OpOrB:
508 v.Op = ssaop.OpRISCV64OR
509 return true
510 case ssaop.OpPanicBounds:
511 v.Op = ssaop.OpRISCV64LoweredPanicBoundsRR
512 return true
513 case ssaop.OpPopCount16:
514 return rewriteValue_OpPopCount16(v)
515 case ssaop.OpPopCount32:
516 v.Op = ssaop.OpRISCV64CPOPW
517 return true
518 case ssaop.OpPopCount64:
519 v.Op = ssaop.OpRISCV64CPOP
520 return true
521 case ssaop.OpPopCount8:
522 return rewriteValue_OpPopCount8(v)
523 case ssaop.OpPubBarrier:
524 v.Op = ssaop.OpRISCV64LoweredPubBarrier
525 return true
526 case ssaop.OpRISCV64ADD:
527 return rewriteValue_OpRISCV64ADD(v)
528 case ssaop.OpRISCV64ADDI:
529 return rewriteValue_OpRISCV64ADDI(v)
530 case ssaop.OpRISCV64AND:
531 return rewriteValue_OpRISCV64AND(v)
532 case ssaop.OpRISCV64ANDI:
533 return rewriteValue_OpRISCV64ANDI(v)
534 case ssaop.OpRISCV64CZEROEQZ:
535 return rewriteValue_OpRISCV64CZEROEQZ(v)
536 case ssaop.OpRISCV64CZERONEZ:
537 return rewriteValue_OpRISCV64CZERONEZ(v)
538 case ssaop.OpRISCV64FADDD:
539 return rewriteValue_OpRISCV64FADDD(v)
540 case ssaop.OpRISCV64FADDS:
541 return rewriteValue_OpRISCV64FADDS(v)
542 case ssaop.OpRISCV64FCVTSD:
543 return rewriteValue_OpRISCV64FCVTSD(v)
544 case ssaop.OpRISCV64FEQD:
545 return rewriteValue_OpRISCV64FEQD(v)
546 case ssaop.OpRISCV64FLED:
547 return rewriteValue_OpRISCV64FLED(v)
548 case ssaop.OpRISCV64FLTD:
549 return rewriteValue_OpRISCV64FLTD(v)
550 case ssaop.OpRISCV64FMADDD:
551 return rewriteValue_OpRISCV64FMADDD(v)
552 case ssaop.OpRISCV64FMADDS:
553 return rewriteValue_OpRISCV64FMADDS(v)
554 case ssaop.OpRISCV64FMOVDload:
555 return rewriteValue_OpRISCV64FMOVDload(v)
556 case ssaop.OpRISCV64FMOVDstore:
557 return rewriteValue_OpRISCV64FMOVDstore(v)
558 case ssaop.OpRISCV64FMOVWload:
559 return rewriteValue_OpRISCV64FMOVWload(v)
560 case ssaop.OpRISCV64FMOVWstore:
561 return rewriteValue_OpRISCV64FMOVWstore(v)
562 case ssaop.OpRISCV64FMSUBD:
563 return rewriteValue_OpRISCV64FMSUBD(v)
564 case ssaop.OpRISCV64FMSUBS:
565 return rewriteValue_OpRISCV64FMSUBS(v)
566 case ssaop.OpRISCV64FNED:
567 return rewriteValue_OpRISCV64FNED(v)
568 case ssaop.OpRISCV64FNMADDD:
569 return rewriteValue_OpRISCV64FNMADDD(v)
570 case ssaop.OpRISCV64FNMADDS:
571 return rewriteValue_OpRISCV64FNMADDS(v)
572 case ssaop.OpRISCV64FNMSUBD:
573 return rewriteValue_OpRISCV64FNMSUBD(v)
574 case ssaop.OpRISCV64FNMSUBS:
575 return rewriteValue_OpRISCV64FNMSUBS(v)
576 case ssaop.OpRISCV64FSUBD:
577 return rewriteValue_OpRISCV64FSUBD(v)
578 case ssaop.OpRISCV64FSUBS:
579 return rewriteValue_OpRISCV64FSUBS(v)
580 case ssaop.OpRISCV64LoweredPanicBoundsCR:
581 return rewriteValue_OpRISCV64LoweredPanicBoundsCR(v)
582 case ssaop.OpRISCV64LoweredPanicBoundsRC:
583 return rewriteValue_OpRISCV64LoweredPanicBoundsRC(v)
584 case ssaop.OpRISCV64LoweredPanicBoundsRR:
585 return rewriteValue_OpRISCV64LoweredPanicBoundsRR(v)
586 case ssaop.OpRISCV64MOVBUload:
587 return rewriteValue_OpRISCV64MOVBUload(v)
588 case ssaop.OpRISCV64MOVBUreg:
589 return rewriteValue_OpRISCV64MOVBUreg(v)
590 case ssaop.OpRISCV64MOVBload:
591 return rewriteValue_OpRISCV64MOVBload(v)
592 case ssaop.OpRISCV64MOVBreg:
593 return rewriteValue_OpRISCV64MOVBreg(v)
594 case ssaop.OpRISCV64MOVBstore:
595 return rewriteValue_OpRISCV64MOVBstore(v)
596 case ssaop.OpRISCV64MOVBstorezero:
597 return rewriteValue_OpRISCV64MOVBstorezero(v)
598 case ssaop.OpRISCV64MOVDload:
599 return rewriteValue_OpRISCV64MOVDload(v)
600 case ssaop.OpRISCV64MOVDnop:
601 return rewriteValue_OpRISCV64MOVDnop(v)
602 case ssaop.OpRISCV64MOVDreg:
603 return rewriteValue_OpRISCV64MOVDreg(v)
604 case ssaop.OpRISCV64MOVDstore:
605 return rewriteValue_OpRISCV64MOVDstore(v)
606 case ssaop.OpRISCV64MOVDstorezero:
607 return rewriteValue_OpRISCV64MOVDstorezero(v)
608 case ssaop.OpRISCV64MOVHUload:
609 return rewriteValue_OpRISCV64MOVHUload(v)
610 case ssaop.OpRISCV64MOVHUreg:
611 return rewriteValue_OpRISCV64MOVHUreg(v)
612 case ssaop.OpRISCV64MOVHload:
613 return rewriteValue_OpRISCV64MOVHload(v)
614 case ssaop.OpRISCV64MOVHreg:
615 return rewriteValue_OpRISCV64MOVHreg(v)
616 case ssaop.OpRISCV64MOVHstore:
617 return rewriteValue_OpRISCV64MOVHstore(v)
618 case ssaop.OpRISCV64MOVHstorezero:
619 return rewriteValue_OpRISCV64MOVHstorezero(v)
620 case ssaop.OpRISCV64MOVWUload:
621 return rewriteValue_OpRISCV64MOVWUload(v)
622 case ssaop.OpRISCV64MOVWUreg:
623 return rewriteValue_OpRISCV64MOVWUreg(v)
624 case ssaop.OpRISCV64MOVWload:
625 return rewriteValue_OpRISCV64MOVWload(v)
626 case ssaop.OpRISCV64MOVWreg:
627 return rewriteValue_OpRISCV64MOVWreg(v)
628 case ssaop.OpRISCV64MOVWstore:
629 return rewriteValue_OpRISCV64MOVWstore(v)
630 case ssaop.OpRISCV64MOVWstorezero:
631 return rewriteValue_OpRISCV64MOVWstorezero(v)
632 case ssaop.OpRISCV64MUL:
633 return rewriteValue_OpRISCV64MUL(v)
634 case ssaop.OpRISCV64MULW:
635 return rewriteValue_OpRISCV64MULW(v)
636 case ssaop.OpRISCV64NEG:
637 return rewriteValue_OpRISCV64NEG(v)
638 case ssaop.OpRISCV64NEGW:
639 return rewriteValue_OpRISCV64NEGW(v)
640 case ssaop.OpRISCV64OR:
641 return rewriteValue_OpRISCV64OR(v)
642 case ssaop.OpRISCV64ORI:
643 return rewriteValue_OpRISCV64ORI(v)
644 case ssaop.OpRISCV64ORN:
645 return rewriteValue_OpRISCV64ORN(v)
646 case ssaop.OpRISCV64ROL:
647 return rewriteValue_OpRISCV64ROL(v)
648 case ssaop.OpRISCV64ROLW:
649 return rewriteValue_OpRISCV64ROLW(v)
650 case ssaop.OpRISCV64ROR:
651 return rewriteValue_OpRISCV64ROR(v)
652 case ssaop.OpRISCV64RORW:
653 return rewriteValue_OpRISCV64RORW(v)
654 case ssaop.OpRISCV64SEQZ:
655 return rewriteValue_OpRISCV64SEQZ(v)
656 case ssaop.OpRISCV64SLL:
657 return rewriteValue_OpRISCV64SLL(v)
658 case ssaop.OpRISCV64SLLI:
659 return rewriteValue_OpRISCV64SLLI(v)
660 case ssaop.OpRISCV64SLLW:
661 return rewriteValue_OpRISCV64SLLW(v)
662 case ssaop.OpRISCV64SLT:
663 return rewriteValue_OpRISCV64SLT(v)
664 case ssaop.OpRISCV64SLTI:
665 return rewriteValue_OpRISCV64SLTI(v)
666 case ssaop.OpRISCV64SLTIU:
667 return rewriteValue_OpRISCV64SLTIU(v)
668 case ssaop.OpRISCV64SLTU:
669 return rewriteValue_OpRISCV64SLTU(v)
670 case ssaop.OpRISCV64SNEZ:
671 return rewriteValue_OpRISCV64SNEZ(v)
672 case ssaop.OpRISCV64SRA:
673 return rewriteValue_OpRISCV64SRA(v)
674 case ssaop.OpRISCV64SRAI:
675 return rewriteValue_OpRISCV64SRAI(v)
676 case ssaop.OpRISCV64SRAW:
677 return rewriteValue_OpRISCV64SRAW(v)
678 case ssaop.OpRISCV64SRL:
679 return rewriteValue_OpRISCV64SRL(v)
680 case ssaop.OpRISCV64SRLI:
681 return rewriteValue_OpRISCV64SRLI(v)
682 case ssaop.OpRISCV64SRLW:
683 return rewriteValue_OpRISCV64SRLW(v)
684 case ssaop.OpRISCV64SUB:
685 return rewriteValue_OpRISCV64SUB(v)
686 case ssaop.OpRISCV64SUBW:
687 return rewriteValue_OpRISCV64SUBW(v)
688 case ssaop.OpRISCV64XOR:
689 return rewriteValue_OpRISCV64XOR(v)
690 case ssaop.OpRotateLeft16:
691 return rewriteValue_OpRotateLeft16(v)
692 case ssaop.OpRotateLeft32:
693 v.Op = ssaop.OpRISCV64ROLW
694 return true
695 case ssaop.OpRotateLeft64:
696 v.Op = ssaop.OpRISCV64ROL
697 return true
698 case ssaop.OpRotateLeft8:
699 return rewriteValue_OpRotateLeft8(v)
700 case ssaop.OpRound32F:
701 v.Op = ssaop.OpRISCV64LoweredRound32F
702 return true
703 case ssaop.OpRound64F:
704 v.Op = ssaop.OpRISCV64LoweredRound64F
705 return true
706 case ssaop.OpRsh16Ux16:
707 return rewriteValue_OpRsh16Ux16(v)
708 case ssaop.OpRsh16Ux32:
709 return rewriteValue_OpRsh16Ux32(v)
710 case ssaop.OpRsh16Ux64:
711 return rewriteValue_OpRsh16Ux64(v)
712 case ssaop.OpRsh16Ux8:
713 return rewriteValue_OpRsh16Ux8(v)
714 case ssaop.OpRsh16x16:
715 return rewriteValue_OpRsh16x16(v)
716 case ssaop.OpRsh16x32:
717 return rewriteValue_OpRsh16x32(v)
718 case ssaop.OpRsh16x64:
719 return rewriteValue_OpRsh16x64(v)
720 case ssaop.OpRsh16x8:
721 return rewriteValue_OpRsh16x8(v)
722 case ssaop.OpRsh32Ux16:
723 return rewriteValue_OpRsh32Ux16(v)
724 case ssaop.OpRsh32Ux32:
725 return rewriteValue_OpRsh32Ux32(v)
726 case ssaop.OpRsh32Ux64:
727 return rewriteValue_OpRsh32Ux64(v)
728 case ssaop.OpRsh32Ux8:
729 return rewriteValue_OpRsh32Ux8(v)
730 case ssaop.OpRsh32x16:
731 return rewriteValue_OpRsh32x16(v)
732 case ssaop.OpRsh32x32:
733 return rewriteValue_OpRsh32x32(v)
734 case ssaop.OpRsh32x64:
735 return rewriteValue_OpRsh32x64(v)
736 case ssaop.OpRsh32x8:
737 return rewriteValue_OpRsh32x8(v)
738 case ssaop.OpRsh64Ux16:
739 return rewriteValue_OpRsh64Ux16(v)
740 case ssaop.OpRsh64Ux32:
741 return rewriteValue_OpRsh64Ux32(v)
742 case ssaop.OpRsh64Ux64:
743 return rewriteValue_OpRsh64Ux64(v)
744 case ssaop.OpRsh64Ux8:
745 return rewriteValue_OpRsh64Ux8(v)
746 case ssaop.OpRsh64x16:
747 return rewriteValue_OpRsh64x16(v)
748 case ssaop.OpRsh64x32:
749 return rewriteValue_OpRsh64x32(v)
750 case ssaop.OpRsh64x64:
751 return rewriteValue_OpRsh64x64(v)
752 case ssaop.OpRsh64x8:
753 return rewriteValue_OpRsh64x8(v)
754 case ssaop.OpRsh8Ux16:
755 return rewriteValue_OpRsh8Ux16(v)
756 case ssaop.OpRsh8Ux32:
757 return rewriteValue_OpRsh8Ux32(v)
758 case ssaop.OpRsh8Ux64:
759 return rewriteValue_OpRsh8Ux64(v)
760 case ssaop.OpRsh8Ux8:
761 return rewriteValue_OpRsh8Ux8(v)
762 case ssaop.OpRsh8x16:
763 return rewriteValue_OpRsh8x16(v)
764 case ssaop.OpRsh8x32:
765 return rewriteValue_OpRsh8x32(v)
766 case ssaop.OpRsh8x64:
767 return rewriteValue_OpRsh8x64(v)
768 case ssaop.OpRsh8x8:
769 return rewriteValue_OpRsh8x8(v)
770 case ssaop.OpSelect0:
771 return rewriteValue_OpSelect0(v)
772 case ssaop.OpSelect1:
773 return rewriteValue_OpSelect1(v)
774 case ssaop.OpSignExt16to32:
775 v.Op = ssaop.OpRISCV64MOVHreg
776 return true
777 case ssaop.OpSignExt16to64:
778 v.Op = ssaop.OpRISCV64MOVHreg
779 return true
780 case ssaop.OpSignExt32to64:
781 v.Op = ssaop.OpRISCV64MOVWreg
782 return true
783 case ssaop.OpSignExt8to16:
784 v.Op = ssaop.OpRISCV64MOVBreg
785 return true
786 case ssaop.OpSignExt8to32:
787 v.Op = ssaop.OpRISCV64MOVBreg
788 return true
789 case ssaop.OpSignExt8to64:
790 v.Op = ssaop.OpRISCV64MOVBreg
791 return true
792 case ssaop.OpSlicemask:
793 return rewriteValue_OpSlicemask(v)
794 case ssaop.OpSqrt:
795 v.Op = ssaop.OpRISCV64FSQRTD
796 return true
797 case ssaop.OpSqrt32:
798 v.Op = ssaop.OpRISCV64FSQRTS
799 return true
800 case ssaop.OpStaticCall:
801 v.Op = ssaop.OpRISCV64CALLstatic
802 return true
803 case ssaop.OpStore:
804 return rewriteValue_OpStore(v)
805 case ssaop.OpSub16:
806 v.Op = ssaop.OpRISCV64SUB
807 return true
808 case ssaop.OpSub32:
809 v.Op = ssaop.OpRISCV64SUB
810 return true
811 case ssaop.OpSub32F:
812 v.Op = ssaop.OpRISCV64FSUBS
813 return true
814 case ssaop.OpSub64:
815 v.Op = ssaop.OpRISCV64SUB
816 return true
817 case ssaop.OpSub64F:
818 v.Op = ssaop.OpRISCV64FSUBD
819 return true
820 case ssaop.OpSub8:
821 v.Op = ssaop.OpRISCV64SUB
822 return true
823 case ssaop.OpSubPtr:
824 v.Op = ssaop.OpRISCV64SUB
825 return true
826 case ssaop.OpTailCall:
827 v.Op = ssaop.OpRISCV64CALLtail
828 return true
829 case ssaop.OpTailCallInter:
830 v.Op = ssaop.OpRISCV64CALLtailinter
831 return true
832 case ssaop.OpTrunc16to8:
833 v.Op = ssaop.OpCopy
834 return true
835 case ssaop.OpTrunc32to16:
836 v.Op = ssaop.OpCopy
837 return true
838 case ssaop.OpTrunc32to8:
839 v.Op = ssaop.OpCopy
840 return true
841 case ssaop.OpTrunc64to16:
842 v.Op = ssaop.OpCopy
843 return true
844 case ssaop.OpTrunc64to32:
845 v.Op = ssaop.OpCopy
846 return true
847 case ssaop.OpTrunc64to8:
848 v.Op = ssaop.OpCopy
849 return true
850 case ssaop.OpWB:
851 v.Op = ssaop.OpRISCV64LoweredWB
852 return true
853 case ssaop.OpXor16:
854 v.Op = ssaop.OpRISCV64XOR
855 return true
856 case ssaop.OpXor32:
857 v.Op = ssaop.OpRISCV64XOR
858 return true
859 case ssaop.OpXor64:
860 v.Op = ssaop.OpRISCV64XOR
861 return true
862 case ssaop.OpXor8:
863 v.Op = ssaop.OpRISCV64XOR
864 return true
865 case ssaop.OpZero:
866 return rewriteValue_OpZero(v)
867 case ssaop.OpZeroExt16to32:
868 v.Op = ssaop.OpRISCV64MOVHUreg
869 return true
870 case ssaop.OpZeroExt16to64:
871 v.Op = ssaop.OpRISCV64MOVHUreg
872 return true
873 case ssaop.OpZeroExt32to64:
874 v.Op = ssaop.OpRISCV64MOVWUreg
875 return true
876 case ssaop.OpZeroExt8to16:
877 v.Op = ssaop.OpRISCV64MOVBUreg
878 return true
879 case ssaop.OpZeroExt8to32:
880 v.Op = ssaop.OpRISCV64MOVBUreg
881 return true
882 case ssaop.OpZeroExt8to64:
883 v.Op = ssaop.OpRISCV64MOVBUreg
884 return true
885 }
886 return false
887 }
888 func rewriteValue_OpAddr(v *ssa.Value) bool {
889 v_0 := v.Args[0]
890
891
892 for {
893 sym := ssa.AuxToSym(v.Aux)
894 base := v_0
895 v.Reset(ssaop.OpRISCV64MOVaddr)
896 v.AuxInt = ssa.Int32ToAuxInt(0)
897 v.Aux = ssa.SymToAux(sym)
898 v.AddArg(base)
899 return true
900 }
901 }
902 func rewriteValue_OpAtomicAnd8(v *ssa.Value) bool {
903 v_2 := v.Args[2]
904 v_1 := v.Args[1]
905 v_0 := v.Args[0]
906 b := v.Block
907 typ := &b.Func.Config.Types
908
909
910 for {
911 ptr := v_0
912 val := v_1
913 mem := v_2
914 v.Reset(ssaop.OpRISCV64LoweredAtomicAnd32)
915 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Uintptr)
916 v0.AuxInt = ssa.Int64ToAuxInt(^3)
917 v0.AddArg(ptr)
918 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64NOT, typ.UInt32)
919 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, typ.UInt32)
920 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64XORI, typ.UInt32)
921 v3.AuxInt = ssa.Int64ToAuxInt(0xff)
922 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
923 v4.AddArg(val)
924 v3.AddArg(v4)
925 v5 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLI, typ.UInt64)
926 v5.AuxInt = ssa.Int64ToAuxInt(3)
927 v6 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
928 v6.AuxInt = ssa.Int64ToAuxInt(3)
929 v6.AddArg(ptr)
930 v5.AddArg(v6)
931 v2.AddArg2(v3, v5)
932 v1.AddArg(v2)
933 v.AddArg3(v0, v1, mem)
934 return true
935 }
936 }
937 func rewriteValue_OpAtomicCompareAndSwap32(v *ssa.Value) bool {
938 v_3 := v.Args[3]
939 v_2 := v.Args[2]
940 v_1 := v.Args[1]
941 v_0 := v.Args[0]
942 b := v.Block
943 typ := &b.Func.Config.Types
944
945
946 for {
947 ptr := v_0
948 old := v_1
949 new := v_2
950 mem := v_3
951 v.Reset(ssaop.OpRISCV64LoweredAtomicCas32)
952 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
953 v0.AddArg(old)
954 v.AddArg4(ptr, v0, new, mem)
955 return true
956 }
957 }
958 func rewriteValue_OpAtomicOr8(v *ssa.Value) bool {
959 v_2 := v.Args[2]
960 v_1 := v.Args[1]
961 v_0 := v.Args[0]
962 b := v.Block
963 typ := &b.Func.Config.Types
964
965
966 for {
967 ptr := v_0
968 val := v_1
969 mem := v_2
970 v.Reset(ssaop.OpRISCV64LoweredAtomicOr32)
971 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Uintptr)
972 v0.AuxInt = ssa.Int64ToAuxInt(^3)
973 v0.AddArg(ptr)
974 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, typ.UInt32)
975 v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
976 v2.AddArg(val)
977 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLI, typ.UInt64)
978 v3.AuxInt = ssa.Int64ToAuxInt(3)
979 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
980 v4.AuxInt = ssa.Int64ToAuxInt(3)
981 v4.AddArg(ptr)
982 v3.AddArg(v4)
983 v1.AddArg2(v2, v3)
984 v.AddArg3(v0, v1, mem)
985 return true
986 }
987 }
988 func rewriteValue_OpAvg64u(v *ssa.Value) bool {
989 v_1 := v.Args[1]
990 v_0 := v.Args[0]
991 b := v.Block
992
993
994 for {
995 t := v.Type
996 x := v_0
997 y := v_1
998 v.Reset(ssaop.OpRISCV64ADD)
999 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADD, t)
1000 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, t)
1001 v1.AuxInt = ssa.Int64ToAuxInt(1)
1002 v1.AddArg(x)
1003 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, t)
1004 v2.AuxInt = ssa.Int64ToAuxInt(1)
1005 v2.AddArg(y)
1006 v0.AddArg2(v1, v2)
1007 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, t)
1008 v3.AuxInt = ssa.Int64ToAuxInt(1)
1009 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64AND, t)
1010 v4.AddArg2(x, y)
1011 v3.AddArg(v4)
1012 v.AddArg2(v0, v3)
1013 return true
1014 }
1015 }
1016 func rewriteValue_OpBitLen16(v *ssa.Value) bool {
1017 v_0 := v.Args[0]
1018 b := v.Block
1019 typ := &b.Func.Config.Types
1020
1021
1022 for {
1023 x := v_0
1024 v.Reset(ssaop.OpBitLen64)
1025 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1026 v0.AddArg(x)
1027 v.AddArg(v0)
1028 return true
1029 }
1030 }
1031 func rewriteValue_OpBitLen32(v *ssa.Value) bool {
1032 v_0 := v.Args[0]
1033 b := v.Block
1034 typ := &b.Func.Config.Types
1035
1036
1037 for {
1038 t := v.Type
1039 x := v_0
1040 v.Reset(ssaop.OpRISCV64SUB)
1041 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
1042 v0.AuxInt = ssa.Int64ToAuxInt(32)
1043 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64CLZW, t)
1044 v1.AddArg(x)
1045 v.AddArg2(v0, v1)
1046 return true
1047 }
1048 }
1049 func rewriteValue_OpBitLen64(v *ssa.Value) bool {
1050 v_0 := v.Args[0]
1051 b := v.Block
1052 typ := &b.Func.Config.Types
1053
1054
1055 for {
1056 t := v.Type
1057 x := v_0
1058 v.Reset(ssaop.OpRISCV64SUB)
1059 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
1060 v0.AuxInt = ssa.Int64ToAuxInt(64)
1061 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64CLZ, t)
1062 v1.AddArg(x)
1063 v.AddArg2(v0, v1)
1064 return true
1065 }
1066 }
1067 func rewriteValue_OpBitLen8(v *ssa.Value) bool {
1068 v_0 := v.Args[0]
1069 b := v.Block
1070 typ := &b.Func.Config.Types
1071
1072
1073 for {
1074 x := v_0
1075 v.Reset(ssaop.OpBitLen64)
1076 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
1077 v0.AddArg(x)
1078 v.AddArg(v0)
1079 return true
1080 }
1081 }
1082 func rewriteValue_OpBswap16(v *ssa.Value) bool {
1083 v_0 := v.Args[0]
1084 b := v.Block
1085
1086
1087 for {
1088 t := v.Type
1089 x := v_0
1090 v.Reset(ssaop.OpRISCV64SRLI)
1091 v.AuxInt = ssa.Int64ToAuxInt(48)
1092 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64REV8, t)
1093 v0.AddArg(x)
1094 v.AddArg(v0)
1095 return true
1096 }
1097 }
1098 func rewriteValue_OpBswap32(v *ssa.Value) bool {
1099 v_0 := v.Args[0]
1100 b := v.Block
1101
1102
1103 for {
1104 t := v.Type
1105 x := v_0
1106 v.Reset(ssaop.OpRISCV64SRLI)
1107 v.AuxInt = ssa.Int64ToAuxInt(32)
1108 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64REV8, t)
1109 v0.AddArg(x)
1110 v.AddArg(v0)
1111 return true
1112 }
1113 }
1114 func rewriteValue_OpCondSelect(v *ssa.Value) bool {
1115 v_2 := v.Args[2]
1116 v_1 := v.Args[1]
1117 v_0 := v.Args[0]
1118 b := v.Block
1119 typ := &b.Func.Config.Types
1120
1121
1122 for {
1123 t := v.Type
1124 x := v_0
1125 y := v_1
1126 cond := v_2
1127 v.Reset(ssaop.OpRISCV64OR)
1128 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
1129 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBUreg, typ.UInt64)
1130 v1.AddArg(cond)
1131 v0.AddArg2(x, v1)
1132 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
1133 v2.AddArg2(y, v1)
1134 v.AddArg2(v0, v2)
1135 return true
1136 }
1137 }
1138 func rewriteValue_OpConst16(v *ssa.Value) bool {
1139
1140
1141 for {
1142 val := ssa.AuxIntToInt16(v.AuxInt)
1143 v.Reset(ssaop.OpRISCV64MOVDconst)
1144 v.AuxInt = ssa.Int64ToAuxInt(int64(val))
1145 return true
1146 }
1147 }
1148 func rewriteValue_OpConst32(v *ssa.Value) bool {
1149
1150
1151 for {
1152 val := ssa.AuxIntToInt32(v.AuxInt)
1153 v.Reset(ssaop.OpRISCV64MOVDconst)
1154 v.AuxInt = ssa.Int64ToAuxInt(int64(val))
1155 return true
1156 }
1157 }
1158 func rewriteValue_OpConst64(v *ssa.Value) bool {
1159
1160
1161 for {
1162 val := ssa.AuxIntToInt64(v.AuxInt)
1163 v.Reset(ssaop.OpRISCV64MOVDconst)
1164 v.AuxInt = ssa.Int64ToAuxInt(int64(val))
1165 return true
1166 }
1167 }
1168 func rewriteValue_OpConst8(v *ssa.Value) bool {
1169
1170
1171 for {
1172 val := ssa.AuxIntToInt8(v.AuxInt)
1173 v.Reset(ssaop.OpRISCV64MOVDconst)
1174 v.AuxInt = ssa.Int64ToAuxInt(int64(val))
1175 return true
1176 }
1177 }
1178 func rewriteValue_OpConstBool(v *ssa.Value) bool {
1179
1180
1181 for {
1182 val := ssa.AuxIntToBool(v.AuxInt)
1183 v.Reset(ssaop.OpRISCV64MOVDconst)
1184 v.AuxInt = ssa.Int64ToAuxInt(int64(ssa.B2i(val)))
1185 return true
1186 }
1187 }
1188 func rewriteValue_OpConstNil(v *ssa.Value) bool {
1189
1190
1191 for {
1192 v.Reset(ssaop.OpRISCV64MOVDconst)
1193 v.AuxInt = ssa.Int64ToAuxInt(0)
1194 return true
1195 }
1196 }
1197 func rewriteValue_OpCtz16(v *ssa.Value) bool {
1198 v_0 := v.Args[0]
1199 b := v.Block
1200 typ := &b.Func.Config.Types
1201
1202
1203 for {
1204 x := v_0
1205 v.Reset(ssaop.OpRISCV64CTZW)
1206 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ORI, typ.UInt32)
1207 v0.AuxInt = ssa.Int64ToAuxInt(1 << 16)
1208 v0.AddArg(x)
1209 v.AddArg(v0)
1210 return true
1211 }
1212 }
1213 func rewriteValue_OpCtz8(v *ssa.Value) bool {
1214 v_0 := v.Args[0]
1215 b := v.Block
1216 typ := &b.Func.Config.Types
1217
1218
1219 for {
1220 x := v_0
1221 v.Reset(ssaop.OpRISCV64CTZW)
1222 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ORI, typ.UInt32)
1223 v0.AuxInt = ssa.Int64ToAuxInt(1 << 8)
1224 v0.AddArg(x)
1225 v.AddArg(v0)
1226 return true
1227 }
1228 }
1229 func rewriteValue_OpDiv16(v *ssa.Value) bool {
1230 v_1 := v.Args[1]
1231 v_0 := v.Args[0]
1232 b := v.Block
1233 typ := &b.Func.Config.Types
1234
1235
1236 for {
1237 if ssa.AuxIntToBool(v.AuxInt) != false {
1238 break
1239 }
1240 x := v_0
1241 y := v_1
1242 v.Reset(ssaop.OpRISCV64DIVW)
1243 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to32, typ.Int32)
1244 v0.AddArg(x)
1245 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt16to32, typ.Int32)
1246 v1.AddArg(y)
1247 v.AddArg2(v0, v1)
1248 return true
1249 }
1250 return false
1251 }
1252 func rewriteValue_OpDiv16u(v *ssa.Value) bool {
1253 v_1 := v.Args[1]
1254 v_0 := v.Args[0]
1255 b := v.Block
1256 typ := &b.Func.Config.Types
1257
1258
1259 for {
1260 x := v_0
1261 y := v_1
1262 v.Reset(ssaop.OpRISCV64DIVUW)
1263 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.UInt32)
1264 v0.AddArg(x)
1265 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.UInt32)
1266 v1.AddArg(y)
1267 v.AddArg2(v0, v1)
1268 return true
1269 }
1270 }
1271 func rewriteValue_OpDiv32(v *ssa.Value) bool {
1272 v_1 := v.Args[1]
1273 v_0 := v.Args[0]
1274
1275
1276 for {
1277 if ssa.AuxIntToBool(v.AuxInt) != false {
1278 break
1279 }
1280 x := v_0
1281 y := v_1
1282 v.Reset(ssaop.OpRISCV64DIVW)
1283 v.AddArg2(x, y)
1284 return true
1285 }
1286 return false
1287 }
1288 func rewriteValue_OpDiv64(v *ssa.Value) bool {
1289 v_1 := v.Args[1]
1290 v_0 := v.Args[0]
1291
1292
1293 for {
1294 if ssa.AuxIntToBool(v.AuxInt) != false {
1295 break
1296 }
1297 x := v_0
1298 y := v_1
1299 v.Reset(ssaop.OpRISCV64DIV)
1300 v.AddArg2(x, y)
1301 return true
1302 }
1303 return false
1304 }
1305 func rewriteValue_OpDiv8(v *ssa.Value) bool {
1306 v_1 := v.Args[1]
1307 v_0 := v.Args[0]
1308 b := v.Block
1309 typ := &b.Func.Config.Types
1310
1311
1312 for {
1313 x := v_0
1314 y := v_1
1315 v.Reset(ssaop.OpRISCV64DIVW)
1316 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to32, typ.Int32)
1317 v0.AddArg(x)
1318 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt8to32, typ.Int32)
1319 v1.AddArg(y)
1320 v.AddArg2(v0, v1)
1321 return true
1322 }
1323 }
1324 func rewriteValue_OpDiv8u(v *ssa.Value) bool {
1325 v_1 := v.Args[1]
1326 v_0 := v.Args[0]
1327 b := v.Block
1328 typ := &b.Func.Config.Types
1329
1330
1331 for {
1332 x := v_0
1333 y := v_1
1334 v.Reset(ssaop.OpRISCV64DIVUW)
1335 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
1336 v0.AddArg(x)
1337 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
1338 v1.AddArg(y)
1339 v.AddArg2(v0, v1)
1340 return true
1341 }
1342 }
1343 func rewriteValue_OpEq16(v *ssa.Value) bool {
1344 v_1 := v.Args[1]
1345 v_0 := v.Args[0]
1346 b := v.Block
1347 typ := &b.Func.Config.Types
1348
1349
1350 for {
1351 x := v_0
1352 y := v_1
1353 v.Reset(ssaop.OpRISCV64SEQZ)
1354 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, x.Type)
1355 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1356 v1.AddArg(x)
1357 v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1358 v2.AddArg(y)
1359 v0.AddArg2(v1, v2)
1360 v.AddArg(v0)
1361 return true
1362 }
1363 }
1364 func rewriteValue_OpEq32(v *ssa.Value) bool {
1365 v_1 := v.Args[1]
1366 v_0 := v.Args[0]
1367 b := v.Block
1368 typ := &b.Func.Config.Types
1369
1370
1371
1372 for {
1373 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1374 x := v_0
1375 y := v_1
1376 if !(x.Type.IsSigned()) {
1377 continue
1378 }
1379 v.Reset(ssaop.OpRISCV64SEQZ)
1380 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, x.Type)
1381 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1382 v1.AddArg(x)
1383 v2 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1384 v2.AddArg(y)
1385 v0.AddArg2(v1, v2)
1386 v.AddArg(v0)
1387 return true
1388 }
1389 break
1390 }
1391
1392
1393
1394 for {
1395 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1396 x := v_0
1397 y := v_1
1398 if !(!x.Type.IsSigned()) {
1399 continue
1400 }
1401 v.Reset(ssaop.OpRISCV64SEQZ)
1402 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, x.Type)
1403 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1404 v1.AddArg(x)
1405 v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1406 v2.AddArg(y)
1407 v0.AddArg2(v1, v2)
1408 v.AddArg(v0)
1409 return true
1410 }
1411 break
1412 }
1413 return false
1414 }
1415 func rewriteValue_OpEq64(v *ssa.Value) bool {
1416 v_1 := v.Args[1]
1417 v_0 := v.Args[0]
1418 b := v.Block
1419
1420
1421 for {
1422 x := v_0
1423 y := v_1
1424 v.Reset(ssaop.OpRISCV64SEQZ)
1425 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, x.Type)
1426 v0.AddArg2(x, y)
1427 v.AddArg(v0)
1428 return true
1429 }
1430 }
1431 func rewriteValue_OpEq8(v *ssa.Value) bool {
1432 v_1 := v.Args[1]
1433 v_0 := v.Args[0]
1434 b := v.Block
1435 typ := &b.Func.Config.Types
1436
1437
1438 for {
1439 x := v_0
1440 y := v_1
1441 v.Reset(ssaop.OpRISCV64SEQZ)
1442 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, x.Type)
1443 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
1444 v1.AddArg(x)
1445 v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
1446 v2.AddArg(y)
1447 v0.AddArg2(v1, v2)
1448 v.AddArg(v0)
1449 return true
1450 }
1451 }
1452 func rewriteValue_OpEqB(v *ssa.Value) bool {
1453 v_1 := v.Args[1]
1454 v_0 := v.Args[0]
1455 b := v.Block
1456 typ := &b.Func.Config.Types
1457
1458
1459 for {
1460 x := v_0
1461 y := v_1
1462 v.Reset(ssaop.OpRISCV64SEQZ)
1463 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.Bool)
1464 v0.AddArg2(x, y)
1465 v.AddArg(v0)
1466 return true
1467 }
1468 }
1469 func rewriteValue_OpEqPtr(v *ssa.Value) bool {
1470 v_1 := v.Args[1]
1471 v_0 := v.Args[0]
1472 b := v.Block
1473 typ := &b.Func.Config.Types
1474
1475
1476 for {
1477 x := v_0
1478 y := v_1
1479 v.Reset(ssaop.OpRISCV64SEQZ)
1480 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.Uintptr)
1481 v0.AddArg2(x, y)
1482 v.AddArg(v0)
1483 return true
1484 }
1485 }
1486 func rewriteValue_OpHmul32(v *ssa.Value) bool {
1487 v_1 := v.Args[1]
1488 v_0 := v.Args[0]
1489 b := v.Block
1490 typ := &b.Func.Config.Types
1491
1492
1493 for {
1494 x := v_0
1495 y := v_1
1496 v.Reset(ssaop.OpRISCV64SRAI)
1497 v.AuxInt = ssa.Int64ToAuxInt(32)
1498 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MUL, typ.Int64)
1499 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1500 v1.AddArg(x)
1501 v2 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1502 v2.AddArg(y)
1503 v0.AddArg2(v1, v2)
1504 v.AddArg(v0)
1505 return true
1506 }
1507 }
1508 func rewriteValue_OpHmul32u(v *ssa.Value) bool {
1509 v_1 := v.Args[1]
1510 v_0 := v.Args[0]
1511 b := v.Block
1512 typ := &b.Func.Config.Types
1513
1514
1515 for {
1516 x := v_0
1517 y := v_1
1518 v.Reset(ssaop.OpRISCV64SRLI)
1519 v.AuxInt = ssa.Int64ToAuxInt(32)
1520 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MUL, typ.Int64)
1521 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1522 v1.AddArg(x)
1523 v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1524 v2.AddArg(y)
1525 v0.AddArg2(v1, v2)
1526 v.AddArg(v0)
1527 return true
1528 }
1529 }
1530 func rewriteValue_OpLeq16(v *ssa.Value) bool {
1531 v_1 := v.Args[1]
1532 v_0 := v.Args[0]
1533 b := v.Block
1534 typ := &b.Func.Config.Types
1535
1536
1537 for {
1538 x := v_0
1539 y := v_1
1540 v.Reset(ssaop.OpNot)
1541 v0 := b.NewValue0(v.Pos, ssaop.OpLess16, typ.Bool)
1542 v0.AddArg2(y, x)
1543 v.AddArg(v0)
1544 return true
1545 }
1546 }
1547 func rewriteValue_OpLeq16U(v *ssa.Value) bool {
1548 v_1 := v.Args[1]
1549 v_0 := v.Args[0]
1550 b := v.Block
1551 typ := &b.Func.Config.Types
1552
1553
1554 for {
1555 x := v_0
1556 y := v_1
1557 v.Reset(ssaop.OpNot)
1558 v0 := b.NewValue0(v.Pos, ssaop.OpLess16U, typ.Bool)
1559 v0.AddArg2(y, x)
1560 v.AddArg(v0)
1561 return true
1562 }
1563 }
1564 func rewriteValue_OpLeq32(v *ssa.Value) bool {
1565 v_1 := v.Args[1]
1566 v_0 := v.Args[0]
1567 b := v.Block
1568 typ := &b.Func.Config.Types
1569
1570
1571 for {
1572 x := v_0
1573 y := v_1
1574 v.Reset(ssaop.OpNot)
1575 v0 := b.NewValue0(v.Pos, ssaop.OpLess32, typ.Bool)
1576 v0.AddArg2(y, x)
1577 v.AddArg(v0)
1578 return true
1579 }
1580 }
1581 func rewriteValue_OpLeq32U(v *ssa.Value) bool {
1582 v_1 := v.Args[1]
1583 v_0 := v.Args[0]
1584 b := v.Block
1585 typ := &b.Func.Config.Types
1586
1587
1588 for {
1589 x := v_0
1590 y := v_1
1591 v.Reset(ssaop.OpNot)
1592 v0 := b.NewValue0(v.Pos, ssaop.OpLess32U, typ.Bool)
1593 v0.AddArg2(y, x)
1594 v.AddArg(v0)
1595 return true
1596 }
1597 }
1598 func rewriteValue_OpLeq64(v *ssa.Value) bool {
1599 v_1 := v.Args[1]
1600 v_0 := v.Args[0]
1601 b := v.Block
1602 typ := &b.Func.Config.Types
1603
1604
1605 for {
1606 x := v_0
1607 y := v_1
1608 v.Reset(ssaop.OpNot)
1609 v0 := b.NewValue0(v.Pos, ssaop.OpLess64, typ.Bool)
1610 v0.AddArg2(y, x)
1611 v.AddArg(v0)
1612 return true
1613 }
1614 }
1615 func rewriteValue_OpLeq64U(v *ssa.Value) bool {
1616 v_1 := v.Args[1]
1617 v_0 := v.Args[0]
1618 b := v.Block
1619 typ := &b.Func.Config.Types
1620
1621
1622 for {
1623 x := v_0
1624 y := v_1
1625 v.Reset(ssaop.OpNot)
1626 v0 := b.NewValue0(v.Pos, ssaop.OpLess64U, typ.Bool)
1627 v0.AddArg2(y, x)
1628 v.AddArg(v0)
1629 return true
1630 }
1631 }
1632 func rewriteValue_OpLeq8(v *ssa.Value) bool {
1633 v_1 := v.Args[1]
1634 v_0 := v.Args[0]
1635 b := v.Block
1636 typ := &b.Func.Config.Types
1637
1638
1639 for {
1640 x := v_0
1641 y := v_1
1642 v.Reset(ssaop.OpNot)
1643 v0 := b.NewValue0(v.Pos, ssaop.OpLess8, typ.Bool)
1644 v0.AddArg2(y, x)
1645 v.AddArg(v0)
1646 return true
1647 }
1648 }
1649 func rewriteValue_OpLeq8U(v *ssa.Value) bool {
1650 v_1 := v.Args[1]
1651 v_0 := v.Args[0]
1652 b := v.Block
1653 typ := &b.Func.Config.Types
1654
1655
1656 for {
1657 x := v_0
1658 y := v_1
1659 v.Reset(ssaop.OpNot)
1660 v0 := b.NewValue0(v.Pos, ssaop.OpLess8U, typ.Bool)
1661 v0.AddArg2(y, x)
1662 v.AddArg(v0)
1663 return true
1664 }
1665 }
1666 func rewriteValue_OpLess16(v *ssa.Value) bool {
1667 v_1 := v.Args[1]
1668 v_0 := v.Args[0]
1669 b := v.Block
1670 typ := &b.Func.Config.Types
1671
1672
1673 for {
1674 x := v_0
1675 y := v_1
1676 v.Reset(ssaop.OpRISCV64SLT)
1677 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
1678 v0.AddArg(x)
1679 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
1680 v1.AddArg(y)
1681 v.AddArg2(v0, v1)
1682 return true
1683 }
1684 }
1685 func rewriteValue_OpLess16U(v *ssa.Value) bool {
1686 v_1 := v.Args[1]
1687 v_0 := v.Args[0]
1688 b := v.Block
1689 typ := &b.Func.Config.Types
1690
1691
1692 for {
1693 x := v_0
1694 y := v_1
1695 v.Reset(ssaop.OpRISCV64SLTU)
1696 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1697 v0.AddArg(x)
1698 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1699 v1.AddArg(y)
1700 v.AddArg2(v0, v1)
1701 return true
1702 }
1703 }
1704 func rewriteValue_OpLess32(v *ssa.Value) bool {
1705 v_1 := v.Args[1]
1706 v_0 := v.Args[0]
1707 b := v.Block
1708 typ := &b.Func.Config.Types
1709
1710
1711 for {
1712 x := v_0
1713 y := v_1
1714 v.Reset(ssaop.OpRISCV64SLT)
1715 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1716 v0.AddArg(x)
1717 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt32to64, typ.Int64)
1718 v1.AddArg(y)
1719 v.AddArg2(v0, v1)
1720 return true
1721 }
1722 }
1723 func rewriteValue_OpLess32U(v *ssa.Value) bool {
1724 v_1 := v.Args[1]
1725 v_0 := v.Args[0]
1726 b := v.Block
1727 typ := &b.Func.Config.Types
1728
1729
1730 for {
1731 x := v_0
1732 y := v_1
1733 v.Reset(ssaop.OpRISCV64SLTU)
1734 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1735 v0.AddArg(x)
1736 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
1737 v1.AddArg(y)
1738 v.AddArg2(v0, v1)
1739 return true
1740 }
1741 }
1742 func rewriteValue_OpLess8(v *ssa.Value) bool {
1743 v_1 := v.Args[1]
1744 v_0 := v.Args[0]
1745 b := v.Block
1746 typ := &b.Func.Config.Types
1747
1748
1749 for {
1750 x := v_0
1751 y := v_1
1752 v.Reset(ssaop.OpRISCV64SLT)
1753 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
1754 v0.AddArg(x)
1755 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
1756 v1.AddArg(y)
1757 v.AddArg2(v0, v1)
1758 return true
1759 }
1760 }
1761 func rewriteValue_OpLess8U(v *ssa.Value) bool {
1762 v_1 := v.Args[1]
1763 v_0 := v.Args[0]
1764 b := v.Block
1765 typ := &b.Func.Config.Types
1766
1767
1768 for {
1769 x := v_0
1770 y := v_1
1771 v.Reset(ssaop.OpRISCV64SLTU)
1772 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
1773 v0.AddArg(x)
1774 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
1775 v1.AddArg(y)
1776 v.AddArg2(v0, v1)
1777 return true
1778 }
1779 }
1780 func rewriteValue_OpLoad(v *ssa.Value) bool {
1781 v_1 := v.Args[1]
1782 v_0 := v.Args[0]
1783
1784
1785
1786 for {
1787 t := v.Type
1788 ptr := v_0
1789 mem := v_1
1790 if !(t.IsBoolean()) {
1791 break
1792 }
1793 v.Reset(ssaop.OpRISCV64MOVBUload)
1794 v.AddArg2(ptr, mem)
1795 return true
1796 }
1797
1798
1799
1800 for {
1801 t := v.Type
1802 ptr := v_0
1803 mem := v_1
1804 if !(ssa.Is8BitInt(t) && t.IsSigned()) {
1805 break
1806 }
1807 v.Reset(ssaop.OpRISCV64MOVBload)
1808 v.AddArg2(ptr, mem)
1809 return true
1810 }
1811
1812
1813
1814 for {
1815 t := v.Type
1816 ptr := v_0
1817 mem := v_1
1818 if !(ssa.Is8BitInt(t) && !t.IsSigned()) {
1819 break
1820 }
1821 v.Reset(ssaop.OpRISCV64MOVBUload)
1822 v.AddArg2(ptr, mem)
1823 return true
1824 }
1825
1826
1827
1828 for {
1829 t := v.Type
1830 ptr := v_0
1831 mem := v_1
1832 if !(ssa.Is16BitInt(t) && t.IsSigned()) {
1833 break
1834 }
1835 v.Reset(ssaop.OpRISCV64MOVHload)
1836 v.AddArg2(ptr, mem)
1837 return true
1838 }
1839
1840
1841
1842 for {
1843 t := v.Type
1844 ptr := v_0
1845 mem := v_1
1846 if !(ssa.Is16BitInt(t) && !t.IsSigned()) {
1847 break
1848 }
1849 v.Reset(ssaop.OpRISCV64MOVHUload)
1850 v.AddArg2(ptr, mem)
1851 return true
1852 }
1853
1854
1855
1856 for {
1857 t := v.Type
1858 ptr := v_0
1859 mem := v_1
1860 if !(ssa.Is32BitInt(t) && t.IsSigned()) {
1861 break
1862 }
1863 v.Reset(ssaop.OpRISCV64MOVWload)
1864 v.AddArg2(ptr, mem)
1865 return true
1866 }
1867
1868
1869
1870 for {
1871 t := v.Type
1872 ptr := v_0
1873 mem := v_1
1874 if !(ssa.Is32BitInt(t) && !t.IsSigned()) {
1875 break
1876 }
1877 v.Reset(ssaop.OpRISCV64MOVWUload)
1878 v.AddArg2(ptr, mem)
1879 return true
1880 }
1881
1882
1883
1884 for {
1885 t := v.Type
1886 ptr := v_0
1887 mem := v_1
1888 if !(ssa.Is64BitInt(t) || ssa.IsPtr(t)) {
1889 break
1890 }
1891 v.Reset(ssaop.OpRISCV64MOVDload)
1892 v.AddArg2(ptr, mem)
1893 return true
1894 }
1895
1896
1897
1898 for {
1899 t := v.Type
1900 ptr := v_0
1901 mem := v_1
1902 if !(ssa.Is32BitFloat(t)) {
1903 break
1904 }
1905 v.Reset(ssaop.OpRISCV64FMOVWload)
1906 v.AddArg2(ptr, mem)
1907 return true
1908 }
1909
1910
1911
1912 for {
1913 t := v.Type
1914 ptr := v_0
1915 mem := v_1
1916 if !(ssa.Is64BitFloat(t)) {
1917 break
1918 }
1919 v.Reset(ssaop.OpRISCV64FMOVDload)
1920 v.AddArg2(ptr, mem)
1921 return true
1922 }
1923 return false
1924 }
1925 func rewriteValue_OpLocalAddr(v *ssa.Value) bool {
1926 v_1 := v.Args[1]
1927 v_0 := v.Args[0]
1928 b := v.Block
1929 typ := &b.Func.Config.Types
1930
1931
1932
1933 for {
1934 t := v.Type
1935 sym := ssa.AuxToSym(v.Aux)
1936 base := v_0
1937 mem := v_1
1938 if !(t.Elem().HasPointers()) {
1939 break
1940 }
1941 v.Reset(ssaop.OpRISCV64MOVaddr)
1942 v.Aux = ssa.SymToAux(sym)
1943 v0 := b.NewValue0(v.Pos, ssaop.OpSPanchored, typ.Uintptr)
1944 v0.AddArg2(base, mem)
1945 v.AddArg(v0)
1946 return true
1947 }
1948
1949
1950
1951 for {
1952 t := v.Type
1953 sym := ssa.AuxToSym(v.Aux)
1954 base := v_0
1955 if !(!t.Elem().HasPointers()) {
1956 break
1957 }
1958 v.Reset(ssaop.OpRISCV64MOVaddr)
1959 v.Aux = ssa.SymToAux(sym)
1960 v.AddArg(base)
1961 return true
1962 }
1963 return false
1964 }
1965 func rewriteValue_OpLsh16x16(v *ssa.Value) bool {
1966 v_1 := v.Args[1]
1967 v_0 := v.Args[0]
1968 b := v.Block
1969 typ := &b.Func.Config.Types
1970
1971
1972
1973 for {
1974 t := v.Type
1975 x := v_0
1976 y := v_1
1977 if !(!ssa.ShiftIsBounded(v)) {
1978 break
1979 }
1980 v.Reset(ssaop.OpRISCV64AND)
1981 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
1982 v0.AddArg2(x, y)
1983 v1 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
1984 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
1985 v2.AuxInt = ssa.Int64ToAuxInt(64)
1986 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
1987 v3.AddArg(y)
1988 v2.AddArg(v3)
1989 v1.AddArg(v2)
1990 v.AddArg2(v0, v1)
1991 return true
1992 }
1993
1994
1995
1996 for {
1997 x := v_0
1998 y := v_1
1999 if !(ssa.ShiftIsBounded(v)) {
2000 break
2001 }
2002 v.Reset(ssaop.OpRISCV64SLL)
2003 v.AddArg2(x, y)
2004 return true
2005 }
2006 return false
2007 }
2008 func rewriteValue_OpLsh16x32(v *ssa.Value) bool {
2009 v_1 := v.Args[1]
2010 v_0 := v.Args[0]
2011 b := v.Block
2012 typ := &b.Func.Config.Types
2013
2014
2015
2016 for {
2017 t := v.Type
2018 x := v_0
2019 y := v_1
2020 if !(!ssa.ShiftIsBounded(v)) {
2021 break
2022 }
2023 v.Reset(ssaop.OpRISCV64AND)
2024 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2025 v0.AddArg2(x, y)
2026 v1 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
2027 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2028 v2.AuxInt = ssa.Int64ToAuxInt(64)
2029 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
2030 v3.AddArg(y)
2031 v2.AddArg(v3)
2032 v1.AddArg(v2)
2033 v.AddArg2(v0, v1)
2034 return true
2035 }
2036
2037
2038
2039 for {
2040 x := v_0
2041 y := v_1
2042 if !(ssa.ShiftIsBounded(v)) {
2043 break
2044 }
2045 v.Reset(ssaop.OpRISCV64SLL)
2046 v.AddArg2(x, y)
2047 return true
2048 }
2049 return false
2050 }
2051 func rewriteValue_OpLsh16x64(v *ssa.Value) bool {
2052 v_1 := v.Args[1]
2053 v_0 := v.Args[0]
2054 b := v.Block
2055
2056
2057
2058 for {
2059 t := v.Type
2060 x := v_0
2061 y := v_1
2062 if !(!ssa.ShiftIsBounded(v)) {
2063 break
2064 }
2065 v.Reset(ssaop.OpRISCV64AND)
2066 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2067 v0.AddArg2(x, y)
2068 v1 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
2069 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2070 v2.AuxInt = ssa.Int64ToAuxInt(64)
2071 v2.AddArg(y)
2072 v1.AddArg(v2)
2073 v.AddArg2(v0, v1)
2074 return true
2075 }
2076
2077
2078
2079 for {
2080 x := v_0
2081 y := v_1
2082 if !(ssa.ShiftIsBounded(v)) {
2083 break
2084 }
2085 v.Reset(ssaop.OpRISCV64SLL)
2086 v.AddArg2(x, y)
2087 return true
2088 }
2089 return false
2090 }
2091 func rewriteValue_OpLsh16x8(v *ssa.Value) bool {
2092 v_1 := v.Args[1]
2093 v_0 := v.Args[0]
2094 b := v.Block
2095 typ := &b.Func.Config.Types
2096
2097
2098
2099 for {
2100 t := v.Type
2101 x := v_0
2102 y := v_1
2103 if !(!ssa.ShiftIsBounded(v)) {
2104 break
2105 }
2106 v.Reset(ssaop.OpRISCV64AND)
2107 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2108 v0.AddArg2(x, y)
2109 v1 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
2110 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2111 v2.AuxInt = ssa.Int64ToAuxInt(64)
2112 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
2113 v3.AddArg(y)
2114 v2.AddArg(v3)
2115 v1.AddArg(v2)
2116 v.AddArg2(v0, v1)
2117 return true
2118 }
2119
2120
2121
2122 for {
2123 x := v_0
2124 y := v_1
2125 if !(ssa.ShiftIsBounded(v)) {
2126 break
2127 }
2128 v.Reset(ssaop.OpRISCV64SLL)
2129 v.AddArg2(x, y)
2130 return true
2131 }
2132 return false
2133 }
2134 func rewriteValue_OpLsh32x16(v *ssa.Value) bool {
2135 v_1 := v.Args[1]
2136 v_0 := v.Args[0]
2137 b := v.Block
2138 typ := &b.Func.Config.Types
2139
2140
2141
2142 for {
2143 t := v.Type
2144 x := v_0
2145 y := v_1
2146 if !(!ssa.ShiftIsBounded(v)) {
2147 break
2148 }
2149 v.Reset(ssaop.OpRISCV64AND)
2150 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLW, t)
2151 v0.AddArg2(x, y)
2152 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
2153 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2154 v2.AuxInt = ssa.Int64ToAuxInt(32)
2155 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
2156 v3.AddArg(y)
2157 v2.AddArg(v3)
2158 v1.AddArg(v2)
2159 v.AddArg2(v0, v1)
2160 return true
2161 }
2162
2163
2164
2165 for {
2166 x := v_0
2167 y := v_1
2168 if !(ssa.ShiftIsBounded(v)) {
2169 break
2170 }
2171 v.Reset(ssaop.OpRISCV64SLLW)
2172 v.AddArg2(x, y)
2173 return true
2174 }
2175 return false
2176 }
2177 func rewriteValue_OpLsh32x32(v *ssa.Value) bool {
2178 v_1 := v.Args[1]
2179 v_0 := v.Args[0]
2180 b := v.Block
2181 typ := &b.Func.Config.Types
2182
2183
2184
2185 for {
2186 t := v.Type
2187 x := v_0
2188 y := v_1
2189 if !(!ssa.ShiftIsBounded(v)) {
2190 break
2191 }
2192 v.Reset(ssaop.OpRISCV64AND)
2193 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLW, t)
2194 v0.AddArg2(x, y)
2195 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
2196 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2197 v2.AuxInt = ssa.Int64ToAuxInt(32)
2198 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
2199 v3.AddArg(y)
2200 v2.AddArg(v3)
2201 v1.AddArg(v2)
2202 v.AddArg2(v0, v1)
2203 return true
2204 }
2205
2206
2207
2208 for {
2209 x := v_0
2210 y := v_1
2211 if !(ssa.ShiftIsBounded(v)) {
2212 break
2213 }
2214 v.Reset(ssaop.OpRISCV64SLLW)
2215 v.AddArg2(x, y)
2216 return true
2217 }
2218 return false
2219 }
2220 func rewriteValue_OpLsh32x64(v *ssa.Value) bool {
2221 v_1 := v.Args[1]
2222 v_0 := v.Args[0]
2223 b := v.Block
2224
2225
2226
2227 for {
2228 t := v.Type
2229 x := v_0
2230 y := v_1
2231 if !(!ssa.ShiftIsBounded(v)) {
2232 break
2233 }
2234 v.Reset(ssaop.OpRISCV64AND)
2235 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLW, t)
2236 v0.AddArg2(x, y)
2237 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
2238 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2239 v2.AuxInt = ssa.Int64ToAuxInt(32)
2240 v2.AddArg(y)
2241 v1.AddArg(v2)
2242 v.AddArg2(v0, v1)
2243 return true
2244 }
2245
2246
2247
2248 for {
2249 x := v_0
2250 y := v_1
2251 if !(ssa.ShiftIsBounded(v)) {
2252 break
2253 }
2254 v.Reset(ssaop.OpRISCV64SLLW)
2255 v.AddArg2(x, y)
2256 return true
2257 }
2258 return false
2259 }
2260 func rewriteValue_OpLsh32x8(v *ssa.Value) bool {
2261 v_1 := v.Args[1]
2262 v_0 := v.Args[0]
2263 b := v.Block
2264 typ := &b.Func.Config.Types
2265
2266
2267
2268 for {
2269 t := v.Type
2270 x := v_0
2271 y := v_1
2272 if !(!ssa.ShiftIsBounded(v)) {
2273 break
2274 }
2275 v.Reset(ssaop.OpRISCV64AND)
2276 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLW, t)
2277 v0.AddArg2(x, y)
2278 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
2279 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2280 v2.AuxInt = ssa.Int64ToAuxInt(32)
2281 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
2282 v3.AddArg(y)
2283 v2.AddArg(v3)
2284 v1.AddArg(v2)
2285 v.AddArg2(v0, v1)
2286 return true
2287 }
2288
2289
2290
2291 for {
2292 x := v_0
2293 y := v_1
2294 if !(ssa.ShiftIsBounded(v)) {
2295 break
2296 }
2297 v.Reset(ssaop.OpRISCV64SLLW)
2298 v.AddArg2(x, y)
2299 return true
2300 }
2301 return false
2302 }
2303 func rewriteValue_OpLsh64x16(v *ssa.Value) bool {
2304 v_1 := v.Args[1]
2305 v_0 := v.Args[0]
2306 b := v.Block
2307 typ := &b.Func.Config.Types
2308
2309
2310
2311 for {
2312 t := v.Type
2313 x := v_0
2314 y := v_1
2315 if !(!ssa.ShiftIsBounded(v)) {
2316 break
2317 }
2318 v.Reset(ssaop.OpRISCV64AND)
2319 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2320 v0.AddArg2(x, y)
2321 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
2322 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2323 v2.AuxInt = ssa.Int64ToAuxInt(64)
2324 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
2325 v3.AddArg(y)
2326 v2.AddArg(v3)
2327 v1.AddArg(v2)
2328 v.AddArg2(v0, v1)
2329 return true
2330 }
2331
2332
2333
2334 for {
2335 x := v_0
2336 y := v_1
2337 if !(ssa.ShiftIsBounded(v)) {
2338 break
2339 }
2340 v.Reset(ssaop.OpRISCV64SLL)
2341 v.AddArg2(x, y)
2342 return true
2343 }
2344 return false
2345 }
2346 func rewriteValue_OpLsh64x32(v *ssa.Value) bool {
2347 v_1 := v.Args[1]
2348 v_0 := v.Args[0]
2349 b := v.Block
2350 typ := &b.Func.Config.Types
2351
2352
2353
2354 for {
2355 t := v.Type
2356 x := v_0
2357 y := v_1
2358 if !(!ssa.ShiftIsBounded(v)) {
2359 break
2360 }
2361 v.Reset(ssaop.OpRISCV64AND)
2362 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2363 v0.AddArg2(x, y)
2364 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
2365 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2366 v2.AuxInt = ssa.Int64ToAuxInt(64)
2367 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
2368 v3.AddArg(y)
2369 v2.AddArg(v3)
2370 v1.AddArg(v2)
2371 v.AddArg2(v0, v1)
2372 return true
2373 }
2374
2375
2376
2377 for {
2378 x := v_0
2379 y := v_1
2380 if !(ssa.ShiftIsBounded(v)) {
2381 break
2382 }
2383 v.Reset(ssaop.OpRISCV64SLL)
2384 v.AddArg2(x, y)
2385 return true
2386 }
2387 return false
2388 }
2389 func rewriteValue_OpLsh64x64(v *ssa.Value) bool {
2390 v_1 := v.Args[1]
2391 v_0 := v.Args[0]
2392 b := v.Block
2393
2394
2395
2396 for {
2397 t := v.Type
2398 x := v_0
2399 y := v_1
2400 if !(!ssa.ShiftIsBounded(v)) {
2401 break
2402 }
2403 v.Reset(ssaop.OpRISCV64AND)
2404 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2405 v0.AddArg2(x, y)
2406 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
2407 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2408 v2.AuxInt = ssa.Int64ToAuxInt(64)
2409 v2.AddArg(y)
2410 v1.AddArg(v2)
2411 v.AddArg2(v0, v1)
2412 return true
2413 }
2414
2415
2416
2417 for {
2418 x := v_0
2419 y := v_1
2420 if !(ssa.ShiftIsBounded(v)) {
2421 break
2422 }
2423 v.Reset(ssaop.OpRISCV64SLL)
2424 v.AddArg2(x, y)
2425 return true
2426 }
2427 return false
2428 }
2429 func rewriteValue_OpLsh64x8(v *ssa.Value) bool {
2430 v_1 := v.Args[1]
2431 v_0 := v.Args[0]
2432 b := v.Block
2433 typ := &b.Func.Config.Types
2434
2435
2436
2437 for {
2438 t := v.Type
2439 x := v_0
2440 y := v_1
2441 if !(!ssa.ShiftIsBounded(v)) {
2442 break
2443 }
2444 v.Reset(ssaop.OpRISCV64AND)
2445 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2446 v0.AddArg2(x, y)
2447 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
2448 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2449 v2.AuxInt = ssa.Int64ToAuxInt(64)
2450 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
2451 v3.AddArg(y)
2452 v2.AddArg(v3)
2453 v1.AddArg(v2)
2454 v.AddArg2(v0, v1)
2455 return true
2456 }
2457
2458
2459
2460 for {
2461 x := v_0
2462 y := v_1
2463 if !(ssa.ShiftIsBounded(v)) {
2464 break
2465 }
2466 v.Reset(ssaop.OpRISCV64SLL)
2467 v.AddArg2(x, y)
2468 return true
2469 }
2470 return false
2471 }
2472 func rewriteValue_OpLsh8x16(v *ssa.Value) bool {
2473 v_1 := v.Args[1]
2474 v_0 := v.Args[0]
2475 b := v.Block
2476 typ := &b.Func.Config.Types
2477
2478
2479
2480 for {
2481 t := v.Type
2482 x := v_0
2483 y := v_1
2484 if !(!ssa.ShiftIsBounded(v)) {
2485 break
2486 }
2487 v.Reset(ssaop.OpRISCV64AND)
2488 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2489 v0.AddArg2(x, y)
2490 v1 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
2491 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2492 v2.AuxInt = ssa.Int64ToAuxInt(64)
2493 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
2494 v3.AddArg(y)
2495 v2.AddArg(v3)
2496 v1.AddArg(v2)
2497 v.AddArg2(v0, v1)
2498 return true
2499 }
2500
2501
2502
2503 for {
2504 x := v_0
2505 y := v_1
2506 if !(ssa.ShiftIsBounded(v)) {
2507 break
2508 }
2509 v.Reset(ssaop.OpRISCV64SLL)
2510 v.AddArg2(x, y)
2511 return true
2512 }
2513 return false
2514 }
2515 func rewriteValue_OpLsh8x32(v *ssa.Value) bool {
2516 v_1 := v.Args[1]
2517 v_0 := v.Args[0]
2518 b := v.Block
2519 typ := &b.Func.Config.Types
2520
2521
2522
2523 for {
2524 t := v.Type
2525 x := v_0
2526 y := v_1
2527 if !(!ssa.ShiftIsBounded(v)) {
2528 break
2529 }
2530 v.Reset(ssaop.OpRISCV64AND)
2531 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2532 v0.AddArg2(x, y)
2533 v1 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
2534 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2535 v2.AuxInt = ssa.Int64ToAuxInt(64)
2536 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
2537 v3.AddArg(y)
2538 v2.AddArg(v3)
2539 v1.AddArg(v2)
2540 v.AddArg2(v0, v1)
2541 return true
2542 }
2543
2544
2545
2546 for {
2547 x := v_0
2548 y := v_1
2549 if !(ssa.ShiftIsBounded(v)) {
2550 break
2551 }
2552 v.Reset(ssaop.OpRISCV64SLL)
2553 v.AddArg2(x, y)
2554 return true
2555 }
2556 return false
2557 }
2558 func rewriteValue_OpLsh8x64(v *ssa.Value) bool {
2559 v_1 := v.Args[1]
2560 v_0 := v.Args[0]
2561 b := v.Block
2562
2563
2564
2565 for {
2566 t := v.Type
2567 x := v_0
2568 y := v_1
2569 if !(!ssa.ShiftIsBounded(v)) {
2570 break
2571 }
2572 v.Reset(ssaop.OpRISCV64AND)
2573 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2574 v0.AddArg2(x, y)
2575 v1 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
2576 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2577 v2.AuxInt = ssa.Int64ToAuxInt(64)
2578 v2.AddArg(y)
2579 v1.AddArg(v2)
2580 v.AddArg2(v0, v1)
2581 return true
2582 }
2583
2584
2585
2586 for {
2587 x := v_0
2588 y := v_1
2589 if !(ssa.ShiftIsBounded(v)) {
2590 break
2591 }
2592 v.Reset(ssaop.OpRISCV64SLL)
2593 v.AddArg2(x, y)
2594 return true
2595 }
2596 return false
2597 }
2598 func rewriteValue_OpLsh8x8(v *ssa.Value) bool {
2599 v_1 := v.Args[1]
2600 v_0 := v.Args[0]
2601 b := v.Block
2602 typ := &b.Func.Config.Types
2603
2604
2605
2606 for {
2607 t := v.Type
2608 x := v_0
2609 y := v_1
2610 if !(!ssa.ShiftIsBounded(v)) {
2611 break
2612 }
2613 v.Reset(ssaop.OpRISCV64AND)
2614 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
2615 v0.AddArg2(x, y)
2616 v1 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
2617 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
2618 v2.AuxInt = ssa.Int64ToAuxInt(64)
2619 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
2620 v3.AddArg(y)
2621 v2.AddArg(v3)
2622 v1.AddArg(v2)
2623 v.AddArg2(v0, v1)
2624 return true
2625 }
2626
2627
2628
2629 for {
2630 x := v_0
2631 y := v_1
2632 if !(ssa.ShiftIsBounded(v)) {
2633 break
2634 }
2635 v.Reset(ssaop.OpRISCV64SLL)
2636 v.AddArg2(x, y)
2637 return true
2638 }
2639 return false
2640 }
2641 func rewriteValue_OpMax64(v *ssa.Value) bool {
2642 v_1 := v.Args[1]
2643 v_0 := v.Args[0]
2644
2645
2646
2647 for {
2648 x := v_0
2649 y := v_1
2650 if !(buildcfg.GORISCV64 >= 22) {
2651 break
2652 }
2653 v.Reset(ssaop.OpRISCV64MAX)
2654 v.AddArg2(x, y)
2655 return true
2656 }
2657 return false
2658 }
2659 func rewriteValue_OpMax64u(v *ssa.Value) bool {
2660 v_1 := v.Args[1]
2661 v_0 := v.Args[0]
2662
2663
2664
2665 for {
2666 x := v_0
2667 y := v_1
2668 if !(buildcfg.GORISCV64 >= 22) {
2669 break
2670 }
2671 v.Reset(ssaop.OpRISCV64MAXU)
2672 v.AddArg2(x, y)
2673 return true
2674 }
2675 return false
2676 }
2677 func rewriteValue_OpMin64(v *ssa.Value) bool {
2678 v_1 := v.Args[1]
2679 v_0 := v.Args[0]
2680
2681
2682
2683 for {
2684 x := v_0
2685 y := v_1
2686 if !(buildcfg.GORISCV64 >= 22) {
2687 break
2688 }
2689 v.Reset(ssaop.OpRISCV64MIN)
2690 v.AddArg2(x, y)
2691 return true
2692 }
2693 return false
2694 }
2695 func rewriteValue_OpMin64u(v *ssa.Value) bool {
2696 v_1 := v.Args[1]
2697 v_0 := v.Args[0]
2698
2699
2700
2701 for {
2702 x := v_0
2703 y := v_1
2704 if !(buildcfg.GORISCV64 >= 22) {
2705 break
2706 }
2707 v.Reset(ssaop.OpRISCV64MINU)
2708 v.AddArg2(x, y)
2709 return true
2710 }
2711 return false
2712 }
2713 func rewriteValue_OpMod16(v *ssa.Value) bool {
2714 v_1 := v.Args[1]
2715 v_0 := v.Args[0]
2716 b := v.Block
2717 typ := &b.Func.Config.Types
2718
2719
2720 for {
2721 if ssa.AuxIntToBool(v.AuxInt) != false {
2722 break
2723 }
2724 x := v_0
2725 y := v_1
2726 v.Reset(ssaop.OpRISCV64REMW)
2727 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to32, typ.Int32)
2728 v0.AddArg(x)
2729 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt16to32, typ.Int32)
2730 v1.AddArg(y)
2731 v.AddArg2(v0, v1)
2732 return true
2733 }
2734 return false
2735 }
2736 func rewriteValue_OpMod16u(v *ssa.Value) bool {
2737 v_1 := v.Args[1]
2738 v_0 := v.Args[0]
2739 b := v.Block
2740 typ := &b.Func.Config.Types
2741
2742
2743 for {
2744 x := v_0
2745 y := v_1
2746 v.Reset(ssaop.OpRISCV64REMUW)
2747 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.UInt32)
2748 v0.AddArg(x)
2749 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.UInt32)
2750 v1.AddArg(y)
2751 v.AddArg2(v0, v1)
2752 return true
2753 }
2754 }
2755 func rewriteValue_OpMod32(v *ssa.Value) bool {
2756 v_1 := v.Args[1]
2757 v_0 := v.Args[0]
2758
2759
2760 for {
2761 if ssa.AuxIntToBool(v.AuxInt) != false {
2762 break
2763 }
2764 x := v_0
2765 y := v_1
2766 v.Reset(ssaop.OpRISCV64REMW)
2767 v.AddArg2(x, y)
2768 return true
2769 }
2770 return false
2771 }
2772 func rewriteValue_OpMod64(v *ssa.Value) bool {
2773 v_1 := v.Args[1]
2774 v_0 := v.Args[0]
2775
2776
2777 for {
2778 if ssa.AuxIntToBool(v.AuxInt) != false {
2779 break
2780 }
2781 x := v_0
2782 y := v_1
2783 v.Reset(ssaop.OpRISCV64REM)
2784 v.AddArg2(x, y)
2785 return true
2786 }
2787 return false
2788 }
2789 func rewriteValue_OpMod8(v *ssa.Value) bool {
2790 v_1 := v.Args[1]
2791 v_0 := v.Args[0]
2792 b := v.Block
2793 typ := &b.Func.Config.Types
2794
2795
2796 for {
2797 x := v_0
2798 y := v_1
2799 v.Reset(ssaop.OpRISCV64REMW)
2800 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to32, typ.Int32)
2801 v0.AddArg(x)
2802 v1 := b.NewValue0(v.Pos, ssaop.OpSignExt8to32, typ.Int32)
2803 v1.AddArg(y)
2804 v.AddArg2(v0, v1)
2805 return true
2806 }
2807 }
2808 func rewriteValue_OpMod8u(v *ssa.Value) bool {
2809 v_1 := v.Args[1]
2810 v_0 := v.Args[0]
2811 b := v.Block
2812 typ := &b.Func.Config.Types
2813
2814
2815 for {
2816 x := v_0
2817 y := v_1
2818 v.Reset(ssaop.OpRISCV64REMUW)
2819 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
2820 v0.AddArg(x)
2821 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32)
2822 v1.AddArg(y)
2823 v.AddArg2(v0, v1)
2824 return true
2825 }
2826 }
2827 func rewriteValue_OpMove(v *ssa.Value) bool {
2828 v_2 := v.Args[2]
2829 v_1 := v.Args[1]
2830 v_0 := v.Args[0]
2831 b := v.Block
2832 config := b.Func.Config
2833 typ := &b.Func.Config.Types
2834
2835
2836 for {
2837 if ssa.AuxIntToInt64(v.AuxInt) != 0 {
2838 break
2839 }
2840 mem := v_2
2841 v.CopyOf(mem)
2842 return true
2843 }
2844
2845
2846 for {
2847 if ssa.AuxIntToInt64(v.AuxInt) != 1 {
2848 break
2849 }
2850 dst := v_0
2851 src := v_1
2852 mem := v_2
2853 v.Reset(ssaop.OpRISCV64MOVBstore)
2854 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2855 v0.AddArg2(src, mem)
2856 v.AddArg3(dst, v0, mem)
2857 return true
2858 }
2859
2860
2861
2862 for {
2863 if ssa.AuxIntToInt64(v.AuxInt) != 2 {
2864 break
2865 }
2866 t := ssa.AuxToType(v.Aux)
2867 dst := v_0
2868 src := v_1
2869 mem := v_2
2870 if !(t.Alignment()%2 == 0) {
2871 break
2872 }
2873 v.Reset(ssaop.OpRISCV64MOVHstore)
2874 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
2875 v0.AddArg2(src, mem)
2876 v.AddArg3(dst, v0, mem)
2877 return true
2878 }
2879
2880
2881 for {
2882 if ssa.AuxIntToInt64(v.AuxInt) != 2 {
2883 break
2884 }
2885 dst := v_0
2886 src := v_1
2887 mem := v_2
2888 v.Reset(ssaop.OpRISCV64MOVBstore)
2889 v.AuxInt = ssa.Int32ToAuxInt(1)
2890 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2891 v0.AuxInt = ssa.Int32ToAuxInt(1)
2892 v0.AddArg2(src, mem)
2893 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
2894 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2895 v2.AddArg2(src, mem)
2896 v1.AddArg3(dst, v2, mem)
2897 v.AddArg3(dst, v0, v1)
2898 return true
2899 }
2900
2901
2902
2903 for {
2904 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
2905 break
2906 }
2907 t := ssa.AuxToType(v.Aux)
2908 dst := v_0
2909 src := v_1
2910 mem := v_2
2911 if !(t.Alignment()%4 == 0) {
2912 break
2913 }
2914 v.Reset(ssaop.OpRISCV64MOVWstore)
2915 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVWload, typ.Int32)
2916 v0.AddArg2(src, mem)
2917 v.AddArg3(dst, v0, mem)
2918 return true
2919 }
2920
2921
2922
2923 for {
2924 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
2925 break
2926 }
2927 t := ssa.AuxToType(v.Aux)
2928 dst := v_0
2929 src := v_1
2930 mem := v_2
2931 if !(t.Alignment()%2 == 0) {
2932 break
2933 }
2934 v.Reset(ssaop.OpRISCV64MOVHstore)
2935 v.AuxInt = ssa.Int32ToAuxInt(2)
2936 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
2937 v0.AuxInt = ssa.Int32ToAuxInt(2)
2938 v0.AddArg2(src, mem)
2939 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
2940 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
2941 v2.AddArg2(src, mem)
2942 v1.AddArg3(dst, v2, mem)
2943 v.AddArg3(dst, v0, v1)
2944 return true
2945 }
2946
2947
2948 for {
2949 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
2950 break
2951 }
2952 dst := v_0
2953 src := v_1
2954 mem := v_2
2955 v.Reset(ssaop.OpRISCV64MOVBstore)
2956 v.AuxInt = ssa.Int32ToAuxInt(3)
2957 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2958 v0.AuxInt = ssa.Int32ToAuxInt(3)
2959 v0.AddArg2(src, mem)
2960 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
2961 v1.AuxInt = ssa.Int32ToAuxInt(2)
2962 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2963 v2.AuxInt = ssa.Int32ToAuxInt(2)
2964 v2.AddArg2(src, mem)
2965 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
2966 v3.AuxInt = ssa.Int32ToAuxInt(1)
2967 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2968 v4.AuxInt = ssa.Int32ToAuxInt(1)
2969 v4.AddArg2(src, mem)
2970 v5 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
2971 v6 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
2972 v6.AddArg2(src, mem)
2973 v5.AddArg3(dst, v6, mem)
2974 v3.AddArg3(dst, v4, v5)
2975 v1.AddArg3(dst, v2, v3)
2976 v.AddArg3(dst, v0, v1)
2977 return true
2978 }
2979
2980
2981
2982 for {
2983 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
2984 break
2985 }
2986 t := ssa.AuxToType(v.Aux)
2987 dst := v_0
2988 src := v_1
2989 mem := v_2
2990 if !(t.Alignment()%8 == 0) {
2991 break
2992 }
2993 v.Reset(ssaop.OpRISCV64MOVDstore)
2994 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDload, typ.Int64)
2995 v0.AddArg2(src, mem)
2996 v.AddArg3(dst, v0, mem)
2997 return true
2998 }
2999
3000
3001
3002 for {
3003 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
3004 break
3005 }
3006 t := ssa.AuxToType(v.Aux)
3007 dst := v_0
3008 src := v_1
3009 mem := v_2
3010 if !(t.Alignment()%4 == 0) {
3011 break
3012 }
3013 v.Reset(ssaop.OpRISCV64MOVWstore)
3014 v.AuxInt = ssa.Int32ToAuxInt(4)
3015 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVWload, typ.Int32)
3016 v0.AuxInt = ssa.Int32ToAuxInt(4)
3017 v0.AddArg2(src, mem)
3018 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVWstore, types.TypeMem)
3019 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVWload, typ.Int32)
3020 v2.AddArg2(src, mem)
3021 v1.AddArg3(dst, v2, mem)
3022 v.AddArg3(dst, v0, v1)
3023 return true
3024 }
3025
3026
3027
3028 for {
3029 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
3030 break
3031 }
3032 t := ssa.AuxToType(v.Aux)
3033 dst := v_0
3034 src := v_1
3035 mem := v_2
3036 if !(t.Alignment()%2 == 0) {
3037 break
3038 }
3039 v.Reset(ssaop.OpRISCV64MOVHstore)
3040 v.AuxInt = ssa.Int32ToAuxInt(6)
3041 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3042 v0.AuxInt = ssa.Int32ToAuxInt(6)
3043 v0.AddArg2(src, mem)
3044 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
3045 v1.AuxInt = ssa.Int32ToAuxInt(4)
3046 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3047 v2.AuxInt = ssa.Int32ToAuxInt(4)
3048 v2.AddArg2(src, mem)
3049 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
3050 v3.AuxInt = ssa.Int32ToAuxInt(2)
3051 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3052 v4.AuxInt = ssa.Int32ToAuxInt(2)
3053 v4.AddArg2(src, mem)
3054 v5 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
3055 v6 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3056 v6.AddArg2(src, mem)
3057 v5.AddArg3(dst, v6, mem)
3058 v3.AddArg3(dst, v4, v5)
3059 v1.AddArg3(dst, v2, v3)
3060 v.AddArg3(dst, v0, v1)
3061 return true
3062 }
3063
3064
3065 for {
3066 if ssa.AuxIntToInt64(v.AuxInt) != 3 {
3067 break
3068 }
3069 dst := v_0
3070 src := v_1
3071 mem := v_2
3072 v.Reset(ssaop.OpRISCV64MOVBstore)
3073 v.AuxInt = ssa.Int32ToAuxInt(2)
3074 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
3075 v0.AuxInt = ssa.Int32ToAuxInt(2)
3076 v0.AddArg2(src, mem)
3077 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
3078 v1.AuxInt = ssa.Int32ToAuxInt(1)
3079 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
3080 v2.AuxInt = ssa.Int32ToAuxInt(1)
3081 v2.AddArg2(src, mem)
3082 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
3083 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBload, typ.Int8)
3084 v4.AddArg2(src, mem)
3085 v3.AddArg3(dst, v4, mem)
3086 v1.AddArg3(dst, v2, v3)
3087 v.AddArg3(dst, v0, v1)
3088 return true
3089 }
3090
3091
3092
3093 for {
3094 if ssa.AuxIntToInt64(v.AuxInt) != 6 {
3095 break
3096 }
3097 t := ssa.AuxToType(v.Aux)
3098 dst := v_0
3099 src := v_1
3100 mem := v_2
3101 if !(t.Alignment()%2 == 0) {
3102 break
3103 }
3104 v.Reset(ssaop.OpRISCV64MOVHstore)
3105 v.AuxInt = ssa.Int32ToAuxInt(4)
3106 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3107 v0.AuxInt = ssa.Int32ToAuxInt(4)
3108 v0.AddArg2(src, mem)
3109 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
3110 v1.AuxInt = ssa.Int32ToAuxInt(2)
3111 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3112 v2.AuxInt = ssa.Int32ToAuxInt(2)
3113 v2.AddArg2(src, mem)
3114 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
3115 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHload, typ.Int16)
3116 v4.AddArg2(src, mem)
3117 v3.AddArg3(dst, v4, mem)
3118 v1.AddArg3(dst, v2, v3)
3119 v.AddArg3(dst, v0, v1)
3120 return true
3121 }
3122
3123
3124
3125 for {
3126 s := ssa.AuxIntToInt64(v.AuxInt)
3127 t := ssa.AuxToType(v.Aux)
3128 dst := v_0
3129 src := v_1
3130 mem := v_2
3131 if !(s > 0 && s <= 3*8*ssa.MoveSize(t.Alignment(), config) && ssa.LogLargeCopyValue(v, s)) {
3132 break
3133 }
3134 v.Reset(ssaop.OpRISCV64LoweredMove)
3135 v.AuxInt = ssa.Int64ToAuxInt(s)
3136 v.Aux = ssa.Int64ToAux(t.Alignment())
3137 v.AddArg3(dst, src, mem)
3138 return true
3139 }
3140
3141
3142
3143 for {
3144 s := ssa.AuxIntToInt64(v.AuxInt)
3145 t := ssa.AuxToType(v.Aux)
3146 dst := v_0
3147 src := v_1
3148 mem := v_2
3149 if !(s > 3*8*ssa.MoveSize(t.Alignment(), config) && ssa.LogLargeCopyValue(v, s)) {
3150 break
3151 }
3152 v.Reset(ssaop.OpRISCV64LoweredMoveLoop)
3153 v.AuxInt = ssa.Int64ToAuxInt(s)
3154 v.Aux = ssa.Int64ToAux(t.Alignment())
3155 v.AddArg3(dst, src, mem)
3156 return true
3157 }
3158 return false
3159 }
3160 func rewriteValue_OpNeq16(v *ssa.Value) bool {
3161 v_1 := v.Args[1]
3162 v_0 := v.Args[0]
3163 b := v.Block
3164 typ := &b.Func.Config.Types
3165
3166
3167 for {
3168 x := v_0
3169 y := v_1
3170 v.Reset(ssaop.OpNot)
3171 v0 := b.NewValue0(v.Pos, ssaop.OpEq16, typ.Bool)
3172 v0.AddArg2(x, y)
3173 v.AddArg(v0)
3174 return true
3175 }
3176 }
3177 func rewriteValue_OpNeq32(v *ssa.Value) bool {
3178 v_1 := v.Args[1]
3179 v_0 := v.Args[0]
3180 b := v.Block
3181 typ := &b.Func.Config.Types
3182
3183
3184 for {
3185 x := v_0
3186 y := v_1
3187 v.Reset(ssaop.OpNot)
3188 v0 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool)
3189 v0.AddArg2(x, y)
3190 v.AddArg(v0)
3191 return true
3192 }
3193 }
3194 func rewriteValue_OpNeq64(v *ssa.Value) bool {
3195 v_1 := v.Args[1]
3196 v_0 := v.Args[0]
3197 b := v.Block
3198 typ := &b.Func.Config.Types
3199
3200
3201 for {
3202 x := v_0
3203 y := v_1
3204 v.Reset(ssaop.OpNot)
3205 v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool)
3206 v0.AddArg2(x, y)
3207 v.AddArg(v0)
3208 return true
3209 }
3210 }
3211 func rewriteValue_OpNeq8(v *ssa.Value) bool {
3212 v_1 := v.Args[1]
3213 v_0 := v.Args[0]
3214 b := v.Block
3215 typ := &b.Func.Config.Types
3216
3217
3218 for {
3219 x := v_0
3220 y := v_1
3221 v.Reset(ssaop.OpNot)
3222 v0 := b.NewValue0(v.Pos, ssaop.OpEq8, typ.Bool)
3223 v0.AddArg2(x, y)
3224 v.AddArg(v0)
3225 return true
3226 }
3227 }
3228 func rewriteValue_OpNeqB(v *ssa.Value) bool {
3229 v_1 := v.Args[1]
3230 v_0 := v.Args[0]
3231 b := v.Block
3232 typ := &b.Func.Config.Types
3233
3234
3235 for {
3236 x := v_0
3237 y := v_1
3238 v.Reset(ssaop.OpRISCV64SNEZ)
3239 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.Bool)
3240 v0.AddArg2(x, y)
3241 v.AddArg(v0)
3242 return true
3243 }
3244 }
3245 func rewriteValue_OpNeqPtr(v *ssa.Value) bool {
3246 v_1 := v.Args[1]
3247 v_0 := v.Args[0]
3248 b := v.Block
3249 typ := &b.Func.Config.Types
3250
3251
3252 for {
3253 x := v_0
3254 y := v_1
3255 v.Reset(ssaop.OpNot)
3256 v0 := b.NewValue0(v.Pos, ssaop.OpEqPtr, typ.Bool)
3257 v0.AddArg2(x, y)
3258 v.AddArg(v0)
3259 return true
3260 }
3261 }
3262 func rewriteValue_OpOffPtr(v *ssa.Value) bool {
3263 v_0 := v.Args[0]
3264 b := v.Block
3265 typ := &b.Func.Config.Types
3266
3267
3268
3269 for {
3270 off := ssa.AuxIntToInt64(v.AuxInt)
3271 ptr := v_0
3272 if ptr.Op != ssaop.OpSP || !(ssa.Is32Bit(off)) {
3273 break
3274 }
3275 v.Reset(ssaop.OpRISCV64MOVaddr)
3276 v.AuxInt = ssa.Int32ToAuxInt(int32(off))
3277 v.AddArg(ptr)
3278 return true
3279 }
3280
3281
3282
3283 for {
3284 off := ssa.AuxIntToInt64(v.AuxInt)
3285 ptr := v_0
3286 if !(ssa.Is32Bit(off)) {
3287 break
3288 }
3289 v.Reset(ssaop.OpRISCV64ADDI)
3290 v.AuxInt = ssa.Int64ToAuxInt(off)
3291 v.AddArg(ptr)
3292 return true
3293 }
3294
3295
3296 for {
3297 off := ssa.AuxIntToInt64(v.AuxInt)
3298 ptr := v_0
3299 v.Reset(ssaop.OpRISCV64ADD)
3300 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
3301 v0.AuxInt = ssa.Int64ToAuxInt(off)
3302 v.AddArg2(v0, ptr)
3303 return true
3304 }
3305 }
3306 func rewriteValue_OpPopCount16(v *ssa.Value) bool {
3307 v_0 := v.Args[0]
3308 b := v.Block
3309 typ := &b.Func.Config.Types
3310
3311
3312 for {
3313 x := v_0
3314 v.Reset(ssaop.OpRISCV64CPOP)
3315 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
3316 v0.AddArg(x)
3317 v.AddArg(v0)
3318 return true
3319 }
3320 }
3321 func rewriteValue_OpPopCount8(v *ssa.Value) bool {
3322 v_0 := v.Args[0]
3323 b := v.Block
3324 typ := &b.Func.Config.Types
3325
3326
3327 for {
3328 x := v_0
3329 v.Reset(ssaop.OpRISCV64CPOP)
3330 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
3331 v0.AddArg(x)
3332 v.AddArg(v0)
3333 return true
3334 }
3335 }
3336 func rewriteValue_OpRISCV64ADD(v *ssa.Value) bool {
3337 v_1 := v.Args[1]
3338 v_0 := v.Args[0]
3339
3340
3341
3342 for {
3343 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3344 if v_0.Op != ssaop.OpRISCV64MOVDconst {
3345 continue
3346 }
3347 t := v_0.Type
3348 val := ssa.AuxIntToInt64(v_0.AuxInt)
3349 x := v_1
3350 if !(ssa.Is32Bit(val) && !t.IsPtr()) {
3351 continue
3352 }
3353 v.Reset(ssaop.OpRISCV64ADDI)
3354 v.AuxInt = ssa.Int64ToAuxInt(val)
3355 v.AddArg(x)
3356 return true
3357 }
3358 break
3359 }
3360
3361
3362 for {
3363 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3364 x := v_0
3365 if v_1.Op != ssaop.OpRISCV64NEG {
3366 continue
3367 }
3368 y := v_1.Args[0]
3369 v.Reset(ssaop.OpRISCV64SUB)
3370 v.AddArg2(x, y)
3371 return true
3372 }
3373 break
3374 }
3375
3376
3377
3378 for {
3379 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3380 if v_0.Op != ssaop.OpRISCV64SLLI || ssa.AuxIntToInt64(v_0.AuxInt) != 1 {
3381 continue
3382 }
3383 x := v_0.Args[0]
3384 y := v_1
3385 if !(buildcfg.GORISCV64 >= 22) {
3386 continue
3387 }
3388 v.Reset(ssaop.OpRISCV64SH1ADD)
3389 v.AddArg2(x, y)
3390 return true
3391 }
3392 break
3393 }
3394
3395
3396
3397 for {
3398 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3399 if v_0.Op != ssaop.OpRISCV64SLLI || ssa.AuxIntToInt64(v_0.AuxInt) != 2 {
3400 continue
3401 }
3402 x := v_0.Args[0]
3403 y := v_1
3404 if !(buildcfg.GORISCV64 >= 22) {
3405 continue
3406 }
3407 v.Reset(ssaop.OpRISCV64SH2ADD)
3408 v.AddArg2(x, y)
3409 return true
3410 }
3411 break
3412 }
3413
3414
3415
3416 for {
3417 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3418 if v_0.Op != ssaop.OpRISCV64SLLI || ssa.AuxIntToInt64(v_0.AuxInt) != 3 {
3419 continue
3420 }
3421 x := v_0.Args[0]
3422 y := v_1
3423 if !(buildcfg.GORISCV64 >= 22) {
3424 continue
3425 }
3426 v.Reset(ssaop.OpRISCV64SH3ADD)
3427 v.AddArg2(x, y)
3428 return true
3429 }
3430 break
3431 }
3432 return false
3433 }
3434 func rewriteValue_OpRISCV64ADDI(v *ssa.Value) bool {
3435 v_0 := v.Args[0]
3436
3437
3438
3439 for {
3440 c := ssa.AuxIntToInt64(v.AuxInt)
3441 if v_0.Op != ssaop.OpRISCV64MOVaddr {
3442 break
3443 }
3444 d := ssa.AuxIntToInt32(v_0.AuxInt)
3445 s := ssa.AuxToSym(v_0.Aux)
3446 x := v_0.Args[0]
3447 if !(ssa.Is32Bit(c + int64(d))) {
3448 break
3449 }
3450 v.Reset(ssaop.OpRISCV64MOVaddr)
3451 v.AuxInt = ssa.Int32ToAuxInt(int32(c) + d)
3452 v.Aux = ssa.SymToAux(s)
3453 v.AddArg(x)
3454 return true
3455 }
3456
3457
3458 for {
3459 if ssa.AuxIntToInt64(v.AuxInt) != 0 {
3460 break
3461 }
3462 x := v_0
3463 v.CopyOf(x)
3464 return true
3465 }
3466
3467
3468
3469 for {
3470 x := ssa.AuxIntToInt64(v.AuxInt)
3471 if v_0.Op != ssaop.OpRISCV64MOVDconst {
3472 break
3473 }
3474 y := ssa.AuxIntToInt64(v_0.AuxInt)
3475 if !(ssa.Is32Bit(x + y)) {
3476 break
3477 }
3478 v.Reset(ssaop.OpRISCV64MOVDconst)
3479 v.AuxInt = ssa.Int64ToAuxInt(x + y)
3480 return true
3481 }
3482
3483
3484
3485 for {
3486 x := ssa.AuxIntToInt64(v.AuxInt)
3487 if v_0.Op != ssaop.OpRISCV64ADDI {
3488 break
3489 }
3490 y := ssa.AuxIntToInt64(v_0.AuxInt)
3491 z := v_0.Args[0]
3492 if !(ssa.Is32Bit(x + y)) {
3493 break
3494 }
3495 v.Reset(ssaop.OpRISCV64ADDI)
3496 v.AuxInt = ssa.Int64ToAuxInt(x + y)
3497 v.AddArg(z)
3498 return true
3499 }
3500 return false
3501 }
3502 func rewriteValue_OpRISCV64AND(v *ssa.Value) bool {
3503 v_1 := v.Args[1]
3504 v_0 := v.Args[0]
3505
3506
3507
3508 for {
3509 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3510 if v_0.Op != ssaop.OpRISCV64MOVDconst {
3511 continue
3512 }
3513 val := ssa.AuxIntToInt64(v_0.AuxInt)
3514 x := v_1
3515 if !(ssa.Is32Bit(val)) {
3516 continue
3517 }
3518 v.Reset(ssaop.OpRISCV64ANDI)
3519 v.AuxInt = ssa.Int64ToAuxInt(val)
3520 v.AddArg(x)
3521 return true
3522 }
3523 break
3524 }
3525
3526
3527 for {
3528 x := v_0
3529 if x != v_1 {
3530 break
3531 }
3532 v.CopyOf(x)
3533 return true
3534 }
3535 return false
3536 }
3537 func rewriteValue_OpRISCV64ANDI(v *ssa.Value) bool {
3538 v_0 := v.Args[0]
3539
3540
3541 for {
3542 if ssa.AuxIntToInt64(v.AuxInt) != 0 {
3543 break
3544 }
3545 v.Reset(ssaop.OpRISCV64MOVDconst)
3546 v.AuxInt = ssa.Int64ToAuxInt(0)
3547 return true
3548 }
3549
3550
3551 for {
3552 if ssa.AuxIntToInt64(v.AuxInt) != -1 {
3553 break
3554 }
3555 x := v_0
3556 v.CopyOf(x)
3557 return true
3558 }
3559
3560
3561 for {
3562 x := ssa.AuxIntToInt64(v.AuxInt)
3563 if v_0.Op != ssaop.OpRISCV64MOVDconst {
3564 break
3565 }
3566 y := ssa.AuxIntToInt64(v_0.AuxInt)
3567 v.Reset(ssaop.OpRISCV64MOVDconst)
3568 v.AuxInt = ssa.Int64ToAuxInt(x & y)
3569 return true
3570 }
3571
3572
3573 for {
3574 x := ssa.AuxIntToInt64(v.AuxInt)
3575 if v_0.Op != ssaop.OpRISCV64ANDI {
3576 break
3577 }
3578 y := ssa.AuxIntToInt64(v_0.AuxInt)
3579 z := v_0.Args[0]
3580 v.Reset(ssaop.OpRISCV64ANDI)
3581 v.AuxInt = ssa.Int64ToAuxInt(x & y)
3582 v.AddArg(z)
3583 return true
3584 }
3585 return false
3586 }
3587 func rewriteValue_OpRISCV64CZEROEQZ(v *ssa.Value) bool {
3588 v_1 := v.Args[1]
3589 v_0 := v.Args[0]
3590
3591
3592 for {
3593 x := v_0
3594 if v_1.Op != ssaop.OpRISCV64SNEZ {
3595 break
3596 }
3597 y := v_1.Args[0]
3598 v.Reset(ssaop.OpRISCV64CZEROEQZ)
3599 v.AddArg2(x, y)
3600 return true
3601 }
3602
3603
3604 for {
3605 x := v_0
3606 if v_1.Op != ssaop.OpRISCV64SEQZ {
3607 break
3608 }
3609 y := v_1.Args[0]
3610 v.Reset(ssaop.OpRISCV64CZERONEZ)
3611 v.AddArg2(x, y)
3612 return true
3613 }
3614
3615
3616 for {
3617 x := v_0
3618 if v_1.Op != ssaop.OpRISCV64NEG {
3619 break
3620 }
3621 y := v_1.Args[0]
3622 v.Reset(ssaop.OpRISCV64CZEROEQZ)
3623 v.AddArg2(x, y)
3624 return true
3625 }
3626
3627
3628 for {
3629 x := v_0
3630 if x != v_1 {
3631 break
3632 }
3633 v.CopyOf(x)
3634 return true
3635 }
3636
3637
3638 for {
3639 if v_0.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
3640 break
3641 }
3642 v.Reset(ssaop.OpRISCV64MOVDconst)
3643 v.AuxInt = ssa.Int64ToAuxInt(0)
3644 return true
3645 }
3646 return false
3647 }
3648 func rewriteValue_OpRISCV64CZERONEZ(v *ssa.Value) bool {
3649 v_1 := v.Args[1]
3650 v_0 := v.Args[0]
3651
3652
3653 for {
3654 x := v_0
3655 if v_1.Op != ssaop.OpRISCV64SNEZ {
3656 break
3657 }
3658 y := v_1.Args[0]
3659 v.Reset(ssaop.OpRISCV64CZERONEZ)
3660 v.AddArg2(x, y)
3661 return true
3662 }
3663
3664
3665 for {
3666 x := v_0
3667 if v_1.Op != ssaop.OpRISCV64SEQZ {
3668 break
3669 }
3670 y := v_1.Args[0]
3671 v.Reset(ssaop.OpRISCV64CZEROEQZ)
3672 v.AddArg2(x, y)
3673 return true
3674 }
3675
3676
3677 for {
3678 x := v_0
3679 if v_1.Op != ssaop.OpRISCV64NEG {
3680 break
3681 }
3682 y := v_1.Args[0]
3683 v.Reset(ssaop.OpRISCV64CZERONEZ)
3684 v.AddArg2(x, y)
3685 return true
3686 }
3687
3688
3689 for {
3690 x := v_0
3691 if x != v_1 {
3692 break
3693 }
3694 v.Reset(ssaop.OpRISCV64MOVDconst)
3695 v.AuxInt = ssa.Int64ToAuxInt(0)
3696 return true
3697 }
3698
3699
3700 for {
3701 if v_0.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
3702 break
3703 }
3704 v.Reset(ssaop.OpRISCV64MOVDconst)
3705 v.AuxInt = ssa.Int64ToAuxInt(0)
3706 return true
3707 }
3708 return false
3709 }
3710 func rewriteValue_OpRISCV64FADDD(v *ssa.Value) bool {
3711 v_1 := v.Args[1]
3712 v_0 := v.Args[0]
3713
3714
3715
3716 for {
3717 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3718 a := v_0
3719 if v_1.Op != ssaop.OpRISCV64FMULD {
3720 continue
3721 }
3722 y := v_1.Args[1]
3723 x := v_1.Args[0]
3724 if !(a.Block.Func.UseFMA(v)) {
3725 continue
3726 }
3727 v.Reset(ssaop.OpRISCV64FMADDD)
3728 v.AddArg3(x, y, a)
3729 return true
3730 }
3731 break
3732 }
3733 return false
3734 }
3735 func rewriteValue_OpRISCV64FADDS(v *ssa.Value) bool {
3736 v_1 := v.Args[1]
3737 v_0 := v.Args[0]
3738
3739
3740
3741 for {
3742 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3743 a := v_0
3744 if v_1.Op != ssaop.OpRISCV64FMULS {
3745 continue
3746 }
3747 y := v_1.Args[1]
3748 x := v_1.Args[0]
3749 if !(a.Block.Func.UseFMA(v)) {
3750 continue
3751 }
3752 v.Reset(ssaop.OpRISCV64FMADDS)
3753 v.AddArg3(x, y, a)
3754 return true
3755 }
3756 break
3757 }
3758 return false
3759 }
3760 func rewriteValue_OpRISCV64FCVTSD(v *ssa.Value) bool {
3761 v_0 := v.Args[0]
3762
3763
3764 for {
3765 if v_0.Op != ssaop.OpRISCV64FABSD {
3766 break
3767 }
3768 v_0_0 := v_0.Args[0]
3769 if v_0_0.Op != ssaop.OpRISCV64FCVTDS {
3770 break
3771 }
3772 X := v_0_0.Args[0]
3773 v.Reset(ssaop.OpRISCV64FABSS)
3774 v.AddArg(X)
3775 return true
3776 }
3777
3778
3779 for {
3780 if v_0.Op != ssaop.OpRISCV64FSQRTD {
3781 break
3782 }
3783 v_0_0 := v_0.Args[0]
3784 if v_0_0.Op != ssaop.OpRISCV64FCVTDS {
3785 break
3786 }
3787 X := v_0_0.Args[0]
3788 v.Reset(ssaop.OpRISCV64FSQRTS)
3789 v.AddArg(X)
3790 return true
3791 }
3792 return false
3793 }
3794 func rewriteValue_OpRISCV64FEQD(v *ssa.Value) bool {
3795 v_1 := v.Args[1]
3796 v_0 := v.Args[0]
3797 b := v.Block
3798 typ := &b.Func.Config.Types
3799
3800
3801 for {
3802 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3803 x := v_0
3804 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != math.Inf(-1) {
3805 continue
3806 }
3807 v.Reset(ssaop.OpRISCV64ANDI)
3808 v.AuxInt = ssa.Int64ToAuxInt(0b00_0000_0001)
3809 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3810 v0.AddArg(x)
3811 v.AddArg(v0)
3812 return true
3813 }
3814 break
3815 }
3816
3817
3818 for {
3819 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3820 x := v_0
3821 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != math.Inf(1) {
3822 continue
3823 }
3824 v.Reset(ssaop.OpRISCV64SNEZ)
3825 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3826 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1000_0000)
3827 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3828 v1.AddArg(x)
3829 v0.AddArg(v1)
3830 v.AddArg(v0)
3831 return true
3832 }
3833 break
3834 }
3835 return false
3836 }
3837 func rewriteValue_OpRISCV64FLED(v *ssa.Value) bool {
3838 v_1 := v.Args[1]
3839 v_0 := v.Args[0]
3840 b := v.Block
3841 typ := &b.Func.Config.Types
3842
3843
3844 for {
3845 if v_0.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_0.AuxInt) != -math.MaxFloat64 {
3846 break
3847 }
3848 x := v_1
3849 v.Reset(ssaop.OpRISCV64SNEZ)
3850 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3851 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1111_1110)
3852 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3853 v1.AddArg(x)
3854 v0.AddArg(v1)
3855 v.AddArg(v0)
3856 return true
3857 }
3858
3859
3860 for {
3861 x := v_0
3862 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != math.MaxFloat64 {
3863 break
3864 }
3865 v.Reset(ssaop.OpRISCV64SNEZ)
3866 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3867 v0.AuxInt = ssa.Int64ToAuxInt(0b00_0111_1111)
3868 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3869 v1.AddArg(x)
3870 v0.AddArg(v1)
3871 v.AddArg(v0)
3872 return true
3873 }
3874
3875
3876 for {
3877 if v_0.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_0.AuxInt) != +0x1p-1022 {
3878 break
3879 }
3880 x := v_1
3881 v.Reset(ssaop.OpRISCV64SNEZ)
3882 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3883 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1100_0000)
3884 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3885 v1.AddArg(x)
3886 v0.AddArg(v1)
3887 v.AddArg(v0)
3888 return true
3889 }
3890
3891
3892 for {
3893 x := v_0
3894 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != -0x1p-1022 {
3895 break
3896 }
3897 v.Reset(ssaop.OpRISCV64SNEZ)
3898 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3899 v0.AuxInt = ssa.Int64ToAuxInt(0b00_0000_0011)
3900 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3901 v1.AddArg(x)
3902 v0.AddArg(v1)
3903 v.AddArg(v0)
3904 return true
3905 }
3906 return false
3907 }
3908 func rewriteValue_OpRISCV64FLTD(v *ssa.Value) bool {
3909 v_1 := v.Args[1]
3910 v_0 := v.Args[0]
3911 b := v.Block
3912 typ := &b.Func.Config.Types
3913
3914
3915 for {
3916 x := v_0
3917 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != -math.MaxFloat64 {
3918 break
3919 }
3920 v.Reset(ssaop.OpRISCV64ANDI)
3921 v.AuxInt = ssa.Int64ToAuxInt(0b00_0000_0001)
3922 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3923 v0.AddArg(x)
3924 v.AddArg(v0)
3925 return true
3926 }
3927
3928
3929 for {
3930 if v_0.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_0.AuxInt) != math.MaxFloat64 {
3931 break
3932 }
3933 x := v_1
3934 v.Reset(ssaop.OpRISCV64SNEZ)
3935 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3936 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1000_0000)
3937 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3938 v1.AddArg(x)
3939 v0.AddArg(v1)
3940 v.AddArg(v0)
3941 return true
3942 }
3943
3944
3945 for {
3946 x := v_0
3947 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != +0x1p-1022 {
3948 break
3949 }
3950 v.Reset(ssaop.OpRISCV64SNEZ)
3951 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3952 v0.AuxInt = ssa.Int64ToAuxInt(0b00_0011_1111)
3953 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3954 v1.AddArg(x)
3955 v0.AddArg(v1)
3956 v.AddArg(v0)
3957 return true
3958 }
3959
3960
3961 for {
3962 if v_0.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_0.AuxInt) != -0x1p-1022 {
3963 break
3964 }
3965 x := v_1
3966 v.Reset(ssaop.OpRISCV64SNEZ)
3967 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
3968 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1111_1100)
3969 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
3970 v1.AddArg(x)
3971 v0.AddArg(v1)
3972 v.AddArg(v0)
3973 return true
3974 }
3975 return false
3976 }
3977 func rewriteValue_OpRISCV64FMADDD(v *ssa.Value) bool {
3978 v_2 := v.Args[2]
3979 v_1 := v.Args[1]
3980 v_0 := v.Args[0]
3981
3982
3983
3984 for {
3985 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3986 neg := v_0
3987 if neg.Op != ssaop.OpRISCV64FNEGD {
3988 continue
3989 }
3990 x := neg.Args[0]
3991 y := v_1
3992 z := v_2
3993 if !(neg.Uses == 1) {
3994 continue
3995 }
3996 v.Reset(ssaop.OpRISCV64FNMSUBD)
3997 v.AddArg3(x, y, z)
3998 return true
3999 }
4000 break
4001 }
4002
4003
4004
4005 for {
4006 x := v_0
4007 y := v_1
4008 neg := v_2
4009 if neg.Op != ssaop.OpRISCV64FNEGD {
4010 break
4011 }
4012 z := neg.Args[0]
4013 if !(neg.Uses == 1) {
4014 break
4015 }
4016 v.Reset(ssaop.OpRISCV64FMSUBD)
4017 v.AddArg3(x, y, z)
4018 return true
4019 }
4020 return false
4021 }
4022 func rewriteValue_OpRISCV64FMADDS(v *ssa.Value) bool {
4023 v_2 := v.Args[2]
4024 v_1 := v.Args[1]
4025 v_0 := v.Args[0]
4026
4027
4028
4029 for {
4030 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4031 neg := v_0
4032 if neg.Op != ssaop.OpRISCV64FNEGS {
4033 continue
4034 }
4035 x := neg.Args[0]
4036 y := v_1
4037 z := v_2
4038 if !(neg.Uses == 1) {
4039 continue
4040 }
4041 v.Reset(ssaop.OpRISCV64FNMSUBS)
4042 v.AddArg3(x, y, z)
4043 return true
4044 }
4045 break
4046 }
4047
4048
4049
4050 for {
4051 x := v_0
4052 y := v_1
4053 neg := v_2
4054 if neg.Op != ssaop.OpRISCV64FNEGS {
4055 break
4056 }
4057 z := neg.Args[0]
4058 if !(neg.Uses == 1) {
4059 break
4060 }
4061 v.Reset(ssaop.OpRISCV64FMSUBS)
4062 v.AddArg3(x, y, z)
4063 return true
4064 }
4065 return false
4066 }
4067 func rewriteValue_OpRISCV64FMOVDload(v *ssa.Value) bool {
4068 v_1 := v.Args[1]
4069 v_0 := v.Args[0]
4070 b := v.Block
4071 config := b.Func.Config
4072
4073
4074
4075 for {
4076 off1 := ssa.AuxIntToInt32(v.AuxInt)
4077 sym1 := ssa.AuxToSym(v.Aux)
4078 if v_0.Op != ssaop.OpRISCV64MOVaddr {
4079 break
4080 }
4081 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
4082 sym2 := ssa.AuxToSym(v_0.Aux)
4083 base := v_0.Args[0]
4084 mem := v_1
4085 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
4086 break
4087 }
4088 v.Reset(ssaop.OpRISCV64FMOVDload)
4089 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
4090 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
4091 v.AddArg2(base, mem)
4092 return true
4093 }
4094
4095
4096
4097 for {
4098 off1 := ssa.AuxIntToInt32(v.AuxInt)
4099 sym := ssa.AuxToSym(v.Aux)
4100 if v_0.Op != ssaop.OpRISCV64ADDI {
4101 break
4102 }
4103 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
4104 base := v_0.Args[0]
4105 mem := v_1
4106 if !(ssa.Is32Bit(int64(off1) + off2)) {
4107 break
4108 }
4109 v.Reset(ssaop.OpRISCV64FMOVDload)
4110 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
4111 v.Aux = ssa.SymToAux(sym)
4112 v.AddArg2(base, mem)
4113 return true
4114 }
4115
4116
4117
4118 for {
4119 off := ssa.AuxIntToInt32(v.AuxInt)
4120 sym := ssa.AuxToSym(v.Aux)
4121 ptr1 := v_0
4122 if v_1.Op != ssaop.OpRISCV64MOVDstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
4123 break
4124 }
4125 x := v_1.Args[1]
4126 ptr2 := v_1.Args[0]
4127 if !(ssa.IsSamePtr(ptr1, ptr2)) {
4128 break
4129 }
4130 v.Reset(ssaop.OpRISCV64FMVDX)
4131 v.AddArg(x)
4132 return true
4133 }
4134 return false
4135 }
4136 func rewriteValue_OpRISCV64FMOVDstore(v *ssa.Value) bool {
4137 v_2 := v.Args[2]
4138 v_1 := v.Args[1]
4139 v_0 := v.Args[0]
4140 b := v.Block
4141 config := b.Func.Config
4142
4143
4144
4145 for {
4146 off1 := ssa.AuxIntToInt32(v.AuxInt)
4147 sym1 := ssa.AuxToSym(v.Aux)
4148 if v_0.Op != ssaop.OpRISCV64MOVaddr {
4149 break
4150 }
4151 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
4152 sym2 := ssa.AuxToSym(v_0.Aux)
4153 base := v_0.Args[0]
4154 val := v_1
4155 mem := v_2
4156 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
4157 break
4158 }
4159 v.Reset(ssaop.OpRISCV64FMOVDstore)
4160 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
4161 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
4162 v.AddArg3(base, val, mem)
4163 return true
4164 }
4165
4166
4167
4168 for {
4169 off1 := ssa.AuxIntToInt32(v.AuxInt)
4170 sym := ssa.AuxToSym(v.Aux)
4171 if v_0.Op != ssaop.OpRISCV64ADDI {
4172 break
4173 }
4174 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
4175 base := v_0.Args[0]
4176 val := v_1
4177 mem := v_2
4178 if !(ssa.Is32Bit(int64(off1) + off2)) {
4179 break
4180 }
4181 v.Reset(ssaop.OpRISCV64FMOVDstore)
4182 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
4183 v.Aux = ssa.SymToAux(sym)
4184 v.AddArg3(base, val, mem)
4185 return true
4186 }
4187 return false
4188 }
4189 func rewriteValue_OpRISCV64FMOVWload(v *ssa.Value) bool {
4190 v_1 := v.Args[1]
4191 v_0 := v.Args[0]
4192 b := v.Block
4193 config := b.Func.Config
4194
4195
4196
4197 for {
4198 off1 := ssa.AuxIntToInt32(v.AuxInt)
4199 sym1 := ssa.AuxToSym(v.Aux)
4200 if v_0.Op != ssaop.OpRISCV64MOVaddr {
4201 break
4202 }
4203 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
4204 sym2 := ssa.AuxToSym(v_0.Aux)
4205 base := v_0.Args[0]
4206 mem := v_1
4207 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
4208 break
4209 }
4210 v.Reset(ssaop.OpRISCV64FMOVWload)
4211 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
4212 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
4213 v.AddArg2(base, mem)
4214 return true
4215 }
4216
4217
4218
4219 for {
4220 off1 := ssa.AuxIntToInt32(v.AuxInt)
4221 sym := ssa.AuxToSym(v.Aux)
4222 if v_0.Op != ssaop.OpRISCV64ADDI {
4223 break
4224 }
4225 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
4226 base := v_0.Args[0]
4227 mem := v_1
4228 if !(ssa.Is32Bit(int64(off1) + off2)) {
4229 break
4230 }
4231 v.Reset(ssaop.OpRISCV64FMOVWload)
4232 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
4233 v.Aux = ssa.SymToAux(sym)
4234 v.AddArg2(base, mem)
4235 return true
4236 }
4237
4238
4239
4240 for {
4241 off := ssa.AuxIntToInt32(v.AuxInt)
4242 sym := ssa.AuxToSym(v.Aux)
4243 ptr1 := v_0
4244 if v_1.Op != ssaop.OpRISCV64MOVWstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
4245 break
4246 }
4247 x := v_1.Args[1]
4248 ptr2 := v_1.Args[0]
4249 if !(ssa.IsSamePtr(ptr1, ptr2)) {
4250 break
4251 }
4252 v.Reset(ssaop.OpRISCV64FMVSX)
4253 v.AddArg(x)
4254 return true
4255 }
4256 return false
4257 }
4258 func rewriteValue_OpRISCV64FMOVWstore(v *ssa.Value) bool {
4259 v_2 := v.Args[2]
4260 v_1 := v.Args[1]
4261 v_0 := v.Args[0]
4262 b := v.Block
4263 config := b.Func.Config
4264
4265
4266
4267 for {
4268 off1 := ssa.AuxIntToInt32(v.AuxInt)
4269 sym1 := ssa.AuxToSym(v.Aux)
4270 if v_0.Op != ssaop.OpRISCV64MOVaddr {
4271 break
4272 }
4273 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
4274 sym2 := ssa.AuxToSym(v_0.Aux)
4275 base := v_0.Args[0]
4276 val := v_1
4277 mem := v_2
4278 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
4279 break
4280 }
4281 v.Reset(ssaop.OpRISCV64FMOVWstore)
4282 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
4283 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
4284 v.AddArg3(base, val, mem)
4285 return true
4286 }
4287
4288
4289
4290 for {
4291 off1 := ssa.AuxIntToInt32(v.AuxInt)
4292 sym := ssa.AuxToSym(v.Aux)
4293 if v_0.Op != ssaop.OpRISCV64ADDI {
4294 break
4295 }
4296 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
4297 base := v_0.Args[0]
4298 val := v_1
4299 mem := v_2
4300 if !(ssa.Is32Bit(int64(off1) + off2)) {
4301 break
4302 }
4303 v.Reset(ssaop.OpRISCV64FMOVWstore)
4304 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
4305 v.Aux = ssa.SymToAux(sym)
4306 v.AddArg3(base, val, mem)
4307 return true
4308 }
4309 return false
4310 }
4311 func rewriteValue_OpRISCV64FMSUBD(v *ssa.Value) bool {
4312 v_2 := v.Args[2]
4313 v_1 := v.Args[1]
4314 v_0 := v.Args[0]
4315
4316
4317
4318 for {
4319 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4320 neg := v_0
4321 if neg.Op != ssaop.OpRISCV64FNEGD {
4322 continue
4323 }
4324 x := neg.Args[0]
4325 y := v_1
4326 z := v_2
4327 if !(neg.Uses == 1) {
4328 continue
4329 }
4330 v.Reset(ssaop.OpRISCV64FNMADDD)
4331 v.AddArg3(x, y, z)
4332 return true
4333 }
4334 break
4335 }
4336
4337
4338
4339 for {
4340 x := v_0
4341 y := v_1
4342 neg := v_2
4343 if neg.Op != ssaop.OpRISCV64FNEGD {
4344 break
4345 }
4346 z := neg.Args[0]
4347 if !(neg.Uses == 1) {
4348 break
4349 }
4350 v.Reset(ssaop.OpRISCV64FMADDD)
4351 v.AddArg3(x, y, z)
4352 return true
4353 }
4354 return false
4355 }
4356 func rewriteValue_OpRISCV64FMSUBS(v *ssa.Value) bool {
4357 v_2 := v.Args[2]
4358 v_1 := v.Args[1]
4359 v_0 := v.Args[0]
4360
4361
4362
4363 for {
4364 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4365 neg := v_0
4366 if neg.Op != ssaop.OpRISCV64FNEGS {
4367 continue
4368 }
4369 x := neg.Args[0]
4370 y := v_1
4371 z := v_2
4372 if !(neg.Uses == 1) {
4373 continue
4374 }
4375 v.Reset(ssaop.OpRISCV64FNMADDS)
4376 v.AddArg3(x, y, z)
4377 return true
4378 }
4379 break
4380 }
4381
4382
4383
4384 for {
4385 x := v_0
4386 y := v_1
4387 neg := v_2
4388 if neg.Op != ssaop.OpRISCV64FNEGS {
4389 break
4390 }
4391 z := neg.Args[0]
4392 if !(neg.Uses == 1) {
4393 break
4394 }
4395 v.Reset(ssaop.OpRISCV64FMADDS)
4396 v.AddArg3(x, y, z)
4397 return true
4398 }
4399 return false
4400 }
4401 func rewriteValue_OpRISCV64FNED(v *ssa.Value) bool {
4402 v_1 := v.Args[1]
4403 v_0 := v.Args[0]
4404 b := v.Block
4405 typ := &b.Func.Config.Types
4406
4407
4408 for {
4409 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4410 x := v_0
4411 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != math.Inf(-1) {
4412 continue
4413 }
4414 v.Reset(ssaop.OpRISCV64SEQZ)
4415 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
4416 v0.AuxInt = ssa.Int64ToAuxInt(0b00_0000_0001)
4417 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
4418 v1.AddArg(x)
4419 v0.AddArg(v1)
4420 v.AddArg(v0)
4421 return true
4422 }
4423 break
4424 }
4425
4426
4427 for {
4428 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4429 x := v_0
4430 if v_1.Op != ssaop.OpRISCV64FMOVDconst || ssa.AuxIntToFloat64(v_1.AuxInt) != math.Inf(1) {
4431 continue
4432 }
4433 v.Reset(ssaop.OpRISCV64SEQZ)
4434 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
4435 v0.AuxInt = ssa.Int64ToAuxInt(0b00_1000_0000)
4436 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
4437 v1.AddArg(x)
4438 v0.AddArg(v1)
4439 v.AddArg(v0)
4440 return true
4441 }
4442 break
4443 }
4444 return false
4445 }
4446 func rewriteValue_OpRISCV64FNMADDD(v *ssa.Value) bool {
4447 v_2 := v.Args[2]
4448 v_1 := v.Args[1]
4449 v_0 := v.Args[0]
4450
4451
4452
4453 for {
4454 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4455 neg := v_0
4456 if neg.Op != ssaop.OpRISCV64FNEGD {
4457 continue
4458 }
4459 x := neg.Args[0]
4460 y := v_1
4461 z := v_2
4462 if !(neg.Uses == 1) {
4463 continue
4464 }
4465 v.Reset(ssaop.OpRISCV64FMSUBD)
4466 v.AddArg3(x, y, z)
4467 return true
4468 }
4469 break
4470 }
4471
4472
4473
4474 for {
4475 x := v_0
4476 y := v_1
4477 neg := v_2
4478 if neg.Op != ssaop.OpRISCV64FNEGD {
4479 break
4480 }
4481 z := neg.Args[0]
4482 if !(neg.Uses == 1) {
4483 break
4484 }
4485 v.Reset(ssaop.OpRISCV64FNMSUBD)
4486 v.AddArg3(x, y, z)
4487 return true
4488 }
4489 return false
4490 }
4491 func rewriteValue_OpRISCV64FNMADDS(v *ssa.Value) bool {
4492 v_2 := v.Args[2]
4493 v_1 := v.Args[1]
4494 v_0 := v.Args[0]
4495
4496
4497
4498 for {
4499 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4500 neg := v_0
4501 if neg.Op != ssaop.OpRISCV64FNEGS {
4502 continue
4503 }
4504 x := neg.Args[0]
4505 y := v_1
4506 z := v_2
4507 if !(neg.Uses == 1) {
4508 continue
4509 }
4510 v.Reset(ssaop.OpRISCV64FMSUBS)
4511 v.AddArg3(x, y, z)
4512 return true
4513 }
4514 break
4515 }
4516
4517
4518
4519 for {
4520 x := v_0
4521 y := v_1
4522 neg := v_2
4523 if neg.Op != ssaop.OpRISCV64FNEGS {
4524 break
4525 }
4526 z := neg.Args[0]
4527 if !(neg.Uses == 1) {
4528 break
4529 }
4530 v.Reset(ssaop.OpRISCV64FNMSUBS)
4531 v.AddArg3(x, y, z)
4532 return true
4533 }
4534 return false
4535 }
4536 func rewriteValue_OpRISCV64FNMSUBD(v *ssa.Value) bool {
4537 v_2 := v.Args[2]
4538 v_1 := v.Args[1]
4539 v_0 := v.Args[0]
4540
4541
4542
4543 for {
4544 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4545 neg := v_0
4546 if neg.Op != ssaop.OpRISCV64FNEGD {
4547 continue
4548 }
4549 x := neg.Args[0]
4550 y := v_1
4551 z := v_2
4552 if !(neg.Uses == 1) {
4553 continue
4554 }
4555 v.Reset(ssaop.OpRISCV64FMADDD)
4556 v.AddArg3(x, y, z)
4557 return true
4558 }
4559 break
4560 }
4561
4562
4563
4564 for {
4565 x := v_0
4566 y := v_1
4567 neg := v_2
4568 if neg.Op != ssaop.OpRISCV64FNEGD {
4569 break
4570 }
4571 z := neg.Args[0]
4572 if !(neg.Uses == 1) {
4573 break
4574 }
4575 v.Reset(ssaop.OpRISCV64FNMADDD)
4576 v.AddArg3(x, y, z)
4577 return true
4578 }
4579 return false
4580 }
4581 func rewriteValue_OpRISCV64FNMSUBS(v *ssa.Value) bool {
4582 v_2 := v.Args[2]
4583 v_1 := v.Args[1]
4584 v_0 := v.Args[0]
4585
4586
4587
4588 for {
4589 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4590 neg := v_0
4591 if neg.Op != ssaop.OpRISCV64FNEGS {
4592 continue
4593 }
4594 x := neg.Args[0]
4595 y := v_1
4596 z := v_2
4597 if !(neg.Uses == 1) {
4598 continue
4599 }
4600 v.Reset(ssaop.OpRISCV64FMADDS)
4601 v.AddArg3(x, y, z)
4602 return true
4603 }
4604 break
4605 }
4606
4607
4608
4609 for {
4610 x := v_0
4611 y := v_1
4612 neg := v_2
4613 if neg.Op != ssaop.OpRISCV64FNEGS {
4614 break
4615 }
4616 z := neg.Args[0]
4617 if !(neg.Uses == 1) {
4618 break
4619 }
4620 v.Reset(ssaop.OpRISCV64FNMADDS)
4621 v.AddArg3(x, y, z)
4622 return true
4623 }
4624 return false
4625 }
4626 func rewriteValue_OpRISCV64FSUBD(v *ssa.Value) bool {
4627 v_1 := v.Args[1]
4628 v_0 := v.Args[0]
4629
4630
4631
4632 for {
4633 a := v_0
4634 if v_1.Op != ssaop.OpRISCV64FMULD {
4635 break
4636 }
4637 y := v_1.Args[1]
4638 x := v_1.Args[0]
4639 if !(a.Block.Func.UseFMA(v)) {
4640 break
4641 }
4642 v.Reset(ssaop.OpRISCV64FNMSUBD)
4643 v.AddArg3(x, y, a)
4644 return true
4645 }
4646
4647
4648
4649 for {
4650 if v_0.Op != ssaop.OpRISCV64FMULD {
4651 break
4652 }
4653 y := v_0.Args[1]
4654 x := v_0.Args[0]
4655 a := v_1
4656 if !(a.Block.Func.UseFMA(v)) {
4657 break
4658 }
4659 v.Reset(ssaop.OpRISCV64FMSUBD)
4660 v.AddArg3(x, y, a)
4661 return true
4662 }
4663 return false
4664 }
4665 func rewriteValue_OpRISCV64FSUBS(v *ssa.Value) bool {
4666 v_1 := v.Args[1]
4667 v_0 := v.Args[0]
4668
4669
4670
4671 for {
4672 a := v_0
4673 if v_1.Op != ssaop.OpRISCV64FMULS {
4674 break
4675 }
4676 y := v_1.Args[1]
4677 x := v_1.Args[0]
4678 if !(a.Block.Func.UseFMA(v)) {
4679 break
4680 }
4681 v.Reset(ssaop.OpRISCV64FNMSUBS)
4682 v.AddArg3(x, y, a)
4683 return true
4684 }
4685
4686
4687
4688 for {
4689 if v_0.Op != ssaop.OpRISCV64FMULS {
4690 break
4691 }
4692 y := v_0.Args[1]
4693 x := v_0.Args[0]
4694 a := v_1
4695 if !(a.Block.Func.UseFMA(v)) {
4696 break
4697 }
4698 v.Reset(ssaop.OpRISCV64FMSUBS)
4699 v.AddArg3(x, y, a)
4700 return true
4701 }
4702 return false
4703 }
4704 func rewriteValue_OpRISCV64LoweredPanicBoundsCR(v *ssa.Value) bool {
4705 v_1 := v.Args[1]
4706 v_0 := v.Args[0]
4707
4708
4709 for {
4710 kind := ssa.AuxIntToInt64(v.AuxInt)
4711 p := ssa.AuxToPanicBoundsC(v.Aux)
4712 if v_0.Op != ssaop.OpRISCV64MOVDconst {
4713 break
4714 }
4715 c := ssa.AuxIntToInt64(v_0.AuxInt)
4716 mem := v_1
4717 v.Reset(ssaop.OpRISCV64LoweredPanicBoundsCC)
4718 v.AuxInt = ssa.Int64ToAuxInt(kind)
4719 v.Aux = ssa.PanicBoundsCCToAux(ssa.PanicBoundsCC{Cx: p.C, Cy: c})
4720 v.AddArg(mem)
4721 return true
4722 }
4723 return false
4724 }
4725 func rewriteValue_OpRISCV64LoweredPanicBoundsRC(v *ssa.Value) bool {
4726 v_1 := v.Args[1]
4727 v_0 := v.Args[0]
4728
4729
4730 for {
4731 kind := ssa.AuxIntToInt64(v.AuxInt)
4732 p := ssa.AuxToPanicBoundsC(v.Aux)
4733 if v_0.Op != ssaop.OpRISCV64MOVDconst {
4734 break
4735 }
4736 c := ssa.AuxIntToInt64(v_0.AuxInt)
4737 mem := v_1
4738 v.Reset(ssaop.OpRISCV64LoweredPanicBoundsCC)
4739 v.AuxInt = ssa.Int64ToAuxInt(kind)
4740 v.Aux = ssa.PanicBoundsCCToAux(ssa.PanicBoundsCC{Cx: c, Cy: p.C})
4741 v.AddArg(mem)
4742 return true
4743 }
4744 return false
4745 }
4746 func rewriteValue_OpRISCV64LoweredPanicBoundsRR(v *ssa.Value) bool {
4747 v_2 := v.Args[2]
4748 v_1 := v.Args[1]
4749 v_0 := v.Args[0]
4750
4751
4752 for {
4753 kind := ssa.AuxIntToInt64(v.AuxInt)
4754 x := v_0
4755 if v_1.Op != ssaop.OpRISCV64MOVDconst {
4756 break
4757 }
4758 c := ssa.AuxIntToInt64(v_1.AuxInt)
4759 mem := v_2
4760 v.Reset(ssaop.OpRISCV64LoweredPanicBoundsRC)
4761 v.AuxInt = ssa.Int64ToAuxInt(kind)
4762 v.Aux = ssa.PanicBoundsCToAux(ssa.PanicBoundsC{C: c})
4763 v.AddArg2(x, mem)
4764 return true
4765 }
4766
4767
4768 for {
4769 kind := ssa.AuxIntToInt64(v.AuxInt)
4770 if v_0.Op != ssaop.OpRISCV64MOVDconst {
4771 break
4772 }
4773 c := ssa.AuxIntToInt64(v_0.AuxInt)
4774 y := v_1
4775 mem := v_2
4776 v.Reset(ssaop.OpRISCV64LoweredPanicBoundsCR)
4777 v.AuxInt = ssa.Int64ToAuxInt(kind)
4778 v.Aux = ssa.PanicBoundsCToAux(ssa.PanicBoundsC{C: c})
4779 v.AddArg2(y, mem)
4780 return true
4781 }
4782 return false
4783 }
4784 func rewriteValue_OpRISCV64MOVBUload(v *ssa.Value) bool {
4785 v_1 := v.Args[1]
4786 v_0 := v.Args[0]
4787 b := v.Block
4788 config := b.Func.Config
4789
4790
4791
4792 for {
4793 off1 := ssa.AuxIntToInt32(v.AuxInt)
4794 sym1 := ssa.AuxToSym(v.Aux)
4795 if v_0.Op != ssaop.OpRISCV64MOVaddr {
4796 break
4797 }
4798 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
4799 sym2 := ssa.AuxToSym(v_0.Aux)
4800 base := v_0.Args[0]
4801 mem := v_1
4802 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
4803 break
4804 }
4805 v.Reset(ssaop.OpRISCV64MOVBUload)
4806 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
4807 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
4808 v.AddArg2(base, mem)
4809 return true
4810 }
4811
4812
4813
4814 for {
4815 off1 := ssa.AuxIntToInt32(v.AuxInt)
4816 sym := ssa.AuxToSym(v.Aux)
4817 if v_0.Op != ssaop.OpRISCV64ADDI {
4818 break
4819 }
4820 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
4821 base := v_0.Args[0]
4822 mem := v_1
4823 if !(ssa.Is32Bit(int64(off1) + off2)) {
4824 break
4825 }
4826 v.Reset(ssaop.OpRISCV64MOVBUload)
4827 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
4828 v.Aux = ssa.SymToAux(sym)
4829 v.AddArg2(base, mem)
4830 return true
4831 }
4832
4833
4834
4835 for {
4836 off := ssa.AuxIntToInt32(v.AuxInt)
4837 sym := ssa.AuxToSym(v.Aux)
4838 ptr1 := v_0
4839 if v_1.Op != ssaop.OpRISCV64MOVBstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
4840 break
4841 }
4842 x := v_1.Args[1]
4843 ptr2 := v_1.Args[0]
4844 if !(ssa.IsSamePtr(ptr1, ptr2)) {
4845 break
4846 }
4847 v.Reset(ssaop.OpRISCV64MOVBUreg)
4848 v.AddArg(x)
4849 return true
4850 }
4851 return false
4852 }
4853 func rewriteValue_OpRISCV64MOVBUreg(v *ssa.Value) bool {
4854 v_0 := v.Args[0]
4855 b := v.Block
4856
4857
4858 for {
4859 x := v_0
4860 if x.Op != ssaop.OpRISCV64FLES {
4861 break
4862 }
4863 v.CopyOf(x)
4864 return true
4865 }
4866
4867
4868 for {
4869 x := v_0
4870 if x.Op != ssaop.OpRISCV64FLTS {
4871 break
4872 }
4873 v.CopyOf(x)
4874 return true
4875 }
4876
4877
4878 for {
4879 x := v_0
4880 if x.Op != ssaop.OpRISCV64FEQS {
4881 break
4882 }
4883 v.CopyOf(x)
4884 return true
4885 }
4886
4887
4888 for {
4889 x := v_0
4890 if x.Op != ssaop.OpRISCV64FNES {
4891 break
4892 }
4893 v.CopyOf(x)
4894 return true
4895 }
4896
4897
4898 for {
4899 x := v_0
4900 if x.Op != ssaop.OpRISCV64FLED {
4901 break
4902 }
4903 v.CopyOf(x)
4904 return true
4905 }
4906
4907
4908 for {
4909 x := v_0
4910 if x.Op != ssaop.OpRISCV64FLTD {
4911 break
4912 }
4913 v.CopyOf(x)
4914 return true
4915 }
4916
4917
4918 for {
4919 x := v_0
4920 if x.Op != ssaop.OpRISCV64FEQD {
4921 break
4922 }
4923 v.CopyOf(x)
4924 return true
4925 }
4926
4927
4928 for {
4929 x := v_0
4930 if x.Op != ssaop.OpRISCV64FNED {
4931 break
4932 }
4933 v.CopyOf(x)
4934 return true
4935 }
4936
4937
4938 for {
4939 x := v_0
4940 if x.Op != ssaop.OpRISCV64SEQZ {
4941 break
4942 }
4943 v.CopyOf(x)
4944 return true
4945 }
4946
4947
4948 for {
4949 x := v_0
4950 if x.Op != ssaop.OpRISCV64SNEZ {
4951 break
4952 }
4953 v.CopyOf(x)
4954 return true
4955 }
4956
4957
4958 for {
4959 x := v_0
4960 if x.Op != ssaop.OpRISCV64SLT {
4961 break
4962 }
4963 v.CopyOf(x)
4964 return true
4965 }
4966
4967
4968 for {
4969 x := v_0
4970 if x.Op != ssaop.OpRISCV64SLTU {
4971 break
4972 }
4973 v.CopyOf(x)
4974 return true
4975 }
4976
4977
4978
4979 for {
4980 x := v_0
4981 if x.Op != ssaop.OpRISCV64ANDI {
4982 break
4983 }
4984 c := ssa.AuxIntToInt64(x.AuxInt)
4985 if !(c >= 0 && int64(uint8(c)) == c) {
4986 break
4987 }
4988 v.CopyOf(x)
4989 return true
4990 }
4991
4992
4993
4994 for {
4995 if v_0.Op != ssaop.OpRISCV64ANDI {
4996 break
4997 }
4998 c := ssa.AuxIntToInt64(v_0.AuxInt)
4999 x := v_0.Args[0]
5000 if !(c < 0) {
5001 break
5002 }
5003 v.Reset(ssaop.OpRISCV64ANDI)
5004 v.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c)))
5005 v.AddArg(x)
5006 return true
5007 }
5008
5009
5010
5011 for {
5012 x := v_0
5013 if x.Op != ssaop.OpRISCV64SRLI {
5014 break
5015 }
5016 c := ssa.AuxIntToInt64(x.AuxInt)
5017 if !(c >= 56) {
5018 break
5019 }
5020 v.CopyOf(x)
5021 return true
5022 }
5023
5024
5025
5026 for {
5027 x := v_0
5028 if x.Op != ssaop.OpRISCV64SRLIW {
5029 break
5030 }
5031 c := ssa.AuxIntToInt64(x.AuxInt)
5032 if !(c >= 24) {
5033 break
5034 }
5035 v.CopyOf(x)
5036 return true
5037 }
5038
5039
5040 for {
5041 if v_0.Op != ssaop.OpRISCV64MOVDconst {
5042 break
5043 }
5044 c := ssa.AuxIntToInt64(v_0.AuxInt)
5045 v.Reset(ssaop.OpRISCV64MOVDconst)
5046 v.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c)))
5047 return true
5048 }
5049
5050
5051 for {
5052 x := v_0
5053 if x.Op != ssaop.OpRISCV64MOVBUload {
5054 break
5055 }
5056 v.Reset(ssaop.OpRISCV64MOVDreg)
5057 v.AddArg(x)
5058 return true
5059 }
5060
5061
5062 for {
5063 x := v_0
5064 if x.Op != ssaop.OpSelect0 {
5065 break
5066 }
5067 x_0 := x.Args[0]
5068 if x_0.Op != ssaop.OpRISCV64LoweredAtomicLoad8 {
5069 break
5070 }
5071 v.Reset(ssaop.OpRISCV64MOVDreg)
5072 v.AddArg(x)
5073 return true
5074 }
5075
5076
5077 for {
5078 x := v_0
5079 if x.Op != ssaop.OpSelect0 {
5080 break
5081 }
5082 x_0 := x.Args[0]
5083 if x_0.Op != ssaop.OpRISCV64LoweredAtomicCas32 {
5084 break
5085 }
5086 v.Reset(ssaop.OpRISCV64MOVDreg)
5087 v.AddArg(x)
5088 return true
5089 }
5090
5091
5092 for {
5093 x := v_0
5094 if x.Op != ssaop.OpSelect0 {
5095 break
5096 }
5097 x_0 := x.Args[0]
5098 if x_0.Op != ssaop.OpRISCV64LoweredAtomicCas64 {
5099 break
5100 }
5101 v.Reset(ssaop.OpRISCV64MOVDreg)
5102 v.AddArg(x)
5103 return true
5104 }
5105
5106
5107 for {
5108 x := v_0
5109 if x.Op != ssaop.OpRISCV64MOVBUreg {
5110 break
5111 }
5112 v.Reset(ssaop.OpRISCV64MOVDreg)
5113 v.AddArg(x)
5114 return true
5115 }
5116
5117
5118
5119 for {
5120 t := v.Type
5121 x := v_0
5122 if x.Op != ssaop.OpRISCV64MOVBload {
5123 break
5124 }
5125 off := ssa.AuxIntToInt32(x.AuxInt)
5126 sym := ssa.AuxToSym(x.Aux)
5127 mem := x.Args[1]
5128 ptr := x.Args[0]
5129 if !(x.Uses == 1 && ssa.Clobber(x)) {
5130 break
5131 }
5132 b = x.Block
5133 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVBUload, t)
5134 v.CopyOf(v0)
5135 v0.AuxInt = ssa.Int32ToAuxInt(off)
5136 v0.Aux = ssa.SymToAux(sym)
5137 v0.AddArg2(ptr, mem)
5138 return true
5139 }
5140 return false
5141 }
5142 func rewriteValue_OpRISCV64MOVBload(v *ssa.Value) bool {
5143 v_1 := v.Args[1]
5144 v_0 := v.Args[0]
5145 b := v.Block
5146 config := b.Func.Config
5147
5148
5149
5150 for {
5151 off1 := ssa.AuxIntToInt32(v.AuxInt)
5152 sym1 := ssa.AuxToSym(v.Aux)
5153 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5154 break
5155 }
5156 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5157 sym2 := ssa.AuxToSym(v_0.Aux)
5158 base := v_0.Args[0]
5159 mem := v_1
5160 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5161 break
5162 }
5163 v.Reset(ssaop.OpRISCV64MOVBload)
5164 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5165 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5166 v.AddArg2(base, mem)
5167 return true
5168 }
5169
5170
5171
5172 for {
5173 off1 := ssa.AuxIntToInt32(v.AuxInt)
5174 sym := ssa.AuxToSym(v.Aux)
5175 if v_0.Op != ssaop.OpRISCV64ADDI {
5176 break
5177 }
5178 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5179 base := v_0.Args[0]
5180 mem := v_1
5181 if !(ssa.Is32Bit(int64(off1) + off2)) {
5182 break
5183 }
5184 v.Reset(ssaop.OpRISCV64MOVBload)
5185 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5186 v.Aux = ssa.SymToAux(sym)
5187 v.AddArg2(base, mem)
5188 return true
5189 }
5190
5191
5192
5193 for {
5194 off := ssa.AuxIntToInt32(v.AuxInt)
5195 sym := ssa.AuxToSym(v.Aux)
5196 ptr1 := v_0
5197 if v_1.Op != ssaop.OpRISCV64MOVBstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
5198 break
5199 }
5200 x := v_1.Args[1]
5201 ptr2 := v_1.Args[0]
5202 if !(ssa.IsSamePtr(ptr1, ptr2)) {
5203 break
5204 }
5205 v.Reset(ssaop.OpRISCV64MOVBreg)
5206 v.AddArg(x)
5207 return true
5208 }
5209 return false
5210 }
5211 func rewriteValue_OpRISCV64MOVBreg(v *ssa.Value) bool {
5212 v_0 := v.Args[0]
5213 b := v.Block
5214
5215
5216
5217 for {
5218 x := v_0
5219 if x.Op != ssaop.OpRISCV64ANDI {
5220 break
5221 }
5222 c := ssa.AuxIntToInt64(x.AuxInt)
5223 if !(c >= 0 && int64(int8(c)) == c) {
5224 break
5225 }
5226 v.CopyOf(x)
5227 return true
5228 }
5229
5230
5231 for {
5232 if v_0.Op != ssaop.OpRISCV64MOVDconst {
5233 break
5234 }
5235 c := ssa.AuxIntToInt64(v_0.AuxInt)
5236 v.Reset(ssaop.OpRISCV64MOVDconst)
5237 v.AuxInt = ssa.Int64ToAuxInt(int64(int8(c)))
5238 return true
5239 }
5240
5241
5242 for {
5243 x := v_0
5244 if x.Op != ssaop.OpRISCV64MOVBload {
5245 break
5246 }
5247 v.Reset(ssaop.OpRISCV64MOVDreg)
5248 v.AddArg(x)
5249 return true
5250 }
5251
5252
5253 for {
5254 x := v_0
5255 if x.Op != ssaop.OpRISCV64MOVBreg {
5256 break
5257 }
5258 v.Reset(ssaop.OpRISCV64MOVDreg)
5259 v.AddArg(x)
5260 return true
5261 }
5262
5263
5264
5265 for {
5266 t := v.Type
5267 x := v_0
5268 if x.Op != ssaop.OpRISCV64MOVBUload {
5269 break
5270 }
5271 off := ssa.AuxIntToInt32(x.AuxInt)
5272 sym := ssa.AuxToSym(x.Aux)
5273 mem := x.Args[1]
5274 ptr := x.Args[0]
5275 if !(x.Uses == 1 && ssa.Clobber(x)) {
5276 break
5277 }
5278 b = x.Block
5279 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVBload, t)
5280 v.CopyOf(v0)
5281 v0.AuxInt = ssa.Int32ToAuxInt(off)
5282 v0.Aux = ssa.SymToAux(sym)
5283 v0.AddArg2(ptr, mem)
5284 return true
5285 }
5286 return false
5287 }
5288 func rewriteValue_OpRISCV64MOVBstore(v *ssa.Value) bool {
5289 v_2 := v.Args[2]
5290 v_1 := v.Args[1]
5291 v_0 := v.Args[0]
5292 b := v.Block
5293 config := b.Func.Config
5294
5295
5296
5297 for {
5298 off1 := ssa.AuxIntToInt32(v.AuxInt)
5299 sym1 := ssa.AuxToSym(v.Aux)
5300 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5301 break
5302 }
5303 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5304 sym2 := ssa.AuxToSym(v_0.Aux)
5305 base := v_0.Args[0]
5306 val := v_1
5307 mem := v_2
5308 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5309 break
5310 }
5311 v.Reset(ssaop.OpRISCV64MOVBstore)
5312 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5313 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5314 v.AddArg3(base, val, mem)
5315 return true
5316 }
5317
5318
5319
5320 for {
5321 off1 := ssa.AuxIntToInt32(v.AuxInt)
5322 sym := ssa.AuxToSym(v.Aux)
5323 if v_0.Op != ssaop.OpRISCV64ADDI {
5324 break
5325 }
5326 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5327 base := v_0.Args[0]
5328 val := v_1
5329 mem := v_2
5330 if !(ssa.Is32Bit(int64(off1) + off2)) {
5331 break
5332 }
5333 v.Reset(ssaop.OpRISCV64MOVBstore)
5334 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5335 v.Aux = ssa.SymToAux(sym)
5336 v.AddArg3(base, val, mem)
5337 return true
5338 }
5339
5340
5341 for {
5342 off := ssa.AuxIntToInt32(v.AuxInt)
5343 sym := ssa.AuxToSym(v.Aux)
5344 ptr := v_0
5345 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
5346 break
5347 }
5348 mem := v_2
5349 v.Reset(ssaop.OpRISCV64MOVBstorezero)
5350 v.AuxInt = ssa.Int32ToAuxInt(off)
5351 v.Aux = ssa.SymToAux(sym)
5352 v.AddArg2(ptr, mem)
5353 return true
5354 }
5355
5356
5357 for {
5358 off := ssa.AuxIntToInt32(v.AuxInt)
5359 sym := ssa.AuxToSym(v.Aux)
5360 ptr := v_0
5361 if v_1.Op != ssaop.OpRISCV64MOVBreg {
5362 break
5363 }
5364 x := v_1.Args[0]
5365 mem := v_2
5366 v.Reset(ssaop.OpRISCV64MOVBstore)
5367 v.AuxInt = ssa.Int32ToAuxInt(off)
5368 v.Aux = ssa.SymToAux(sym)
5369 v.AddArg3(ptr, x, mem)
5370 return true
5371 }
5372
5373
5374 for {
5375 off := ssa.AuxIntToInt32(v.AuxInt)
5376 sym := ssa.AuxToSym(v.Aux)
5377 ptr := v_0
5378 if v_1.Op != ssaop.OpRISCV64MOVHreg {
5379 break
5380 }
5381 x := v_1.Args[0]
5382 mem := v_2
5383 v.Reset(ssaop.OpRISCV64MOVBstore)
5384 v.AuxInt = ssa.Int32ToAuxInt(off)
5385 v.Aux = ssa.SymToAux(sym)
5386 v.AddArg3(ptr, x, mem)
5387 return true
5388 }
5389
5390
5391 for {
5392 off := ssa.AuxIntToInt32(v.AuxInt)
5393 sym := ssa.AuxToSym(v.Aux)
5394 ptr := v_0
5395 if v_1.Op != ssaop.OpRISCV64MOVWreg {
5396 break
5397 }
5398 x := v_1.Args[0]
5399 mem := v_2
5400 v.Reset(ssaop.OpRISCV64MOVBstore)
5401 v.AuxInt = ssa.Int32ToAuxInt(off)
5402 v.Aux = ssa.SymToAux(sym)
5403 v.AddArg3(ptr, x, mem)
5404 return true
5405 }
5406
5407
5408 for {
5409 off := ssa.AuxIntToInt32(v.AuxInt)
5410 sym := ssa.AuxToSym(v.Aux)
5411 ptr := v_0
5412 if v_1.Op != ssaop.OpRISCV64MOVBUreg {
5413 break
5414 }
5415 x := v_1.Args[0]
5416 mem := v_2
5417 v.Reset(ssaop.OpRISCV64MOVBstore)
5418 v.AuxInt = ssa.Int32ToAuxInt(off)
5419 v.Aux = ssa.SymToAux(sym)
5420 v.AddArg3(ptr, x, mem)
5421 return true
5422 }
5423
5424
5425 for {
5426 off := ssa.AuxIntToInt32(v.AuxInt)
5427 sym := ssa.AuxToSym(v.Aux)
5428 ptr := v_0
5429 if v_1.Op != ssaop.OpRISCV64MOVHUreg {
5430 break
5431 }
5432 x := v_1.Args[0]
5433 mem := v_2
5434 v.Reset(ssaop.OpRISCV64MOVBstore)
5435 v.AuxInt = ssa.Int32ToAuxInt(off)
5436 v.Aux = ssa.SymToAux(sym)
5437 v.AddArg3(ptr, x, mem)
5438 return true
5439 }
5440
5441
5442 for {
5443 off := ssa.AuxIntToInt32(v.AuxInt)
5444 sym := ssa.AuxToSym(v.Aux)
5445 ptr := v_0
5446 if v_1.Op != ssaop.OpRISCV64MOVWUreg {
5447 break
5448 }
5449 x := v_1.Args[0]
5450 mem := v_2
5451 v.Reset(ssaop.OpRISCV64MOVBstore)
5452 v.AuxInt = ssa.Int32ToAuxInt(off)
5453 v.Aux = ssa.SymToAux(sym)
5454 v.AddArg3(ptr, x, mem)
5455 return true
5456 }
5457 return false
5458 }
5459 func rewriteValue_OpRISCV64MOVBstorezero(v *ssa.Value) bool {
5460 v_1 := v.Args[1]
5461 v_0 := v.Args[0]
5462 b := v.Block
5463 config := b.Func.Config
5464
5465
5466
5467 for {
5468 off1 := ssa.AuxIntToInt32(v.AuxInt)
5469 sym1 := ssa.AuxToSym(v.Aux)
5470 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5471 break
5472 }
5473 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5474 sym2 := ssa.AuxToSym(v_0.Aux)
5475 base := v_0.Args[0]
5476 mem := v_1
5477 if !(ssa.CanMergeSym(sym1, sym2) && ssa.Is32Bit(int64(off1)+int64(off2)) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5478 break
5479 }
5480 v.Reset(ssaop.OpRISCV64MOVBstorezero)
5481 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5482 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5483 v.AddArg2(base, mem)
5484 return true
5485 }
5486
5487
5488
5489 for {
5490 off1 := ssa.AuxIntToInt32(v.AuxInt)
5491 sym := ssa.AuxToSym(v.Aux)
5492 if v_0.Op != ssaop.OpRISCV64ADDI {
5493 break
5494 }
5495 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5496 base := v_0.Args[0]
5497 mem := v_1
5498 if !(ssa.Is32Bit(int64(off1) + off2)) {
5499 break
5500 }
5501 v.Reset(ssaop.OpRISCV64MOVBstorezero)
5502 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5503 v.Aux = ssa.SymToAux(sym)
5504 v.AddArg2(base, mem)
5505 return true
5506 }
5507 return false
5508 }
5509 func rewriteValue_OpRISCV64MOVDload(v *ssa.Value) bool {
5510 v_1 := v.Args[1]
5511 v_0 := v.Args[0]
5512 b := v.Block
5513 config := b.Func.Config
5514
5515
5516
5517 for {
5518 off1 := ssa.AuxIntToInt32(v.AuxInt)
5519 sym1 := ssa.AuxToSym(v.Aux)
5520 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5521 break
5522 }
5523 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5524 sym2 := ssa.AuxToSym(v_0.Aux)
5525 base := v_0.Args[0]
5526 mem := v_1
5527 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5528 break
5529 }
5530 v.Reset(ssaop.OpRISCV64MOVDload)
5531 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5532 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5533 v.AddArg2(base, mem)
5534 return true
5535 }
5536
5537
5538
5539 for {
5540 off1 := ssa.AuxIntToInt32(v.AuxInt)
5541 sym := ssa.AuxToSym(v.Aux)
5542 if v_0.Op != ssaop.OpRISCV64ADDI {
5543 break
5544 }
5545 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5546 base := v_0.Args[0]
5547 mem := v_1
5548 if !(ssa.Is32Bit(int64(off1) + off2)) {
5549 break
5550 }
5551 v.Reset(ssaop.OpRISCV64MOVDload)
5552 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5553 v.Aux = ssa.SymToAux(sym)
5554 v.AddArg2(base, mem)
5555 return true
5556 }
5557
5558
5559
5560 for {
5561 off := ssa.AuxIntToInt32(v.AuxInt)
5562 sym := ssa.AuxToSym(v.Aux)
5563 ptr1 := v_0
5564 if v_1.Op != ssaop.OpRISCV64MOVDstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
5565 break
5566 }
5567 x := v_1.Args[1]
5568 ptr2 := v_1.Args[0]
5569 if !(ssa.IsSamePtr(ptr1, ptr2)) {
5570 break
5571 }
5572 v.Reset(ssaop.OpRISCV64MOVDreg)
5573 v.AddArg(x)
5574 return true
5575 }
5576
5577
5578
5579 for {
5580 off := ssa.AuxIntToInt32(v.AuxInt)
5581 sym := ssa.AuxToSym(v.Aux)
5582 ptr1 := v_0
5583 if v_1.Op != ssaop.OpRISCV64FMOVDstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
5584 break
5585 }
5586 x := v_1.Args[1]
5587 ptr2 := v_1.Args[0]
5588 if !(ssa.IsSamePtr(ptr1, ptr2)) {
5589 break
5590 }
5591 v.Reset(ssaop.OpRISCV64FMVXD)
5592 v.AddArg(x)
5593 return true
5594 }
5595 return false
5596 }
5597 func rewriteValue_OpRISCV64MOVDnop(v *ssa.Value) bool {
5598 v_0 := v.Args[0]
5599
5600
5601 for {
5602 if v_0.Op != ssaop.OpRISCV64MOVDconst {
5603 break
5604 }
5605 c := ssa.AuxIntToInt64(v_0.AuxInt)
5606 v.Reset(ssaop.OpRISCV64MOVDconst)
5607 v.AuxInt = ssa.Int64ToAuxInt(c)
5608 return true
5609 }
5610 return false
5611 }
5612 func rewriteValue_OpRISCV64MOVDreg(v *ssa.Value) bool {
5613 v_0 := v.Args[0]
5614
5615
5616
5617 for {
5618 x := v_0
5619 if !(x.Uses == 1) {
5620 break
5621 }
5622 v.Reset(ssaop.OpRISCV64MOVDnop)
5623 v.AddArg(x)
5624 return true
5625 }
5626 return false
5627 }
5628 func rewriteValue_OpRISCV64MOVDstore(v *ssa.Value) bool {
5629 v_2 := v.Args[2]
5630 v_1 := v.Args[1]
5631 v_0 := v.Args[0]
5632 b := v.Block
5633 config := b.Func.Config
5634
5635
5636
5637 for {
5638 off1 := ssa.AuxIntToInt32(v.AuxInt)
5639 sym1 := ssa.AuxToSym(v.Aux)
5640 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5641 break
5642 }
5643 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5644 sym2 := ssa.AuxToSym(v_0.Aux)
5645 base := v_0.Args[0]
5646 val := v_1
5647 mem := v_2
5648 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5649 break
5650 }
5651 v.Reset(ssaop.OpRISCV64MOVDstore)
5652 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5653 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5654 v.AddArg3(base, val, mem)
5655 return true
5656 }
5657
5658
5659
5660 for {
5661 off1 := ssa.AuxIntToInt32(v.AuxInt)
5662 sym := ssa.AuxToSym(v.Aux)
5663 if v_0.Op != ssaop.OpRISCV64ADDI {
5664 break
5665 }
5666 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5667 base := v_0.Args[0]
5668 val := v_1
5669 mem := v_2
5670 if !(ssa.Is32Bit(int64(off1) + off2)) {
5671 break
5672 }
5673 v.Reset(ssaop.OpRISCV64MOVDstore)
5674 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5675 v.Aux = ssa.SymToAux(sym)
5676 v.AddArg3(base, val, mem)
5677 return true
5678 }
5679
5680
5681 for {
5682 off := ssa.AuxIntToInt32(v.AuxInt)
5683 sym := ssa.AuxToSym(v.Aux)
5684 ptr := v_0
5685 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
5686 break
5687 }
5688 mem := v_2
5689 v.Reset(ssaop.OpRISCV64MOVDstorezero)
5690 v.AuxInt = ssa.Int32ToAuxInt(off)
5691 v.Aux = ssa.SymToAux(sym)
5692 v.AddArg2(ptr, mem)
5693 return true
5694 }
5695 return false
5696 }
5697 func rewriteValue_OpRISCV64MOVDstorezero(v *ssa.Value) bool {
5698 v_1 := v.Args[1]
5699 v_0 := v.Args[0]
5700 b := v.Block
5701 config := b.Func.Config
5702
5703
5704
5705 for {
5706 off1 := ssa.AuxIntToInt32(v.AuxInt)
5707 sym1 := ssa.AuxToSym(v.Aux)
5708 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5709 break
5710 }
5711 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5712 sym2 := ssa.AuxToSym(v_0.Aux)
5713 base := v_0.Args[0]
5714 mem := v_1
5715 if !(ssa.CanMergeSym(sym1, sym2) && ssa.Is32Bit(int64(off1)+int64(off2)) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5716 break
5717 }
5718 v.Reset(ssaop.OpRISCV64MOVDstorezero)
5719 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5720 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5721 v.AddArg2(base, mem)
5722 return true
5723 }
5724
5725
5726
5727 for {
5728 off1 := ssa.AuxIntToInt32(v.AuxInt)
5729 sym := ssa.AuxToSym(v.Aux)
5730 if v_0.Op != ssaop.OpRISCV64ADDI {
5731 break
5732 }
5733 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5734 base := v_0.Args[0]
5735 mem := v_1
5736 if !(ssa.Is32Bit(int64(off1) + off2)) {
5737 break
5738 }
5739 v.Reset(ssaop.OpRISCV64MOVDstorezero)
5740 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5741 v.Aux = ssa.SymToAux(sym)
5742 v.AddArg2(base, mem)
5743 return true
5744 }
5745 return false
5746 }
5747 func rewriteValue_OpRISCV64MOVHUload(v *ssa.Value) bool {
5748 v_1 := v.Args[1]
5749 v_0 := v.Args[0]
5750 b := v.Block
5751 config := b.Func.Config
5752
5753
5754
5755 for {
5756 off1 := ssa.AuxIntToInt32(v.AuxInt)
5757 sym1 := ssa.AuxToSym(v.Aux)
5758 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5759 break
5760 }
5761 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5762 sym2 := ssa.AuxToSym(v_0.Aux)
5763 base := v_0.Args[0]
5764 mem := v_1
5765 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5766 break
5767 }
5768 v.Reset(ssaop.OpRISCV64MOVHUload)
5769 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5770 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5771 v.AddArg2(base, mem)
5772 return true
5773 }
5774
5775
5776
5777 for {
5778 off1 := ssa.AuxIntToInt32(v.AuxInt)
5779 sym := ssa.AuxToSym(v.Aux)
5780 if v_0.Op != ssaop.OpRISCV64ADDI {
5781 break
5782 }
5783 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5784 base := v_0.Args[0]
5785 mem := v_1
5786 if !(ssa.Is32Bit(int64(off1) + off2)) {
5787 break
5788 }
5789 v.Reset(ssaop.OpRISCV64MOVHUload)
5790 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
5791 v.Aux = ssa.SymToAux(sym)
5792 v.AddArg2(base, mem)
5793 return true
5794 }
5795
5796
5797
5798 for {
5799 off := ssa.AuxIntToInt32(v.AuxInt)
5800 sym := ssa.AuxToSym(v.Aux)
5801 ptr1 := v_0
5802 if v_1.Op != ssaop.OpRISCV64MOVHstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
5803 break
5804 }
5805 x := v_1.Args[1]
5806 ptr2 := v_1.Args[0]
5807 if !(ssa.IsSamePtr(ptr1, ptr2)) {
5808 break
5809 }
5810 v.Reset(ssaop.OpRISCV64MOVHUreg)
5811 v.AddArg(x)
5812 return true
5813 }
5814 return false
5815 }
5816 func rewriteValue_OpRISCV64MOVHUreg(v *ssa.Value) bool {
5817 v_0 := v.Args[0]
5818 b := v.Block
5819
5820
5821
5822 for {
5823 x := v_0
5824 if x.Op != ssaop.OpRISCV64ANDI {
5825 break
5826 }
5827 c := ssa.AuxIntToInt64(x.AuxInt)
5828 if !(c >= 0 && int64(uint16(c)) == c) {
5829 break
5830 }
5831 v.CopyOf(x)
5832 return true
5833 }
5834
5835
5836
5837 for {
5838 if v_0.Op != ssaop.OpRISCV64ANDI {
5839 break
5840 }
5841 c := ssa.AuxIntToInt64(v_0.AuxInt)
5842 x := v_0.Args[0]
5843 if !(c < 0) {
5844 break
5845 }
5846 v.Reset(ssaop.OpRISCV64ANDI)
5847 v.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c)))
5848 v.AddArg(x)
5849 return true
5850 }
5851
5852
5853
5854 for {
5855 x := v_0
5856 if x.Op != ssaop.OpRISCV64SRLI {
5857 break
5858 }
5859 c := ssa.AuxIntToInt64(x.AuxInt)
5860 if !(c >= 48) {
5861 break
5862 }
5863 v.CopyOf(x)
5864 return true
5865 }
5866
5867
5868
5869 for {
5870 x := v_0
5871 if x.Op != ssaop.OpRISCV64SRLIW {
5872 break
5873 }
5874 c := ssa.AuxIntToInt64(x.AuxInt)
5875 if !(c >= 16) {
5876 break
5877 }
5878 v.CopyOf(x)
5879 return true
5880 }
5881
5882
5883 for {
5884 if v_0.Op != ssaop.OpRISCV64MOVDconst {
5885 break
5886 }
5887 c := ssa.AuxIntToInt64(v_0.AuxInt)
5888 v.Reset(ssaop.OpRISCV64MOVDconst)
5889 v.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c)))
5890 return true
5891 }
5892
5893
5894 for {
5895 x := v_0
5896 if x.Op != ssaop.OpRISCV64MOVBUload {
5897 break
5898 }
5899 v.Reset(ssaop.OpRISCV64MOVDreg)
5900 v.AddArg(x)
5901 return true
5902 }
5903
5904
5905 for {
5906 x := v_0
5907 if x.Op != ssaop.OpRISCV64MOVHUload {
5908 break
5909 }
5910 v.Reset(ssaop.OpRISCV64MOVDreg)
5911 v.AddArg(x)
5912 return true
5913 }
5914
5915
5916 for {
5917 x := v_0
5918 if x.Op != ssaop.OpRISCV64MOVBUreg {
5919 break
5920 }
5921 v.Reset(ssaop.OpRISCV64MOVDreg)
5922 v.AddArg(x)
5923 return true
5924 }
5925
5926
5927 for {
5928 x := v_0
5929 if x.Op != ssaop.OpRISCV64MOVHUreg {
5930 break
5931 }
5932 v.Reset(ssaop.OpRISCV64MOVDreg)
5933 v.AddArg(x)
5934 return true
5935 }
5936
5937
5938
5939 for {
5940 t := v.Type
5941 x := v_0
5942 if x.Op != ssaop.OpRISCV64MOVHload {
5943 break
5944 }
5945 off := ssa.AuxIntToInt32(x.AuxInt)
5946 sym := ssa.AuxToSym(x.Aux)
5947 mem := x.Args[1]
5948 ptr := x.Args[0]
5949 if !(x.Uses == 1 && ssa.Clobber(x)) {
5950 break
5951 }
5952 b = x.Block
5953 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVHUload, t)
5954 v.CopyOf(v0)
5955 v0.AuxInt = ssa.Int32ToAuxInt(off)
5956 v0.Aux = ssa.SymToAux(sym)
5957 v0.AddArg2(ptr, mem)
5958 return true
5959 }
5960 return false
5961 }
5962 func rewriteValue_OpRISCV64MOVHload(v *ssa.Value) bool {
5963 v_1 := v.Args[1]
5964 v_0 := v.Args[0]
5965 b := v.Block
5966 config := b.Func.Config
5967
5968
5969
5970 for {
5971 off1 := ssa.AuxIntToInt32(v.AuxInt)
5972 sym1 := ssa.AuxToSym(v.Aux)
5973 if v_0.Op != ssaop.OpRISCV64MOVaddr {
5974 break
5975 }
5976 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
5977 sym2 := ssa.AuxToSym(v_0.Aux)
5978 base := v_0.Args[0]
5979 mem := v_1
5980 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
5981 break
5982 }
5983 v.Reset(ssaop.OpRISCV64MOVHload)
5984 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
5985 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
5986 v.AddArg2(base, mem)
5987 return true
5988 }
5989
5990
5991
5992 for {
5993 off1 := ssa.AuxIntToInt32(v.AuxInt)
5994 sym := ssa.AuxToSym(v.Aux)
5995 if v_0.Op != ssaop.OpRISCV64ADDI {
5996 break
5997 }
5998 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
5999 base := v_0.Args[0]
6000 mem := v_1
6001 if !(ssa.Is32Bit(int64(off1) + off2)) {
6002 break
6003 }
6004 v.Reset(ssaop.OpRISCV64MOVHload)
6005 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
6006 v.Aux = ssa.SymToAux(sym)
6007 v.AddArg2(base, mem)
6008 return true
6009 }
6010
6011
6012
6013 for {
6014 off := ssa.AuxIntToInt32(v.AuxInt)
6015 sym := ssa.AuxToSym(v.Aux)
6016 ptr1 := v_0
6017 if v_1.Op != ssaop.OpRISCV64MOVHstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
6018 break
6019 }
6020 x := v_1.Args[1]
6021 ptr2 := v_1.Args[0]
6022 if !(ssa.IsSamePtr(ptr1, ptr2)) {
6023 break
6024 }
6025 v.Reset(ssaop.OpRISCV64MOVHreg)
6026 v.AddArg(x)
6027 return true
6028 }
6029 return false
6030 }
6031 func rewriteValue_OpRISCV64MOVHreg(v *ssa.Value) bool {
6032 v_0 := v.Args[0]
6033 b := v.Block
6034
6035
6036
6037 for {
6038 x := v_0
6039 if x.Op != ssaop.OpRISCV64ANDI {
6040 break
6041 }
6042 c := ssa.AuxIntToInt64(x.AuxInt)
6043 if !(c >= 0 && int64(int16(c)) == c) {
6044 break
6045 }
6046 v.CopyOf(x)
6047 return true
6048 }
6049
6050
6051 for {
6052 if v_0.Op != ssaop.OpRISCV64MOVDconst {
6053 break
6054 }
6055 c := ssa.AuxIntToInt64(v_0.AuxInt)
6056 v.Reset(ssaop.OpRISCV64MOVDconst)
6057 v.AuxInt = ssa.Int64ToAuxInt(int64(int16(c)))
6058 return true
6059 }
6060
6061
6062 for {
6063 x := v_0
6064 if x.Op != ssaop.OpRISCV64MOVBload {
6065 break
6066 }
6067 v.Reset(ssaop.OpRISCV64MOVDreg)
6068 v.AddArg(x)
6069 return true
6070 }
6071
6072
6073 for {
6074 x := v_0
6075 if x.Op != ssaop.OpRISCV64MOVBUload {
6076 break
6077 }
6078 v.Reset(ssaop.OpRISCV64MOVDreg)
6079 v.AddArg(x)
6080 return true
6081 }
6082
6083
6084 for {
6085 x := v_0
6086 if x.Op != ssaop.OpRISCV64MOVHload {
6087 break
6088 }
6089 v.Reset(ssaop.OpRISCV64MOVDreg)
6090 v.AddArg(x)
6091 return true
6092 }
6093
6094
6095 for {
6096 x := v_0
6097 if x.Op != ssaop.OpRISCV64MOVBreg {
6098 break
6099 }
6100 v.Reset(ssaop.OpRISCV64MOVDreg)
6101 v.AddArg(x)
6102 return true
6103 }
6104
6105
6106 for {
6107 x := v_0
6108 if x.Op != ssaop.OpRISCV64MOVBUreg {
6109 break
6110 }
6111 v.Reset(ssaop.OpRISCV64MOVDreg)
6112 v.AddArg(x)
6113 return true
6114 }
6115
6116
6117 for {
6118 x := v_0
6119 if x.Op != ssaop.OpRISCV64MOVHreg {
6120 break
6121 }
6122 v.Reset(ssaop.OpRISCV64MOVDreg)
6123 v.AddArg(x)
6124 return true
6125 }
6126
6127
6128
6129 for {
6130 t := v.Type
6131 x := v_0
6132 if x.Op != ssaop.OpRISCV64MOVHUload {
6133 break
6134 }
6135 off := ssa.AuxIntToInt32(x.AuxInt)
6136 sym := ssa.AuxToSym(x.Aux)
6137 mem := x.Args[1]
6138 ptr := x.Args[0]
6139 if !(x.Uses == 1 && ssa.Clobber(x)) {
6140 break
6141 }
6142 b = x.Block
6143 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVHload, t)
6144 v.CopyOf(v0)
6145 v0.AuxInt = ssa.Int32ToAuxInt(off)
6146 v0.Aux = ssa.SymToAux(sym)
6147 v0.AddArg2(ptr, mem)
6148 return true
6149 }
6150 return false
6151 }
6152 func rewriteValue_OpRISCV64MOVHstore(v *ssa.Value) bool {
6153 v_2 := v.Args[2]
6154 v_1 := v.Args[1]
6155 v_0 := v.Args[0]
6156 b := v.Block
6157 config := b.Func.Config
6158
6159
6160
6161 for {
6162 off1 := ssa.AuxIntToInt32(v.AuxInt)
6163 sym1 := ssa.AuxToSym(v.Aux)
6164 if v_0.Op != ssaop.OpRISCV64MOVaddr {
6165 break
6166 }
6167 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
6168 sym2 := ssa.AuxToSym(v_0.Aux)
6169 base := v_0.Args[0]
6170 val := v_1
6171 mem := v_2
6172 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
6173 break
6174 }
6175 v.Reset(ssaop.OpRISCV64MOVHstore)
6176 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
6177 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
6178 v.AddArg3(base, val, mem)
6179 return true
6180 }
6181
6182
6183
6184 for {
6185 off1 := ssa.AuxIntToInt32(v.AuxInt)
6186 sym := ssa.AuxToSym(v.Aux)
6187 if v_0.Op != ssaop.OpRISCV64ADDI {
6188 break
6189 }
6190 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
6191 base := v_0.Args[0]
6192 val := v_1
6193 mem := v_2
6194 if !(ssa.Is32Bit(int64(off1) + off2)) {
6195 break
6196 }
6197 v.Reset(ssaop.OpRISCV64MOVHstore)
6198 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
6199 v.Aux = ssa.SymToAux(sym)
6200 v.AddArg3(base, val, mem)
6201 return true
6202 }
6203
6204
6205 for {
6206 off := ssa.AuxIntToInt32(v.AuxInt)
6207 sym := ssa.AuxToSym(v.Aux)
6208 ptr := v_0
6209 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
6210 break
6211 }
6212 mem := v_2
6213 v.Reset(ssaop.OpRISCV64MOVHstorezero)
6214 v.AuxInt = ssa.Int32ToAuxInt(off)
6215 v.Aux = ssa.SymToAux(sym)
6216 v.AddArg2(ptr, mem)
6217 return true
6218 }
6219
6220
6221 for {
6222 off := ssa.AuxIntToInt32(v.AuxInt)
6223 sym := ssa.AuxToSym(v.Aux)
6224 ptr := v_0
6225 if v_1.Op != ssaop.OpRISCV64MOVHreg {
6226 break
6227 }
6228 x := v_1.Args[0]
6229 mem := v_2
6230 v.Reset(ssaop.OpRISCV64MOVHstore)
6231 v.AuxInt = ssa.Int32ToAuxInt(off)
6232 v.Aux = ssa.SymToAux(sym)
6233 v.AddArg3(ptr, x, mem)
6234 return true
6235 }
6236
6237
6238 for {
6239 off := ssa.AuxIntToInt32(v.AuxInt)
6240 sym := ssa.AuxToSym(v.Aux)
6241 ptr := v_0
6242 if v_1.Op != ssaop.OpRISCV64MOVWreg {
6243 break
6244 }
6245 x := v_1.Args[0]
6246 mem := v_2
6247 v.Reset(ssaop.OpRISCV64MOVHstore)
6248 v.AuxInt = ssa.Int32ToAuxInt(off)
6249 v.Aux = ssa.SymToAux(sym)
6250 v.AddArg3(ptr, x, mem)
6251 return true
6252 }
6253
6254
6255 for {
6256 off := ssa.AuxIntToInt32(v.AuxInt)
6257 sym := ssa.AuxToSym(v.Aux)
6258 ptr := v_0
6259 if v_1.Op != ssaop.OpRISCV64MOVHUreg {
6260 break
6261 }
6262 x := v_1.Args[0]
6263 mem := v_2
6264 v.Reset(ssaop.OpRISCV64MOVHstore)
6265 v.AuxInt = ssa.Int32ToAuxInt(off)
6266 v.Aux = ssa.SymToAux(sym)
6267 v.AddArg3(ptr, x, mem)
6268 return true
6269 }
6270
6271
6272 for {
6273 off := ssa.AuxIntToInt32(v.AuxInt)
6274 sym := ssa.AuxToSym(v.Aux)
6275 ptr := v_0
6276 if v_1.Op != ssaop.OpRISCV64MOVWUreg {
6277 break
6278 }
6279 x := v_1.Args[0]
6280 mem := v_2
6281 v.Reset(ssaop.OpRISCV64MOVHstore)
6282 v.AuxInt = ssa.Int32ToAuxInt(off)
6283 v.Aux = ssa.SymToAux(sym)
6284 v.AddArg3(ptr, x, mem)
6285 return true
6286 }
6287 return false
6288 }
6289 func rewriteValue_OpRISCV64MOVHstorezero(v *ssa.Value) bool {
6290 v_1 := v.Args[1]
6291 v_0 := v.Args[0]
6292 b := v.Block
6293 config := b.Func.Config
6294
6295
6296
6297 for {
6298 off1 := ssa.AuxIntToInt32(v.AuxInt)
6299 sym1 := ssa.AuxToSym(v.Aux)
6300 if v_0.Op != ssaop.OpRISCV64MOVaddr {
6301 break
6302 }
6303 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
6304 sym2 := ssa.AuxToSym(v_0.Aux)
6305 base := v_0.Args[0]
6306 mem := v_1
6307 if !(ssa.CanMergeSym(sym1, sym2) && ssa.Is32Bit(int64(off1)+int64(off2)) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
6308 break
6309 }
6310 v.Reset(ssaop.OpRISCV64MOVHstorezero)
6311 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
6312 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
6313 v.AddArg2(base, mem)
6314 return true
6315 }
6316
6317
6318
6319 for {
6320 off1 := ssa.AuxIntToInt32(v.AuxInt)
6321 sym := ssa.AuxToSym(v.Aux)
6322 if v_0.Op != ssaop.OpRISCV64ADDI {
6323 break
6324 }
6325 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
6326 base := v_0.Args[0]
6327 mem := v_1
6328 if !(ssa.Is32Bit(int64(off1) + off2)) {
6329 break
6330 }
6331 v.Reset(ssaop.OpRISCV64MOVHstorezero)
6332 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
6333 v.Aux = ssa.SymToAux(sym)
6334 v.AddArg2(base, mem)
6335 return true
6336 }
6337 return false
6338 }
6339 func rewriteValue_OpRISCV64MOVWUload(v *ssa.Value) bool {
6340 v_1 := v.Args[1]
6341 v_0 := v.Args[0]
6342 b := v.Block
6343 config := b.Func.Config
6344 typ := &b.Func.Config.Types
6345
6346
6347
6348 for {
6349 off1 := ssa.AuxIntToInt32(v.AuxInt)
6350 sym1 := ssa.AuxToSym(v.Aux)
6351 if v_0.Op != ssaop.OpRISCV64MOVaddr {
6352 break
6353 }
6354 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
6355 sym2 := ssa.AuxToSym(v_0.Aux)
6356 base := v_0.Args[0]
6357 mem := v_1
6358 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
6359 break
6360 }
6361 v.Reset(ssaop.OpRISCV64MOVWUload)
6362 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
6363 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
6364 v.AddArg2(base, mem)
6365 return true
6366 }
6367
6368
6369
6370 for {
6371 off1 := ssa.AuxIntToInt32(v.AuxInt)
6372 sym := ssa.AuxToSym(v.Aux)
6373 if v_0.Op != ssaop.OpRISCV64ADDI {
6374 break
6375 }
6376 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
6377 base := v_0.Args[0]
6378 mem := v_1
6379 if !(ssa.Is32Bit(int64(off1) + off2)) {
6380 break
6381 }
6382 v.Reset(ssaop.OpRISCV64MOVWUload)
6383 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
6384 v.Aux = ssa.SymToAux(sym)
6385 v.AddArg2(base, mem)
6386 return true
6387 }
6388
6389
6390
6391 for {
6392 off := ssa.AuxIntToInt32(v.AuxInt)
6393 sym := ssa.AuxToSym(v.Aux)
6394 ptr1 := v_0
6395 if v_1.Op != ssaop.OpRISCV64MOVWstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
6396 break
6397 }
6398 x := v_1.Args[1]
6399 ptr2 := v_1.Args[0]
6400 if !(ssa.IsSamePtr(ptr1, ptr2)) {
6401 break
6402 }
6403 v.Reset(ssaop.OpRISCV64MOVWUreg)
6404 v.AddArg(x)
6405 return true
6406 }
6407
6408
6409
6410 for {
6411 off := ssa.AuxIntToInt32(v.AuxInt)
6412 sym := ssa.AuxToSym(v.Aux)
6413 ptr1 := v_0
6414 if v_1.Op != ssaop.OpRISCV64FMOVWstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
6415 break
6416 }
6417 x := v_1.Args[1]
6418 ptr2 := v_1.Args[0]
6419 if !(ssa.IsSamePtr(ptr1, ptr2)) {
6420 break
6421 }
6422 v.Reset(ssaop.OpRISCV64MOVWUreg)
6423 v0 := b.NewValue0(v_1.Pos, ssaop.OpRISCV64FMVXS, typ.Int32)
6424 v0.AddArg(x)
6425 v.AddArg(v0)
6426 return true
6427 }
6428 return false
6429 }
6430 func rewriteValue_OpRISCV64MOVWUreg(v *ssa.Value) bool {
6431 v_0 := v.Args[0]
6432 b := v.Block
6433 typ := &b.Func.Config.Types
6434
6435
6436
6437 for {
6438 x := v_0
6439 if x.Op != ssaop.OpRISCV64ANDI {
6440 break
6441 }
6442 c := ssa.AuxIntToInt64(x.AuxInt)
6443 if !(c >= 0 && int64(uint32(c)) == c) {
6444 break
6445 }
6446 v.CopyOf(x)
6447 return true
6448 }
6449
6450
6451
6452 for {
6453 if v_0.Op != ssaop.OpRISCV64ANDI {
6454 break
6455 }
6456 c := ssa.AuxIntToInt64(v_0.AuxInt)
6457 x := v_0.Args[0]
6458 if !(c < 0) {
6459 break
6460 }
6461 v.Reset(ssaop.OpRISCV64AND)
6462 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
6463 v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c)))
6464 v.AddArg2(v0, x)
6465 return true
6466 }
6467
6468
6469
6470 for {
6471 x := v_0
6472 if x.Op != ssaop.OpRISCV64SRLI {
6473 break
6474 }
6475 c := ssa.AuxIntToInt64(x.AuxInt)
6476 if !(c >= 32) {
6477 break
6478 }
6479 v.CopyOf(x)
6480 return true
6481 }
6482
6483
6484 for {
6485 x := v_0
6486 if x.Op != ssaop.OpRISCV64SRLIW {
6487 break
6488 }
6489 v.CopyOf(x)
6490 return true
6491 }
6492
6493
6494 for {
6495 if v_0.Op != ssaop.OpRISCV64MOVDconst {
6496 break
6497 }
6498 c := ssa.AuxIntToInt64(v_0.AuxInt)
6499 v.Reset(ssaop.OpRISCV64MOVDconst)
6500 v.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c)))
6501 return true
6502 }
6503
6504
6505 for {
6506 x := v_0
6507 if x.Op != ssaop.OpRISCV64MOVBUload {
6508 break
6509 }
6510 v.Reset(ssaop.OpRISCV64MOVDreg)
6511 v.AddArg(x)
6512 return true
6513 }
6514
6515
6516 for {
6517 x := v_0
6518 if x.Op != ssaop.OpRISCV64MOVHUload {
6519 break
6520 }
6521 v.Reset(ssaop.OpRISCV64MOVDreg)
6522 v.AddArg(x)
6523 return true
6524 }
6525
6526
6527 for {
6528 x := v_0
6529 if x.Op != ssaop.OpRISCV64MOVWUload {
6530 break
6531 }
6532 v.Reset(ssaop.OpRISCV64MOVDreg)
6533 v.AddArg(x)
6534 return true
6535 }
6536
6537
6538 for {
6539 x := v_0
6540 if x.Op != ssaop.OpRISCV64MOVBUreg {
6541 break
6542 }
6543 v.Reset(ssaop.OpRISCV64MOVDreg)
6544 v.AddArg(x)
6545 return true
6546 }
6547
6548
6549 for {
6550 x := v_0
6551 if x.Op != ssaop.OpRISCV64MOVHUreg {
6552 break
6553 }
6554 v.Reset(ssaop.OpRISCV64MOVDreg)
6555 v.AddArg(x)
6556 return true
6557 }
6558
6559
6560 for {
6561 x := v_0
6562 if x.Op != ssaop.OpRISCV64MOVWUreg {
6563 break
6564 }
6565 v.Reset(ssaop.OpRISCV64MOVDreg)
6566 v.AddArg(x)
6567 return true
6568 }
6569
6570
6571
6572 for {
6573 t := v.Type
6574 x := v_0
6575 if x.Op != ssaop.OpRISCV64MOVWload {
6576 break
6577 }
6578 off := ssa.AuxIntToInt32(x.AuxInt)
6579 sym := ssa.AuxToSym(x.Aux)
6580 mem := x.Args[1]
6581 ptr := x.Args[0]
6582 if !(x.Uses == 1 && ssa.Clobber(x)) {
6583 break
6584 }
6585 b = x.Block
6586 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVWUload, t)
6587 v.CopyOf(v0)
6588 v0.AuxInt = ssa.Int32ToAuxInt(off)
6589 v0.Aux = ssa.SymToAux(sym)
6590 v0.AddArg2(ptr, mem)
6591 return true
6592 }
6593 return false
6594 }
6595 func rewriteValue_OpRISCV64MOVWload(v *ssa.Value) bool {
6596 v_1 := v.Args[1]
6597 v_0 := v.Args[0]
6598 b := v.Block
6599 config := b.Func.Config
6600
6601
6602
6603 for {
6604 off1 := ssa.AuxIntToInt32(v.AuxInt)
6605 sym1 := ssa.AuxToSym(v.Aux)
6606 if v_0.Op != ssaop.OpRISCV64MOVaddr {
6607 break
6608 }
6609 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
6610 sym2 := ssa.AuxToSym(v_0.Aux)
6611 base := v_0.Args[0]
6612 mem := v_1
6613 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
6614 break
6615 }
6616 v.Reset(ssaop.OpRISCV64MOVWload)
6617 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
6618 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
6619 v.AddArg2(base, mem)
6620 return true
6621 }
6622
6623
6624
6625 for {
6626 off1 := ssa.AuxIntToInt32(v.AuxInt)
6627 sym := ssa.AuxToSym(v.Aux)
6628 if v_0.Op != ssaop.OpRISCV64ADDI {
6629 break
6630 }
6631 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
6632 base := v_0.Args[0]
6633 mem := v_1
6634 if !(ssa.Is32Bit(int64(off1) + off2)) {
6635 break
6636 }
6637 v.Reset(ssaop.OpRISCV64MOVWload)
6638 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
6639 v.Aux = ssa.SymToAux(sym)
6640 v.AddArg2(base, mem)
6641 return true
6642 }
6643
6644
6645
6646 for {
6647 off := ssa.AuxIntToInt32(v.AuxInt)
6648 sym := ssa.AuxToSym(v.Aux)
6649 ptr1 := v_0
6650 if v_1.Op != ssaop.OpRISCV64MOVWstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
6651 break
6652 }
6653 x := v_1.Args[1]
6654 ptr2 := v_1.Args[0]
6655 if !(ssa.IsSamePtr(ptr1, ptr2)) {
6656 break
6657 }
6658 v.Reset(ssaop.OpRISCV64MOVWreg)
6659 v.AddArg(x)
6660 return true
6661 }
6662
6663
6664
6665 for {
6666 off := ssa.AuxIntToInt32(v.AuxInt)
6667 sym := ssa.AuxToSym(v.Aux)
6668 ptr1 := v_0
6669 if v_1.Op != ssaop.OpRISCV64FMOVWstore || ssa.AuxIntToInt32(v_1.AuxInt) != off || ssa.AuxToSym(v_1.Aux) != sym {
6670 break
6671 }
6672 x := v_1.Args[1]
6673 ptr2 := v_1.Args[0]
6674 if !(ssa.IsSamePtr(ptr1, ptr2)) {
6675 break
6676 }
6677 v.Reset(ssaop.OpRISCV64FMVXS)
6678 v.AddArg(x)
6679 return true
6680 }
6681 return false
6682 }
6683 func rewriteValue_OpRISCV64MOVWreg(v *ssa.Value) bool {
6684 v_0 := v.Args[0]
6685 b := v.Block
6686
6687
6688
6689 for {
6690 x := v_0
6691 if x.Op != ssaop.OpRISCV64ANDI {
6692 break
6693 }
6694 c := ssa.AuxIntToInt64(x.AuxInt)
6695 if !(c >= 0 && int64(int32(c)) == c) {
6696 break
6697 }
6698 v.CopyOf(x)
6699 return true
6700 }
6701
6702
6703 for {
6704 if v_0.Op != ssaop.OpRISCV64NEG {
6705 break
6706 }
6707 x := v_0.Args[0]
6708 v.Reset(ssaop.OpRISCV64NEGW)
6709 v.AddArg(x)
6710 return true
6711 }
6712
6713
6714 for {
6715 if v_0.Op != ssaop.OpRISCV64MOVDconst {
6716 break
6717 }
6718 c := ssa.AuxIntToInt64(v_0.AuxInt)
6719 v.Reset(ssaop.OpRISCV64MOVDconst)
6720 v.AuxInt = ssa.Int64ToAuxInt(int64(int32(c)))
6721 return true
6722 }
6723
6724
6725 for {
6726 x := v_0
6727 if x.Op != ssaop.OpRISCV64MOVBload {
6728 break
6729 }
6730 v.Reset(ssaop.OpRISCV64MOVDreg)
6731 v.AddArg(x)
6732 return true
6733 }
6734
6735
6736 for {
6737 x := v_0
6738 if x.Op != ssaop.OpRISCV64MOVBUload {
6739 break
6740 }
6741 v.Reset(ssaop.OpRISCV64MOVDreg)
6742 v.AddArg(x)
6743 return true
6744 }
6745
6746
6747 for {
6748 x := v_0
6749 if x.Op != ssaop.OpRISCV64MOVHload {
6750 break
6751 }
6752 v.Reset(ssaop.OpRISCV64MOVDreg)
6753 v.AddArg(x)
6754 return true
6755 }
6756
6757
6758 for {
6759 x := v_0
6760 if x.Op != ssaop.OpRISCV64MOVHUload {
6761 break
6762 }
6763 v.Reset(ssaop.OpRISCV64MOVDreg)
6764 v.AddArg(x)
6765 return true
6766 }
6767
6768
6769 for {
6770 x := v_0
6771 if x.Op != ssaop.OpRISCV64MOVWload {
6772 break
6773 }
6774 v.Reset(ssaop.OpRISCV64MOVDreg)
6775 v.AddArg(x)
6776 return true
6777 }
6778
6779
6780
6781 for {
6782 x := v_0
6783 if x.Op != ssaop.OpRISCV64ADDIW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6784 break
6785 }
6786 v.Reset(ssaop.OpRISCV64MOVDreg)
6787 v.AddArg(x)
6788 return true
6789 }
6790
6791
6792
6793 for {
6794 x := v_0
6795 if x.Op != ssaop.OpRISCV64SUBW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6796 break
6797 }
6798 v.Reset(ssaop.OpRISCV64MOVDreg)
6799 v.AddArg(x)
6800 return true
6801 }
6802
6803
6804
6805 for {
6806 x := v_0
6807 if x.Op != ssaop.OpRISCV64NEGW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6808 break
6809 }
6810 v.Reset(ssaop.OpRISCV64MOVDreg)
6811 v.AddArg(x)
6812 return true
6813 }
6814
6815
6816
6817 for {
6818 x := v_0
6819 if x.Op != ssaop.OpRISCV64MULW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6820 break
6821 }
6822 v.Reset(ssaop.OpRISCV64MOVDreg)
6823 v.AddArg(x)
6824 return true
6825 }
6826
6827
6828
6829 for {
6830 x := v_0
6831 if x.Op != ssaop.OpRISCV64DIVW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6832 break
6833 }
6834 v.Reset(ssaop.OpRISCV64MOVDreg)
6835 v.AddArg(x)
6836 return true
6837 }
6838
6839
6840
6841 for {
6842 x := v_0
6843 if x.Op != ssaop.OpRISCV64DIVUW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6844 break
6845 }
6846 v.Reset(ssaop.OpRISCV64MOVDreg)
6847 v.AddArg(x)
6848 return true
6849 }
6850
6851
6852
6853 for {
6854 x := v_0
6855 if x.Op != ssaop.OpRISCV64REMW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6856 break
6857 }
6858 v.Reset(ssaop.OpRISCV64MOVDreg)
6859 v.AddArg(x)
6860 return true
6861 }
6862
6863
6864
6865 for {
6866 x := v_0
6867 if x.Op != ssaop.OpRISCV64REMUW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6868 break
6869 }
6870 v.Reset(ssaop.OpRISCV64MOVDreg)
6871 v.AddArg(x)
6872 return true
6873 }
6874
6875
6876
6877 for {
6878 x := v_0
6879 if x.Op != ssaop.OpRISCV64ROLW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6880 break
6881 }
6882 v.Reset(ssaop.OpRISCV64MOVDreg)
6883 v.AddArg(x)
6884 return true
6885 }
6886
6887
6888
6889 for {
6890 x := v_0
6891 if x.Op != ssaop.OpRISCV64RORW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6892 break
6893 }
6894 v.Reset(ssaop.OpRISCV64MOVDreg)
6895 v.AddArg(x)
6896 return true
6897 }
6898
6899
6900
6901 for {
6902 x := v_0
6903 if x.Op != ssaop.OpRISCV64RORIW || !(x.Type.Size() == 8 || (x.Type.Size() == 4 && x.Type.IsSigned())) {
6904 break
6905 }
6906 v.Reset(ssaop.OpRISCV64MOVDreg)
6907 v.AddArg(x)
6908 return true
6909 }
6910
6911
6912 for {
6913 x := v_0
6914 if x.Op != ssaop.OpRISCV64MOVBreg {
6915 break
6916 }
6917 v.Reset(ssaop.OpRISCV64MOVDreg)
6918 v.AddArg(x)
6919 return true
6920 }
6921
6922
6923 for {
6924 x := v_0
6925 if x.Op != ssaop.OpRISCV64MOVBUreg {
6926 break
6927 }
6928 v.Reset(ssaop.OpRISCV64MOVDreg)
6929 v.AddArg(x)
6930 return true
6931 }
6932
6933
6934 for {
6935 x := v_0
6936 if x.Op != ssaop.OpRISCV64MOVHreg {
6937 break
6938 }
6939 v.Reset(ssaop.OpRISCV64MOVDreg)
6940 v.AddArg(x)
6941 return true
6942 }
6943
6944
6945 for {
6946 x := v_0
6947 if x.Op != ssaop.OpRISCV64MOVWreg {
6948 break
6949 }
6950 v.Reset(ssaop.OpRISCV64MOVDreg)
6951 v.AddArg(x)
6952 return true
6953 }
6954
6955
6956
6957 for {
6958 t := v.Type
6959 x := v_0
6960 if x.Op != ssaop.OpRISCV64MOVWUload {
6961 break
6962 }
6963 off := ssa.AuxIntToInt32(x.AuxInt)
6964 sym := ssa.AuxToSym(x.Aux)
6965 mem := x.Args[1]
6966 ptr := x.Args[0]
6967 if !(x.Uses == 1 && ssa.Clobber(x)) {
6968 break
6969 }
6970 b = x.Block
6971 v0 := b.NewValue0(x.Pos, ssaop.OpRISCV64MOVWload, t)
6972 v.CopyOf(v0)
6973 v0.AuxInt = ssa.Int32ToAuxInt(off)
6974 v0.Aux = ssa.SymToAux(sym)
6975 v0.AddArg2(ptr, mem)
6976 return true
6977 }
6978 return false
6979 }
6980 func rewriteValue_OpRISCV64MOVWstore(v *ssa.Value) bool {
6981 v_2 := v.Args[2]
6982 v_1 := v.Args[1]
6983 v_0 := v.Args[0]
6984 b := v.Block
6985 config := b.Func.Config
6986
6987
6988
6989 for {
6990 off1 := ssa.AuxIntToInt32(v.AuxInt)
6991 sym1 := ssa.AuxToSym(v.Aux)
6992 if v_0.Op != ssaop.OpRISCV64MOVaddr {
6993 break
6994 }
6995 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
6996 sym2 := ssa.AuxToSym(v_0.Aux)
6997 base := v_0.Args[0]
6998 val := v_1
6999 mem := v_2
7000 if !(ssa.Is32Bit(int64(off1)+int64(off2)) && ssa.CanMergeSym(sym1, sym2) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
7001 break
7002 }
7003 v.Reset(ssaop.OpRISCV64MOVWstore)
7004 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
7005 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
7006 v.AddArg3(base, val, mem)
7007 return true
7008 }
7009
7010
7011
7012 for {
7013 off1 := ssa.AuxIntToInt32(v.AuxInt)
7014 sym := ssa.AuxToSym(v.Aux)
7015 if v_0.Op != ssaop.OpRISCV64ADDI {
7016 break
7017 }
7018 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
7019 base := v_0.Args[0]
7020 val := v_1
7021 mem := v_2
7022 if !(ssa.Is32Bit(int64(off1) + off2)) {
7023 break
7024 }
7025 v.Reset(ssaop.OpRISCV64MOVWstore)
7026 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
7027 v.Aux = ssa.SymToAux(sym)
7028 v.AddArg3(base, val, mem)
7029 return true
7030 }
7031
7032
7033 for {
7034 off := ssa.AuxIntToInt32(v.AuxInt)
7035 sym := ssa.AuxToSym(v.Aux)
7036 ptr := v_0
7037 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
7038 break
7039 }
7040 mem := v_2
7041 v.Reset(ssaop.OpRISCV64MOVWstorezero)
7042 v.AuxInt = ssa.Int32ToAuxInt(off)
7043 v.Aux = ssa.SymToAux(sym)
7044 v.AddArg2(ptr, mem)
7045 return true
7046 }
7047
7048
7049 for {
7050 off := ssa.AuxIntToInt32(v.AuxInt)
7051 sym := ssa.AuxToSym(v.Aux)
7052 ptr := v_0
7053 if v_1.Op != ssaop.OpRISCV64MOVWreg {
7054 break
7055 }
7056 x := v_1.Args[0]
7057 mem := v_2
7058 v.Reset(ssaop.OpRISCV64MOVWstore)
7059 v.AuxInt = ssa.Int32ToAuxInt(off)
7060 v.Aux = ssa.SymToAux(sym)
7061 v.AddArg3(ptr, x, mem)
7062 return true
7063 }
7064
7065
7066 for {
7067 off := ssa.AuxIntToInt32(v.AuxInt)
7068 sym := ssa.AuxToSym(v.Aux)
7069 ptr := v_0
7070 if v_1.Op != ssaop.OpRISCV64MOVWUreg {
7071 break
7072 }
7073 x := v_1.Args[0]
7074 mem := v_2
7075 v.Reset(ssaop.OpRISCV64MOVWstore)
7076 v.AuxInt = ssa.Int32ToAuxInt(off)
7077 v.Aux = ssa.SymToAux(sym)
7078 v.AddArg3(ptr, x, mem)
7079 return true
7080 }
7081 return false
7082 }
7083 func rewriteValue_OpRISCV64MOVWstorezero(v *ssa.Value) bool {
7084 v_1 := v.Args[1]
7085 v_0 := v.Args[0]
7086 b := v.Block
7087 config := b.Func.Config
7088
7089
7090
7091 for {
7092 off1 := ssa.AuxIntToInt32(v.AuxInt)
7093 sym1 := ssa.AuxToSym(v.Aux)
7094 if v_0.Op != ssaop.OpRISCV64MOVaddr {
7095 break
7096 }
7097 off2 := ssa.AuxIntToInt32(v_0.AuxInt)
7098 sym2 := ssa.AuxToSym(v_0.Aux)
7099 base := v_0.Args[0]
7100 mem := v_1
7101 if !(ssa.CanMergeSym(sym1, sym2) && ssa.Is32Bit(int64(off1)+int64(off2)) && (base.Op != ssaop.OpSB || !config.Ctxt.Flag_dynlink)) {
7102 break
7103 }
7104 v.Reset(ssaop.OpRISCV64MOVWstorezero)
7105 v.AuxInt = ssa.Int32ToAuxInt(off1 + off2)
7106 v.Aux = ssa.SymToAux(ssa.MergeSym(sym1, sym2))
7107 v.AddArg2(base, mem)
7108 return true
7109 }
7110
7111
7112
7113 for {
7114 off1 := ssa.AuxIntToInt32(v.AuxInt)
7115 sym := ssa.AuxToSym(v.Aux)
7116 if v_0.Op != ssaop.OpRISCV64ADDI {
7117 break
7118 }
7119 off2 := ssa.AuxIntToInt64(v_0.AuxInt)
7120 base := v_0.Args[0]
7121 mem := v_1
7122 if !(ssa.Is32Bit(int64(off1) + off2)) {
7123 break
7124 }
7125 v.Reset(ssaop.OpRISCV64MOVWstorezero)
7126 v.AuxInt = ssa.Int32ToAuxInt(off1 + int32(off2))
7127 v.Aux = ssa.SymToAux(sym)
7128 v.AddArg2(base, mem)
7129 return true
7130 }
7131 return false
7132 }
7133 func rewriteValue_OpRISCV64MUL(v *ssa.Value) bool {
7134 v_1 := v.Args[1]
7135 v_0 := v.Args[0]
7136 b := v.Block
7137
7138
7139
7140 for {
7141 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7142 x := v_0
7143 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7144 continue
7145 }
7146 c := ssa.AuxIntToInt64(v_1.AuxInt)
7147 if !(c%3 == 0 && ssa.IsPowerOfTwo(c/3) && buildcfg.GORISCV64 >= 22) {
7148 continue
7149 }
7150 v.Reset(ssaop.OpRISCV64SLLI)
7151 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 3))
7152 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH1ADD, x.Type)
7153 v0.AddArg2(x, x)
7154 v.AddArg(v0)
7155 return true
7156 }
7157 break
7158 }
7159
7160
7161
7162 for {
7163 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7164 x := v_0
7165 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7166 continue
7167 }
7168 c := ssa.AuxIntToInt64(v_1.AuxInt)
7169 if !(c%5 == 0 && ssa.IsPowerOfTwo(c/5) && buildcfg.GORISCV64 >= 22) {
7170 continue
7171 }
7172 v.Reset(ssaop.OpRISCV64SLLI)
7173 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 5))
7174 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH2ADD, x.Type)
7175 v0.AddArg2(x, x)
7176 v.AddArg(v0)
7177 return true
7178 }
7179 break
7180 }
7181
7182
7183
7184 for {
7185 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7186 x := v_0
7187 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7188 continue
7189 }
7190 c := ssa.AuxIntToInt64(v_1.AuxInt)
7191 if !(c%9 == 0 && ssa.IsPowerOfTwo(c/9) && buildcfg.GORISCV64 >= 22) {
7192 continue
7193 }
7194 v.Reset(ssaop.OpRISCV64SLLI)
7195 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 9))
7196 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH3ADD, x.Type)
7197 v0.AddArg2(x, x)
7198 v.AddArg(v0)
7199 return true
7200 }
7201 break
7202 }
7203 return false
7204 }
7205 func rewriteValue_OpRISCV64MULW(v *ssa.Value) bool {
7206 v_1 := v.Args[1]
7207 v_0 := v.Args[0]
7208 b := v.Block
7209
7210
7211
7212 for {
7213 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7214 x := v_0
7215 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7216 continue
7217 }
7218 c := ssa.AuxIntToInt64(v_1.AuxInt)
7219 if !(c%3 == 0 && ssa.IsPowerOfTwo(c/3) && buildcfg.GORISCV64 >= 22) {
7220 continue
7221 }
7222 v.Reset(ssaop.OpRISCV64SLLIW)
7223 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 3))
7224 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH1ADD, x.Type)
7225 v0.AddArg2(x, x)
7226 v.AddArg(v0)
7227 return true
7228 }
7229 break
7230 }
7231
7232
7233
7234 for {
7235 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7236 x := v_0
7237 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7238 continue
7239 }
7240 c := ssa.AuxIntToInt64(v_1.AuxInt)
7241 if !(c%5 == 0 && ssa.IsPowerOfTwo(c/5) && buildcfg.GORISCV64 >= 22) {
7242 continue
7243 }
7244 v.Reset(ssaop.OpRISCV64SLLIW)
7245 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 5))
7246 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH2ADD, x.Type)
7247 v0.AddArg2(x, x)
7248 v.AddArg(v0)
7249 return true
7250 }
7251 break
7252 }
7253
7254
7255
7256 for {
7257 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7258 x := v_0
7259 if v_1.Op != ssaop.OpRISCV64MOVDconst {
7260 continue
7261 }
7262 c := ssa.AuxIntToInt64(v_1.AuxInt)
7263 if !(c%9 == 0 && ssa.IsPowerOfTwo(c/9) && buildcfg.GORISCV64 >= 22) {
7264 continue
7265 }
7266 v.Reset(ssaop.OpRISCV64SLLIW)
7267 v.AuxInt = ssa.Int64ToAuxInt(ssa.Log64(c / 9))
7268 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SH3ADD, x.Type)
7269 v0.AddArg2(x, x)
7270 v.AddArg(v0)
7271 return true
7272 }
7273 break
7274 }
7275 return false
7276 }
7277 func rewriteValue_OpRISCV64NEG(v *ssa.Value) bool {
7278 v_0 := v.Args[0]
7279 b := v.Block
7280
7281
7282 for {
7283 if v_0.Op != ssaop.OpRISCV64SUB {
7284 break
7285 }
7286 y := v_0.Args[1]
7287 x := v_0.Args[0]
7288 v.Reset(ssaop.OpRISCV64SUB)
7289 v.AddArg2(y, x)
7290 return true
7291 }
7292
7293
7294
7295 for {
7296 t := v.Type
7297 s := v_0
7298 if s.Op != ssaop.OpRISCV64ADDI {
7299 break
7300 }
7301 val := ssa.AuxIntToInt64(s.AuxInt)
7302 s_0 := s.Args[0]
7303 if s_0.Op != ssaop.OpRISCV64SUB {
7304 break
7305 }
7306 y := s_0.Args[1]
7307 x := s_0.Args[0]
7308 if !(s.Uses == 1 && ssa.Is32Bit(-val)) {
7309 break
7310 }
7311 v.Reset(ssaop.OpRISCV64ADDI)
7312 v.AuxInt = ssa.Int64ToAuxInt(-val)
7313 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, t)
7314 v0.AddArg2(y, x)
7315 v.AddArg(v0)
7316 return true
7317 }
7318
7319
7320 for {
7321 if v_0.Op != ssaop.OpRISCV64NEG {
7322 break
7323 }
7324 x := v_0.Args[0]
7325 v.CopyOf(x)
7326 return true
7327 }
7328
7329
7330
7331 for {
7332 s := v_0
7333 if s.Op != ssaop.OpRISCV64ADDI {
7334 break
7335 }
7336 val := ssa.AuxIntToInt64(s.AuxInt)
7337 s_0 := s.Args[0]
7338 if s_0.Op != ssaop.OpRISCV64NEG {
7339 break
7340 }
7341 x := s_0.Args[0]
7342 if !(s.Uses == 1 && ssa.Is32Bit(-val)) {
7343 break
7344 }
7345 v.Reset(ssaop.OpRISCV64ADDI)
7346 v.AuxInt = ssa.Int64ToAuxInt(-val)
7347 v.AddArg(x)
7348 return true
7349 }
7350
7351
7352 for {
7353 if v_0.Op != ssaop.OpRISCV64MOVDconst {
7354 break
7355 }
7356 x := ssa.AuxIntToInt64(v_0.AuxInt)
7357 v.Reset(ssaop.OpRISCV64MOVDconst)
7358 v.AuxInt = ssa.Int64ToAuxInt(-x)
7359 return true
7360 }
7361 return false
7362 }
7363 func rewriteValue_OpRISCV64NEGW(v *ssa.Value) bool {
7364 v_0 := v.Args[0]
7365
7366
7367 for {
7368 if v_0.Op != ssaop.OpRISCV64MOVDconst {
7369 break
7370 }
7371 x := ssa.AuxIntToInt64(v_0.AuxInt)
7372 v.Reset(ssaop.OpRISCV64MOVDconst)
7373 v.AuxInt = ssa.Int64ToAuxInt(int64(int32(-x)))
7374 return true
7375 }
7376 return false
7377 }
7378 func rewriteValue_OpRISCV64OR(v *ssa.Value) bool {
7379 v_1 := v.Args[1]
7380 v_0 := v.Args[0]
7381 b := v.Block
7382 typ := &b.Func.Config.Types
7383
7384
7385
7386 for {
7387 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7388 if v_0.Op != ssaop.OpRISCV64MOVDconst {
7389 continue
7390 }
7391 val := ssa.AuxIntToInt64(v_0.AuxInt)
7392 x := v_1
7393 if !(ssa.Is32Bit(val)) {
7394 continue
7395 }
7396 v.Reset(ssaop.OpRISCV64ORI)
7397 v.AuxInt = ssa.Int64ToAuxInt(val)
7398 v.AddArg(x)
7399 return true
7400 }
7401 break
7402 }
7403
7404
7405 for {
7406 x := v_0
7407 if x != v_1 {
7408 break
7409 }
7410 v.CopyOf(x)
7411 return true
7412 }
7413
7414
7415 for {
7416 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7417 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7418 continue
7419 }
7420 t := v_0.Type
7421 cond := v_0.Args[1]
7422 x := v_0.Args[0]
7423 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7424 continue
7425 }
7426 _ = v_1.Args[1]
7427 v_1_0 := v_1.Args[0]
7428 if v_1_0.Op != ssaop.OpRISCV64ADD {
7429 continue
7430 }
7431 _ = v_1_0.Args[1]
7432 v_1_0_0 := v_1_0.Args[0]
7433 v_1_0_1 := v_1_0.Args[1]
7434 for _i1 := 0; _i1 <= 1; _i1, v_1_0_0, v_1_0_1 = _i1+1, v_1_0_1, v_1_0_0 {
7435 if x != v_1_0_0 {
7436 continue
7437 }
7438 y := v_1_0_1
7439 if cond != v_1.Args[1] {
7440 continue
7441 }
7442 v.Reset(ssaop.OpRISCV64ADD)
7443 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7444 v0.AddArg2(y, cond)
7445 v.AddArg2(x, v0)
7446 return true
7447 }
7448 }
7449 break
7450 }
7451
7452
7453 for {
7454 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7455 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7456 continue
7457 }
7458 t := v_0.Type
7459 cond := v_0.Args[1]
7460 x := v_0.Args[0]
7461 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7462 continue
7463 }
7464 _ = v_1.Args[1]
7465 v_1_0 := v_1.Args[0]
7466 if v_1_0.Op != ssaop.OpRISCV64SUB {
7467 continue
7468 }
7469 y := v_1_0.Args[1]
7470 if x != v_1_0.Args[0] || cond != v_1.Args[1] {
7471 continue
7472 }
7473 v.Reset(ssaop.OpRISCV64SUB)
7474 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7475 v0.AddArg2(y, cond)
7476 v.AddArg2(x, v0)
7477 return true
7478 }
7479 break
7480 }
7481
7482
7483 for {
7484 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7485 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7486 continue
7487 }
7488 t := v_0.Type
7489 cond := v_0.Args[1]
7490 x := v_0.Args[0]
7491 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7492 continue
7493 }
7494 _ = v_1.Args[1]
7495 v_1_0 := v_1.Args[0]
7496 if v_1_0.Op != ssaop.OpRISCV64OR {
7497 continue
7498 }
7499 _ = v_1_0.Args[1]
7500 v_1_0_0 := v_1_0.Args[0]
7501 v_1_0_1 := v_1_0.Args[1]
7502 for _i1 := 0; _i1 <= 1; _i1, v_1_0_0, v_1_0_1 = _i1+1, v_1_0_1, v_1_0_0 {
7503 if x != v_1_0_0 {
7504 continue
7505 }
7506 y := v_1_0_1
7507 if cond != v_1.Args[1] {
7508 continue
7509 }
7510 v.Reset(ssaop.OpRISCV64OR)
7511 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7512 v0.AddArg2(y, cond)
7513 v.AddArg2(x, v0)
7514 return true
7515 }
7516 }
7517 break
7518 }
7519
7520
7521 for {
7522 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7523 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7524 continue
7525 }
7526 t := v_0.Type
7527 cond := v_0.Args[1]
7528 x := v_0.Args[0]
7529 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7530 continue
7531 }
7532 _ = v_1.Args[1]
7533 v_1_0 := v_1.Args[0]
7534 if v_1_0.Op != ssaop.OpRISCV64XOR {
7535 continue
7536 }
7537 _ = v_1_0.Args[1]
7538 v_1_0_0 := v_1_0.Args[0]
7539 v_1_0_1 := v_1_0.Args[1]
7540 for _i1 := 0; _i1 <= 1; _i1, v_1_0_0, v_1_0_1 = _i1+1, v_1_0_1, v_1_0_0 {
7541 if x != v_1_0_0 {
7542 continue
7543 }
7544 y := v_1_0_1
7545 if cond != v_1.Args[1] {
7546 continue
7547 }
7548 v.Reset(ssaop.OpRISCV64XOR)
7549 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7550 v0.AddArg2(y, cond)
7551 v.AddArg2(x, v0)
7552 return true
7553 }
7554 }
7555 break
7556 }
7557
7558
7559 for {
7560 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7561 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7562 continue
7563 }
7564 t := v_0.Type
7565 cond := v_0.Args[1]
7566 x := v_0.Args[0]
7567 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7568 continue
7569 }
7570 _ = v_1.Args[1]
7571 v_1_0 := v_1.Args[0]
7572 if v_1_0.Op != ssaop.OpRISCV64SUBW {
7573 continue
7574 }
7575 y := v_1_0.Args[1]
7576 if x != v_1_0.Args[0] || cond != v_1.Args[1] {
7577 continue
7578 }
7579 v.Reset(ssaop.OpRISCV64SUBW)
7580 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7581 v0.AddArg2(y, cond)
7582 v.AddArg2(x, v0)
7583 return true
7584 }
7585 break
7586 }
7587
7588
7589 for {
7590 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7591 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7592 continue
7593 }
7594 t := v_0.Type
7595 cond := v_0.Args[1]
7596 v_0_0 := v_0.Args[0]
7597 if v_0_0.Op != ssaop.OpRISCV64ADD {
7598 continue
7599 }
7600 _ = v_0_0.Args[1]
7601 v_0_0_0 := v_0_0.Args[0]
7602 v_0_0_1 := v_0_0.Args[1]
7603 for _i1 := 0; _i1 <= 1; _i1, v_0_0_0, v_0_0_1 = _i1+1, v_0_0_1, v_0_0_0 {
7604 x := v_0_0_0
7605 y := v_0_0_1
7606 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7607 continue
7608 }
7609 _ = v_1.Args[1]
7610 if x != v_1.Args[0] || cond != v_1.Args[1] {
7611 continue
7612 }
7613 v.Reset(ssaop.OpRISCV64ADD)
7614 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7615 v0.AddArg2(y, cond)
7616 v.AddArg2(x, v0)
7617 return true
7618 }
7619 }
7620 break
7621 }
7622
7623
7624 for {
7625 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7626 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7627 continue
7628 }
7629 t := v_0.Type
7630 cond := v_0.Args[1]
7631 v_0_0 := v_0.Args[0]
7632 if v_0_0.Op != ssaop.OpRISCV64SUB {
7633 continue
7634 }
7635 y := v_0_0.Args[1]
7636 x := v_0_0.Args[0]
7637 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7638 continue
7639 }
7640 _ = v_1.Args[1]
7641 if x != v_1.Args[0] || cond != v_1.Args[1] {
7642 continue
7643 }
7644 v.Reset(ssaop.OpRISCV64SUB)
7645 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7646 v0.AddArg2(y, cond)
7647 v.AddArg2(x, v0)
7648 return true
7649 }
7650 break
7651 }
7652
7653
7654 for {
7655 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7656 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7657 continue
7658 }
7659 t := v_0.Type
7660 cond := v_0.Args[1]
7661 v_0_0 := v_0.Args[0]
7662 if v_0_0.Op != ssaop.OpRISCV64OR {
7663 continue
7664 }
7665 _ = v_0_0.Args[1]
7666 v_0_0_0 := v_0_0.Args[0]
7667 v_0_0_1 := v_0_0.Args[1]
7668 for _i1 := 0; _i1 <= 1; _i1, v_0_0_0, v_0_0_1 = _i1+1, v_0_0_1, v_0_0_0 {
7669 x := v_0_0_0
7670 y := v_0_0_1
7671 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7672 continue
7673 }
7674 _ = v_1.Args[1]
7675 if x != v_1.Args[0] || cond != v_1.Args[1] {
7676 continue
7677 }
7678 v.Reset(ssaop.OpRISCV64OR)
7679 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7680 v0.AddArg2(y, cond)
7681 v.AddArg2(x, v0)
7682 return true
7683 }
7684 }
7685 break
7686 }
7687
7688
7689 for {
7690 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7691 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7692 continue
7693 }
7694 t := v_0.Type
7695 cond := v_0.Args[1]
7696 v_0_0 := v_0.Args[0]
7697 if v_0_0.Op != ssaop.OpRISCV64XOR {
7698 continue
7699 }
7700 _ = v_0_0.Args[1]
7701 v_0_0_0 := v_0_0.Args[0]
7702 v_0_0_1 := v_0_0.Args[1]
7703 for _i1 := 0; _i1 <= 1; _i1, v_0_0_0, v_0_0_1 = _i1+1, v_0_0_1, v_0_0_0 {
7704 x := v_0_0_0
7705 y := v_0_0_1
7706 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7707 continue
7708 }
7709 _ = v_1.Args[1]
7710 if x != v_1.Args[0] || cond != v_1.Args[1] {
7711 continue
7712 }
7713 v.Reset(ssaop.OpRISCV64XOR)
7714 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7715 v0.AddArg2(y, cond)
7716 v.AddArg2(x, v0)
7717 return true
7718 }
7719 }
7720 break
7721 }
7722
7723
7724 for {
7725 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7726 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7727 continue
7728 }
7729 t := v_0.Type
7730 cond := v_0.Args[1]
7731 v_0_0 := v_0.Args[0]
7732 if v_0_0.Op != ssaop.OpRISCV64SUBW {
7733 continue
7734 }
7735 y := v_0_0.Args[1]
7736 x := v_0_0.Args[0]
7737 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7738 continue
7739 }
7740 _ = v_1.Args[1]
7741 if x != v_1.Args[0] || cond != v_1.Args[1] {
7742 continue
7743 }
7744 v.Reset(ssaop.OpRISCV64SUBW)
7745 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7746 v0.AddArg2(y, cond)
7747 v.AddArg2(x, v0)
7748 return true
7749 }
7750 break
7751 }
7752
7753
7754 for {
7755 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7756 x := v_0
7757 if x.Op != ssaop.OpRISCV64CZEROEQZ {
7758 continue
7759 }
7760 cond := x.Args[1]
7761 z := x.Args[0]
7762 if v_1.Op != ssaop.OpRISCV64CZERONEZ {
7763 continue
7764 }
7765 _ = v_1.Args[1]
7766 y := v_1.Args[0]
7767 if y.Op != ssaop.OpRISCV64AND {
7768 continue
7769 }
7770 y_0 := y.Args[0]
7771 y_1 := y.Args[1]
7772 for _i1 := 0; _i1 <= 1; _i1, y_0, y_1 = _i1+1, y_1, y_0 {
7773 if z != y_0 || cond != v_1.Args[1] {
7774 continue
7775 }
7776 v.Reset(ssaop.OpRISCV64OR)
7777 v.AddArg2(y, x)
7778 return true
7779 }
7780 }
7781 break
7782 }
7783
7784
7785 for {
7786 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7787 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7788 continue
7789 }
7790 cond := v_0.Args[1]
7791 x := v_0.Args[0]
7792 if x.Op != ssaop.OpRISCV64AND {
7793 continue
7794 }
7795 x_0 := x.Args[0]
7796 x_1 := x.Args[1]
7797 for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 {
7798 z := x_0
7799 y := v_1
7800 if y.Op != ssaop.OpRISCV64CZERONEZ {
7801 continue
7802 }
7803 _ = y.Args[1]
7804 if z != y.Args[0] || cond != y.Args[1] {
7805 continue
7806 }
7807 v.Reset(ssaop.OpRISCV64OR)
7808 v.AddArg2(x, y)
7809 return true
7810 }
7811 }
7812 break
7813 }
7814
7815
7816 for {
7817 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7818 x := v_0
7819 if x.Op != ssaop.OpRISCV64CZEROEQZ {
7820 continue
7821 }
7822 cond := x.Args[1]
7823 z := x.Args[0]
7824 if v_1.Op != ssaop.OpRISCV64CZERONEZ {
7825 continue
7826 }
7827 _ = v_1.Args[1]
7828 y := v_1.Args[0]
7829 if y.Op != ssaop.OpRISCV64ANDI {
7830 continue
7831 }
7832 if z != y.Args[0] || cond != v_1.Args[1] {
7833 continue
7834 }
7835 v.Reset(ssaop.OpRISCV64OR)
7836 v.AddArg2(y, x)
7837 return true
7838 }
7839 break
7840 }
7841
7842
7843 for {
7844 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7845 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7846 continue
7847 }
7848 cond := v_0.Args[1]
7849 x := v_0.Args[0]
7850 if x.Op != ssaop.OpRISCV64ANDI {
7851 continue
7852 }
7853 z := x.Args[0]
7854 y := v_1
7855 if y.Op != ssaop.OpRISCV64CZERONEZ {
7856 continue
7857 }
7858 _ = y.Args[1]
7859 if z != y.Args[0] || cond != y.Args[1] {
7860 continue
7861 }
7862 v.Reset(ssaop.OpRISCV64OR)
7863 v.AddArg2(x, y)
7864 return true
7865 }
7866 break
7867 }
7868
7869
7870 for {
7871 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7872 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7873 continue
7874 }
7875 t := v_0.Type
7876 cond := v_0.Args[1]
7877 x := v_0.Args[0]
7878 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7879 continue
7880 }
7881 _ = v_1.Args[1]
7882 v_1_0 := v_1.Args[0]
7883 if v_1_0.Op != ssaop.OpRISCV64ADDI {
7884 continue
7885 }
7886 c := ssa.AuxIntToInt64(v_1_0.AuxInt)
7887 if x != v_1_0.Args[0] || cond != v_1.Args[1] {
7888 continue
7889 }
7890 v.Reset(ssaop.OpRISCV64ADD)
7891 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7892 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
7893 v1.AuxInt = ssa.Int64ToAuxInt(c)
7894 v0.AddArg2(v1, cond)
7895 v.AddArg2(x, v0)
7896 return true
7897 }
7898 break
7899 }
7900
7901
7902 for {
7903 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7904 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7905 continue
7906 }
7907 t := v_0.Type
7908 cond := v_0.Args[1]
7909 x := v_0.Args[0]
7910 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7911 continue
7912 }
7913 _ = v_1.Args[1]
7914 v_1_0 := v_1.Args[0]
7915 if v_1_0.Op != ssaop.OpRISCV64ORI {
7916 continue
7917 }
7918 c := ssa.AuxIntToInt64(v_1_0.AuxInt)
7919 if x != v_1_0.Args[0] || cond != v_1.Args[1] {
7920 continue
7921 }
7922 v.Reset(ssaop.OpRISCV64OR)
7923 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7924 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
7925 v1.AuxInt = ssa.Int64ToAuxInt(c)
7926 v0.AddArg2(v1, cond)
7927 v.AddArg2(x, v0)
7928 return true
7929 }
7930 break
7931 }
7932
7933
7934 for {
7935 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7936 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7937 continue
7938 }
7939 t := v_0.Type
7940 cond := v_0.Args[1]
7941 x := v_0.Args[0]
7942 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7943 continue
7944 }
7945 _ = v_1.Args[1]
7946 v_1_0 := v_1.Args[0]
7947 if v_1_0.Op != ssaop.OpRISCV64XORI {
7948 continue
7949 }
7950 c := ssa.AuxIntToInt64(v_1_0.AuxInt)
7951 if x != v_1_0.Args[0] || cond != v_1.Args[1] {
7952 continue
7953 }
7954 v.Reset(ssaop.OpRISCV64XOR)
7955 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZERONEZ, t)
7956 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
7957 v1.AuxInt = ssa.Int64ToAuxInt(c)
7958 v0.AddArg2(v1, cond)
7959 v.AddArg2(x, v0)
7960 return true
7961 }
7962 break
7963 }
7964
7965
7966 for {
7967 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7968 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
7969 continue
7970 }
7971 t := v_0.Type
7972 cond := v_0.Args[1]
7973 v_0_0 := v_0.Args[0]
7974 if v_0_0.Op != ssaop.OpRISCV64ADDI {
7975 continue
7976 }
7977 c := ssa.AuxIntToInt64(v_0_0.AuxInt)
7978 x := v_0_0.Args[0]
7979 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
7980 continue
7981 }
7982 _ = v_1.Args[1]
7983 if x != v_1.Args[0] || cond != v_1.Args[1] {
7984 continue
7985 }
7986 v.Reset(ssaop.OpRISCV64ADD)
7987 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
7988 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
7989 v1.AuxInt = ssa.Int64ToAuxInt(c)
7990 v0.AddArg2(v1, cond)
7991 v.AddArg2(x, v0)
7992 return true
7993 }
7994 break
7995 }
7996
7997
7998 for {
7999 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8000 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
8001 continue
8002 }
8003 t := v_0.Type
8004 cond := v_0.Args[1]
8005 v_0_0 := v_0.Args[0]
8006 if v_0_0.Op != ssaop.OpRISCV64ORI {
8007 continue
8008 }
8009 c := ssa.AuxIntToInt64(v_0_0.AuxInt)
8010 x := v_0_0.Args[0]
8011 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
8012 continue
8013 }
8014 _ = v_1.Args[1]
8015 if x != v_1.Args[0] || cond != v_1.Args[1] {
8016 continue
8017 }
8018 v.Reset(ssaop.OpRISCV64OR)
8019 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
8020 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
8021 v1.AuxInt = ssa.Int64ToAuxInt(c)
8022 v0.AddArg2(v1, cond)
8023 v.AddArg2(x, v0)
8024 return true
8025 }
8026 break
8027 }
8028
8029
8030 for {
8031 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8032 if v_0.Op != ssaop.OpRISCV64CZEROEQZ {
8033 continue
8034 }
8035 t := v_0.Type
8036 cond := v_0.Args[1]
8037 v_0_0 := v_0.Args[0]
8038 if v_0_0.Op != ssaop.OpRISCV64XORI {
8039 continue
8040 }
8041 c := ssa.AuxIntToInt64(v_0_0.AuxInt)
8042 x := v_0_0.Args[0]
8043 if v_1.Op != ssaop.OpRISCV64CZERONEZ || v_1.Type != t {
8044 continue
8045 }
8046 _ = v_1.Args[1]
8047 if x != v_1.Args[0] || cond != v_1.Args[1] {
8048 continue
8049 }
8050 v.Reset(ssaop.OpRISCV64XOR)
8051 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64CZEROEQZ, t)
8052 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
8053 v1.AuxInt = ssa.Int64ToAuxInt(c)
8054 v0.AddArg2(v1, cond)
8055 v.AddArg2(x, v0)
8056 return true
8057 }
8058 break
8059 }
8060 return false
8061 }
8062 func rewriteValue_OpRISCV64ORI(v *ssa.Value) bool {
8063 v_0 := v.Args[0]
8064
8065
8066 for {
8067 if ssa.AuxIntToInt64(v.AuxInt) != 0 {
8068 break
8069 }
8070 x := v_0
8071 v.CopyOf(x)
8072 return true
8073 }
8074
8075
8076 for {
8077 if ssa.AuxIntToInt64(v.AuxInt) != -1 {
8078 break
8079 }
8080 v.Reset(ssaop.OpRISCV64MOVDconst)
8081 v.AuxInt = ssa.Int64ToAuxInt(-1)
8082 return true
8083 }
8084
8085
8086 for {
8087 x := ssa.AuxIntToInt64(v.AuxInt)
8088 if v_0.Op != ssaop.OpRISCV64MOVDconst {
8089 break
8090 }
8091 y := ssa.AuxIntToInt64(v_0.AuxInt)
8092 v.Reset(ssaop.OpRISCV64MOVDconst)
8093 v.AuxInt = ssa.Int64ToAuxInt(x | y)
8094 return true
8095 }
8096
8097
8098 for {
8099 x := ssa.AuxIntToInt64(v.AuxInt)
8100 if v_0.Op != ssaop.OpRISCV64ORI {
8101 break
8102 }
8103 y := ssa.AuxIntToInt64(v_0.AuxInt)
8104 z := v_0.Args[0]
8105 v.Reset(ssaop.OpRISCV64ORI)
8106 v.AuxInt = ssa.Int64ToAuxInt(x | y)
8107 v.AddArg(z)
8108 return true
8109 }
8110 return false
8111 }
8112 func rewriteValue_OpRISCV64ORN(v *ssa.Value) bool {
8113 v_1 := v.Args[1]
8114 v_0 := v.Args[0]
8115
8116
8117 for {
8118 x := v_0
8119 if x != v_1 {
8120 break
8121 }
8122 v.Reset(ssaop.OpRISCV64MOVDconst)
8123 v.AuxInt = ssa.Int64ToAuxInt(-1)
8124 return true
8125 }
8126 return false
8127 }
8128 func rewriteValue_OpRISCV64ROL(v *ssa.Value) bool {
8129 v_1 := v.Args[1]
8130 v_0 := v.Args[0]
8131
8132
8133 for {
8134 x := v_0
8135 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8136 break
8137 }
8138 val := ssa.AuxIntToInt64(v_1.AuxInt)
8139 v.Reset(ssaop.OpRISCV64RORI)
8140 v.AuxInt = ssa.Int64ToAuxInt(-val & 63)
8141 v.AddArg(x)
8142 return true
8143 }
8144
8145
8146 for {
8147 x := v_0
8148 if v_1.Op != ssaop.OpRISCV64NEG {
8149 break
8150 }
8151 y := v_1.Args[0]
8152 v.Reset(ssaop.OpRISCV64ROR)
8153 v.AddArg2(x, y)
8154 return true
8155 }
8156 return false
8157 }
8158 func rewriteValue_OpRISCV64ROLW(v *ssa.Value) bool {
8159 v_1 := v.Args[1]
8160 v_0 := v.Args[0]
8161
8162
8163 for {
8164 x := v_0
8165 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8166 break
8167 }
8168 val := ssa.AuxIntToInt64(v_1.AuxInt)
8169 v.Reset(ssaop.OpRISCV64RORIW)
8170 v.AuxInt = ssa.Int64ToAuxInt(-val & 31)
8171 v.AddArg(x)
8172 return true
8173 }
8174
8175
8176 for {
8177 x := v_0
8178 if v_1.Op != ssaop.OpRISCV64NEG {
8179 break
8180 }
8181 y := v_1.Args[0]
8182 v.Reset(ssaop.OpRISCV64RORW)
8183 v.AddArg2(x, y)
8184 return true
8185 }
8186 return false
8187 }
8188 func rewriteValue_OpRISCV64ROR(v *ssa.Value) bool {
8189 v_1 := v.Args[1]
8190 v_0 := v.Args[0]
8191
8192
8193 for {
8194 x := v_0
8195 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8196 break
8197 }
8198 val := ssa.AuxIntToInt64(v_1.AuxInt)
8199 v.Reset(ssaop.OpRISCV64RORI)
8200 v.AuxInt = ssa.Int64ToAuxInt(val & 63)
8201 v.AddArg(x)
8202 return true
8203 }
8204 return false
8205 }
8206 func rewriteValue_OpRISCV64RORW(v *ssa.Value) bool {
8207 v_1 := v.Args[1]
8208 v_0 := v.Args[0]
8209
8210
8211 for {
8212 x := v_0
8213 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8214 break
8215 }
8216 val := ssa.AuxIntToInt64(v_1.AuxInt)
8217 v.Reset(ssaop.OpRISCV64RORIW)
8218 v.AuxInt = ssa.Int64ToAuxInt(val & 31)
8219 v.AddArg(x)
8220 return true
8221 }
8222 return false
8223 }
8224 func rewriteValue_OpRISCV64SEQZ(v *ssa.Value) bool {
8225 v_0 := v.Args[0]
8226 b := v.Block
8227 typ := &b.Func.Config.Types
8228
8229
8230 for {
8231 if v_0.Op != ssaop.OpRISCV64NEG {
8232 break
8233 }
8234 x := v_0.Args[0]
8235 v.Reset(ssaop.OpRISCV64SEQZ)
8236 v.AddArg(x)
8237 return true
8238 }
8239
8240
8241 for {
8242 if v_0.Op != ssaop.OpRISCV64SEQZ {
8243 break
8244 }
8245 x := v_0.Args[0]
8246 v.Reset(ssaop.OpRISCV64SNEZ)
8247 v.AddArg(x)
8248 return true
8249 }
8250
8251
8252 for {
8253 if v_0.Op != ssaop.OpRISCV64SNEZ {
8254 break
8255 }
8256 x := v_0.Args[0]
8257 v.Reset(ssaop.OpRISCV64SEQZ)
8258 v.AddArg(x)
8259 return true
8260 }
8261
8262
8263
8264 for {
8265 a := v_0
8266 if a.Op != ssaop.OpRISCV64ANDI {
8267 break
8268 }
8269 x := ssa.AuxIntToInt64(a.AuxInt)
8270 y := a.Args[0]
8271 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
8272 break
8273 }
8274 v.Reset(ssaop.OpRISCV64SEQZ)
8275 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8276 v0.AuxInt = ssa.Int64ToAuxInt(1)
8277 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
8278 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
8279 v1.AddArg(y)
8280 v0.AddArg(v1)
8281 v.AddArg(v0)
8282 return true
8283 }
8284
8285
8286
8287 for {
8288 a := v_0
8289 if a.Op != ssaop.OpRISCV64AND {
8290 break
8291 }
8292 _ = a.Args[1]
8293 a_0 := a.Args[0]
8294 a_1 := a.Args[1]
8295 for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 {
8296 if a_0.Op != ssaop.OpRISCV64MOVDconst {
8297 continue
8298 }
8299 x := ssa.AuxIntToInt64(a_0.AuxInt)
8300 y := a_1
8301 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
8302 continue
8303 }
8304 v.Reset(ssaop.OpRISCV64SEQZ)
8305 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8306 v0.AuxInt = ssa.Int64ToAuxInt(1)
8307 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
8308 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
8309 v1.AddArg(y)
8310 v0.AddArg(v1)
8311 v.AddArg(v0)
8312 return true
8313 }
8314 break
8315 }
8316
8317
8318
8319 for {
8320 a := v_0
8321 if a.Op != ssaop.OpRISCV64ANDI {
8322 break
8323 }
8324 x := ssa.AuxIntToInt64(a.AuxInt)
8325 a_0 := a.Args[0]
8326 if a_0.Op != ssaop.OpRISCV64SRLI {
8327 break
8328 }
8329 y := ssa.AuxIntToInt64(a_0.AuxInt)
8330 z := a_0.Args[0]
8331 if !(ssa.IsPowerOfTwo(uint64(x)) && ssa.Is12Bit(x<<y) && a.Uses == 1) {
8332 break
8333 }
8334 v.Reset(ssaop.OpRISCV64SEQZ)
8335 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8336 v0.AuxInt = ssa.Int64ToAuxInt(x << y)
8337 v0.AddArg(z)
8338 v.AddArg(v0)
8339 return true
8340 }
8341
8342
8343 for {
8344 if v_0.Op != ssaop.OpRISCV64ANDI {
8345 break
8346 }
8347 c := ssa.AuxIntToInt64(v_0.AuxInt)
8348 v_0_0 := v_0.Args[0]
8349 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
8350 break
8351 }
8352 v_0_0_0 := v_0_0.Args[0]
8353 if v_0_0_0.Op != ssaop.OpRISCV64FNEGD {
8354 break
8355 }
8356 x := v_0_0_0.Args[0]
8357 v.Reset(ssaop.OpRISCV64SEQZ)
8358 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
8359 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_0000_0000) | int64(bits.Reverse8(uint8(c))&0b1111_1111))
8360 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
8361 v1.AddArg(x)
8362 v0.AddArg(v1)
8363 v.AddArg(v0)
8364 return true
8365 }
8366
8367
8368 for {
8369 if v_0.Op != ssaop.OpRISCV64ANDI {
8370 break
8371 }
8372 c := ssa.AuxIntToInt64(v_0.AuxInt)
8373 v_0_0 := v_0.Args[0]
8374 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
8375 break
8376 }
8377 v_0_0_0 := v_0_0.Args[0]
8378 if v_0_0_0.Op != ssaop.OpRISCV64FABSD {
8379 break
8380 }
8381 x := v_0_0_0.Args[0]
8382 v.Reset(ssaop.OpRISCV64SEQZ)
8383 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
8384 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_1111_0000) | int64(bits.Reverse8(uint8(c))&0b0000_1111))
8385 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
8386 v1.AddArg(x)
8387 v0.AddArg(v1)
8388 v.AddArg(v0)
8389 return true
8390 }
8391 return false
8392 }
8393 func rewriteValue_OpRISCV64SLL(v *ssa.Value) bool {
8394 v_1 := v.Args[1]
8395 v_0 := v.Args[0]
8396
8397
8398 for {
8399 x := v_0
8400 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 63 {
8401 break
8402 }
8403 y := v_1.Args[0]
8404 v.Reset(ssaop.OpRISCV64SLL)
8405 v.AddArg2(x, y)
8406 return true
8407 }
8408
8409
8410 for {
8411 x := v_0
8412 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8413 break
8414 }
8415 val := ssa.AuxIntToInt64(v_1.AuxInt)
8416 v.Reset(ssaop.OpRISCV64SLLI)
8417 v.AuxInt = ssa.Int64ToAuxInt(val & 63)
8418 v.AddArg(x)
8419 return true
8420 }
8421 return false
8422 }
8423 func rewriteValue_OpRISCV64SLLI(v *ssa.Value) bool {
8424 v_0 := v.Args[0]
8425
8426
8427
8428 for {
8429 x := ssa.AuxIntToInt64(v.AuxInt)
8430 if v_0.Op != ssaop.OpRISCV64MOVDconst {
8431 break
8432 }
8433 y := ssa.AuxIntToInt64(v_0.AuxInt)
8434 if !(ssa.Is32Bit(y << uint32(x))) {
8435 break
8436 }
8437 v.Reset(ssaop.OpRISCV64MOVDconst)
8438 v.AuxInt = ssa.Int64ToAuxInt(y << uint32(x))
8439 return true
8440 }
8441
8442
8443
8444 for {
8445 t := v.Type
8446 c := ssa.AuxIntToInt64(v.AuxInt)
8447 if v_0.Op != ssaop.OpRISCV64ADD {
8448 break
8449 }
8450 x := v_0.Args[1]
8451 if x != v_0.Args[0] || !(c < t.Size()*8-1) {
8452 break
8453 }
8454 v.Reset(ssaop.OpRISCV64SLLI)
8455 v.AuxInt = ssa.Int64ToAuxInt(c + 1)
8456 v.AddArg(x)
8457 return true
8458 }
8459
8460
8461
8462 for {
8463 t := v.Type
8464 c := ssa.AuxIntToInt64(v.AuxInt)
8465 if v_0.Op != ssaop.OpRISCV64ADD {
8466 break
8467 }
8468 x := v_0.Args[1]
8469 if x != v_0.Args[0] || !(c >= t.Size()*8-1) {
8470 break
8471 }
8472 v.Reset(ssaop.OpRISCV64MOVDconst)
8473 v.AuxInt = ssa.Int64ToAuxInt(0)
8474 return true
8475 }
8476 return false
8477 }
8478 func rewriteValue_OpRISCV64SLLW(v *ssa.Value) bool {
8479 v_1 := v.Args[1]
8480 v_0 := v.Args[0]
8481
8482
8483 for {
8484 x := v_0
8485 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 31 {
8486 break
8487 }
8488 y := v_1.Args[0]
8489 v.Reset(ssaop.OpRISCV64SLLW)
8490 v.AddArg2(x, y)
8491 return true
8492 }
8493
8494
8495 for {
8496 x := v_0
8497 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8498 break
8499 }
8500 val := ssa.AuxIntToInt64(v_1.AuxInt)
8501 v.Reset(ssaop.OpRISCV64SLLIW)
8502 v.AuxInt = ssa.Int64ToAuxInt(val & 31)
8503 v.AddArg(x)
8504 return true
8505 }
8506 return false
8507 }
8508 func rewriteValue_OpRISCV64SLT(v *ssa.Value) bool {
8509 v_1 := v.Args[1]
8510 v_0 := v.Args[0]
8511
8512
8513
8514 for {
8515 x := v_0
8516 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8517 break
8518 }
8519 val := ssa.AuxIntToInt64(v_1.AuxInt)
8520 if !(ssa.Is12Bit(val)) {
8521 break
8522 }
8523 v.Reset(ssaop.OpRISCV64SLTI)
8524 v.AuxInt = ssa.Int64ToAuxInt(val)
8525 v.AddArg(x)
8526 return true
8527 }
8528
8529
8530 for {
8531 x := v_0
8532 if x != v_1 {
8533 break
8534 }
8535 v.Reset(ssaop.OpRISCV64MOVDconst)
8536 v.AuxInt = ssa.Int64ToAuxInt(0)
8537 return true
8538 }
8539 return false
8540 }
8541 func rewriteValue_OpRISCV64SLTI(v *ssa.Value) bool {
8542 v_0 := v.Args[0]
8543
8544
8545 for {
8546 x := ssa.AuxIntToInt64(v.AuxInt)
8547 if v_0.Op != ssaop.OpRISCV64MOVDconst {
8548 break
8549 }
8550 y := ssa.AuxIntToInt64(v_0.AuxInt)
8551 v.Reset(ssaop.OpRISCV64MOVDconst)
8552 v.AuxInt = ssa.Int64ToAuxInt(ssa.B2i(int64(y) < int64(x)))
8553 return true
8554 }
8555
8556
8557
8558 for {
8559 x := ssa.AuxIntToInt64(v.AuxInt)
8560 if v_0.Op != ssaop.OpRISCV64ANDI {
8561 break
8562 }
8563 y := ssa.AuxIntToInt64(v_0.AuxInt)
8564 if !(y >= 0 && int64(y) < int64(x)) {
8565 break
8566 }
8567 v.Reset(ssaop.OpRISCV64MOVDconst)
8568 v.AuxInt = ssa.Int64ToAuxInt(1)
8569 return true
8570 }
8571 return false
8572 }
8573 func rewriteValue_OpRISCV64SLTIU(v *ssa.Value) bool {
8574 v_0 := v.Args[0]
8575
8576
8577 for {
8578 x := ssa.AuxIntToInt64(v.AuxInt)
8579 if v_0.Op != ssaop.OpRISCV64MOVDconst {
8580 break
8581 }
8582 y := ssa.AuxIntToInt64(v_0.AuxInt)
8583 v.Reset(ssaop.OpRISCV64MOVDconst)
8584 v.AuxInt = ssa.Int64ToAuxInt(ssa.B2i(uint64(y) < uint64(x)))
8585 return true
8586 }
8587
8588
8589
8590 for {
8591 x := ssa.AuxIntToInt64(v.AuxInt)
8592 if v_0.Op != ssaop.OpRISCV64ANDI {
8593 break
8594 }
8595 y := ssa.AuxIntToInt64(v_0.AuxInt)
8596 if !(y >= 0 && uint64(y) < uint64(x)) {
8597 break
8598 }
8599 v.Reset(ssaop.OpRISCV64MOVDconst)
8600 v.AuxInt = ssa.Int64ToAuxInt(1)
8601 return true
8602 }
8603
8604
8605
8606 for {
8607 x := ssa.AuxIntToInt64(v.AuxInt)
8608 if v_0.Op != ssaop.OpRISCV64ORI {
8609 break
8610 }
8611 y := ssa.AuxIntToInt64(v_0.AuxInt)
8612 if !(y >= 0 && uint64(y) >= uint64(x)) {
8613 break
8614 }
8615 v.Reset(ssaop.OpRISCV64MOVDconst)
8616 v.AuxInt = ssa.Int64ToAuxInt(0)
8617 return true
8618 }
8619 return false
8620 }
8621 func rewriteValue_OpRISCV64SLTU(v *ssa.Value) bool {
8622 v_1 := v.Args[1]
8623 v_0 := v.Args[0]
8624
8625
8626
8627 for {
8628 x := v_0
8629 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8630 break
8631 }
8632 val := ssa.AuxIntToInt64(v_1.AuxInt)
8633 if !(ssa.Is12Bit(val)) {
8634 break
8635 }
8636 v.Reset(ssaop.OpRISCV64SLTIU)
8637 v.AuxInt = ssa.Int64ToAuxInt(val)
8638 v.AddArg(x)
8639 return true
8640 }
8641
8642
8643 for {
8644 x := v_0
8645 if x != v_1 {
8646 break
8647 }
8648 v.Reset(ssaop.OpRISCV64MOVDconst)
8649 v.AuxInt = ssa.Int64ToAuxInt(0)
8650 return true
8651 }
8652 return false
8653 }
8654 func rewriteValue_OpRISCV64SNEZ(v *ssa.Value) bool {
8655 v_0 := v.Args[0]
8656 b := v.Block
8657 typ := &b.Func.Config.Types
8658
8659
8660 for {
8661 if v_0.Op != ssaop.OpRISCV64NEG {
8662 break
8663 }
8664 x := v_0.Args[0]
8665 v.Reset(ssaop.OpRISCV64SNEZ)
8666 v.AddArg(x)
8667 return true
8668 }
8669
8670
8671 for {
8672 if v_0.Op != ssaop.OpRISCV64SEQZ {
8673 break
8674 }
8675 x := v_0.Args[0]
8676 v.Reset(ssaop.OpRISCV64SEQZ)
8677 v.AddArg(x)
8678 return true
8679 }
8680
8681
8682 for {
8683 if v_0.Op != ssaop.OpRISCV64SNEZ {
8684 break
8685 }
8686 x := v_0.Args[0]
8687 v.Reset(ssaop.OpRISCV64SNEZ)
8688 v.AddArg(x)
8689 return true
8690 }
8691
8692
8693
8694 for {
8695 a := v_0
8696 if a.Op != ssaop.OpRISCV64ANDI {
8697 break
8698 }
8699 x := ssa.AuxIntToInt64(a.AuxInt)
8700 y := a.Args[0]
8701 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
8702 break
8703 }
8704 v.Reset(ssaop.OpRISCV64SNEZ)
8705 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8706 v0.AuxInt = ssa.Int64ToAuxInt(1)
8707 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
8708 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
8709 v1.AddArg(y)
8710 v0.AddArg(v1)
8711 v.AddArg(v0)
8712 return true
8713 }
8714
8715
8716
8717 for {
8718 a := v_0
8719 if a.Op != ssaop.OpRISCV64AND {
8720 break
8721 }
8722 _ = a.Args[1]
8723 a_0 := a.Args[0]
8724 a_1 := a.Args[1]
8725 for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 {
8726 if a_0.Op != ssaop.OpRISCV64MOVDconst {
8727 continue
8728 }
8729 x := ssa.AuxIntToInt64(a_0.AuxInt)
8730 y := a_1
8731 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
8732 continue
8733 }
8734 v.Reset(ssaop.OpRISCV64SNEZ)
8735 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8736 v0.AuxInt = ssa.Int64ToAuxInt(1)
8737 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
8738 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
8739 v1.AddArg(y)
8740 v0.AddArg(v1)
8741 v.AddArg(v0)
8742 return true
8743 }
8744 break
8745 }
8746
8747
8748
8749 for {
8750 a := v_0
8751 if a.Op != ssaop.OpRISCV64ANDI {
8752 break
8753 }
8754 x := ssa.AuxIntToInt64(a.AuxInt)
8755 a_0 := a.Args[0]
8756 if a_0.Op != ssaop.OpRISCV64SRLI {
8757 break
8758 }
8759 y := ssa.AuxIntToInt64(a_0.AuxInt)
8760 z := a_0.Args[0]
8761 if !(ssa.IsPowerOfTwo(uint64(x)) && ssa.Is12Bit(x<<y) && a.Uses == 1) {
8762 break
8763 }
8764 v.Reset(ssaop.OpRISCV64SNEZ)
8765 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
8766 v0.AuxInt = ssa.Int64ToAuxInt(x << y)
8767 v0.AddArg(z)
8768 v.AddArg(v0)
8769 return true
8770 }
8771
8772
8773 for {
8774 if v_0.Op != ssaop.OpRISCV64ANDI {
8775 break
8776 }
8777 c := ssa.AuxIntToInt64(v_0.AuxInt)
8778 v_0_0 := v_0.Args[0]
8779 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
8780 break
8781 }
8782 v_0_0_0 := v_0_0.Args[0]
8783 if v_0_0_0.Op != ssaop.OpRISCV64FNEGD {
8784 break
8785 }
8786 x := v_0_0_0.Args[0]
8787 v.Reset(ssaop.OpRISCV64SNEZ)
8788 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
8789 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_0000_0000) | int64(bits.Reverse8(uint8(c))&0b1111_1111))
8790 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
8791 v1.AddArg(x)
8792 v0.AddArg(v1)
8793 v.AddArg(v0)
8794 return true
8795 }
8796
8797
8798 for {
8799 if v_0.Op != ssaop.OpRISCV64ANDI {
8800 break
8801 }
8802 c := ssa.AuxIntToInt64(v_0.AuxInt)
8803 v_0_0 := v_0.Args[0]
8804 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
8805 break
8806 }
8807 v_0_0_0 := v_0_0.Args[0]
8808 if v_0_0_0.Op != ssaop.OpRISCV64FABSD {
8809 break
8810 }
8811 x := v_0_0_0.Args[0]
8812 v.Reset(ssaop.OpRISCV64SNEZ)
8813 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
8814 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_1111_0000) | int64(bits.Reverse8(uint8(c))&0b0000_1111))
8815 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
8816 v1.AddArg(x)
8817 v0.AddArg(v1)
8818 v.AddArg(v0)
8819 return true
8820 }
8821 return false
8822 }
8823 func rewriteValue_OpRISCV64SRA(v *ssa.Value) bool {
8824 v_1 := v.Args[1]
8825 v_0 := v.Args[0]
8826
8827
8828 for {
8829 x := v_0
8830 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 63 {
8831 break
8832 }
8833 y := v_1.Args[0]
8834 v.Reset(ssaop.OpRISCV64SRA)
8835 v.AddArg2(x, y)
8836 return true
8837 }
8838
8839
8840 for {
8841 x := v_0
8842 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8843 break
8844 }
8845 val := ssa.AuxIntToInt64(v_1.AuxInt)
8846 v.Reset(ssaop.OpRISCV64SRAI)
8847 v.AuxInt = ssa.Int64ToAuxInt(val & 63)
8848 v.AddArg(x)
8849 return true
8850 }
8851 return false
8852 }
8853 func rewriteValue_OpRISCV64SRAI(v *ssa.Value) bool {
8854 v_0 := v.Args[0]
8855 b := v.Block
8856
8857
8858
8859 for {
8860 x := ssa.AuxIntToInt64(v.AuxInt)
8861 if v_0.Op != ssaop.OpRISCV64MOVWreg {
8862 break
8863 }
8864 y := v_0.Args[0]
8865 if !(x >= 0 && x <= 31) {
8866 break
8867 }
8868 v.Reset(ssaop.OpRISCV64SRAIW)
8869 v.AuxInt = ssa.Int64ToAuxInt(x)
8870 v.AddArg(y)
8871 return true
8872 }
8873
8874
8875
8876 for {
8877 t := v.Type
8878 x := ssa.AuxIntToInt64(v.AuxInt)
8879 if v_0.Op != ssaop.OpRISCV64MOVBreg {
8880 break
8881 }
8882 y := v_0.Args[0]
8883 if !(x >= 8) {
8884 break
8885 }
8886 v.Reset(ssaop.OpRISCV64SRAI)
8887 v.AuxInt = ssa.Int64ToAuxInt(63)
8888 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLI, t)
8889 v0.AuxInt = ssa.Int64ToAuxInt(56)
8890 v0.AddArg(y)
8891 v.AddArg(v0)
8892 return true
8893 }
8894
8895
8896
8897 for {
8898 t := v.Type
8899 x := ssa.AuxIntToInt64(v.AuxInt)
8900 if v_0.Op != ssaop.OpRISCV64MOVHreg {
8901 break
8902 }
8903 y := v_0.Args[0]
8904 if !(x >= 16) {
8905 break
8906 }
8907 v.Reset(ssaop.OpRISCV64SRAI)
8908 v.AuxInt = ssa.Int64ToAuxInt(63)
8909 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLLI, t)
8910 v0.AuxInt = ssa.Int64ToAuxInt(48)
8911 v0.AddArg(y)
8912 v.AddArg(v0)
8913 return true
8914 }
8915
8916
8917
8918 for {
8919 x := ssa.AuxIntToInt64(v.AuxInt)
8920 if v_0.Op != ssaop.OpRISCV64MOVWreg {
8921 break
8922 }
8923 y := v_0.Args[0]
8924 if !(x >= 32) {
8925 break
8926 }
8927 v.Reset(ssaop.OpRISCV64SRAIW)
8928 v.AuxInt = ssa.Int64ToAuxInt(31)
8929 v.AddArg(y)
8930 return true
8931 }
8932
8933
8934 for {
8935 x := ssa.AuxIntToInt64(v.AuxInt)
8936 if v_0.Op != ssaop.OpRISCV64MOVDconst {
8937 break
8938 }
8939 y := ssa.AuxIntToInt64(v_0.AuxInt)
8940 v.Reset(ssaop.OpRISCV64MOVDconst)
8941 v.AuxInt = ssa.Int64ToAuxInt(int64(y) >> uint32(x))
8942 return true
8943 }
8944 return false
8945 }
8946 func rewriteValue_OpRISCV64SRAW(v *ssa.Value) bool {
8947 v_1 := v.Args[1]
8948 v_0 := v.Args[0]
8949
8950
8951 for {
8952 x := v_0
8953 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 31 {
8954 break
8955 }
8956 y := v_1.Args[0]
8957 v.Reset(ssaop.OpRISCV64SRAW)
8958 v.AddArg2(x, y)
8959 return true
8960 }
8961
8962
8963 for {
8964 x := v_0
8965 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8966 break
8967 }
8968 val := ssa.AuxIntToInt64(v_1.AuxInt)
8969 v.Reset(ssaop.OpRISCV64SRAIW)
8970 v.AuxInt = ssa.Int64ToAuxInt(val & 31)
8971 v.AddArg(x)
8972 return true
8973 }
8974 return false
8975 }
8976 func rewriteValue_OpRISCV64SRL(v *ssa.Value) bool {
8977 v_1 := v.Args[1]
8978 v_0 := v.Args[0]
8979
8980
8981 for {
8982 x := v_0
8983 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 63 {
8984 break
8985 }
8986 y := v_1.Args[0]
8987 v.Reset(ssaop.OpRISCV64SRL)
8988 v.AddArg2(x, y)
8989 return true
8990 }
8991
8992
8993 for {
8994 x := v_0
8995 if v_1.Op != ssaop.OpRISCV64MOVDconst {
8996 break
8997 }
8998 val := ssa.AuxIntToInt64(v_1.AuxInt)
8999 v.Reset(ssaop.OpRISCV64SRLI)
9000 v.AuxInt = ssa.Int64ToAuxInt(val & 63)
9001 v.AddArg(x)
9002 return true
9003 }
9004 return false
9005 }
9006 func rewriteValue_OpRISCV64SRLI(v *ssa.Value) bool {
9007 v_0 := v.Args[0]
9008
9009
9010
9011 for {
9012 x := ssa.AuxIntToInt64(v.AuxInt)
9013 if v_0.Op != ssaop.OpRISCV64MOVWUreg {
9014 break
9015 }
9016 y := v_0.Args[0]
9017 if !(x >= 0 && x <= 31) {
9018 break
9019 }
9020 v.Reset(ssaop.OpRISCV64SRLIW)
9021 v.AuxInt = ssa.Int64ToAuxInt(x)
9022 v.AddArg(y)
9023 return true
9024 }
9025
9026
9027
9028 for {
9029 x := ssa.AuxIntToInt64(v.AuxInt)
9030 if v_0.Op != ssaop.OpRISCV64MOVBUreg {
9031 break
9032 }
9033 if !(x >= 8) {
9034 break
9035 }
9036 v.Reset(ssaop.OpRISCV64MOVDconst)
9037 v.AuxInt = ssa.Int64ToAuxInt(0)
9038 return true
9039 }
9040
9041
9042
9043 for {
9044 x := ssa.AuxIntToInt64(v.AuxInt)
9045 if v_0.Op != ssaop.OpRISCV64MOVHUreg {
9046 break
9047 }
9048 if !(x >= 16) {
9049 break
9050 }
9051 v.Reset(ssaop.OpRISCV64MOVDconst)
9052 v.AuxInt = ssa.Int64ToAuxInt(0)
9053 return true
9054 }
9055
9056
9057
9058 for {
9059 x := ssa.AuxIntToInt64(v.AuxInt)
9060 if v_0.Op != ssaop.OpRISCV64MOVWUreg {
9061 break
9062 }
9063 if !(x >= 32) {
9064 break
9065 }
9066 v.Reset(ssaop.OpRISCV64MOVDconst)
9067 v.AuxInt = ssa.Int64ToAuxInt(0)
9068 return true
9069 }
9070
9071
9072 for {
9073 x := ssa.AuxIntToInt64(v.AuxInt)
9074 if v_0.Op != ssaop.OpRISCV64MOVDconst {
9075 break
9076 }
9077 y := ssa.AuxIntToInt64(v_0.AuxInt)
9078 v.Reset(ssaop.OpRISCV64MOVDconst)
9079 v.AuxInt = ssa.Int64ToAuxInt(int64(uint64(y) >> uint32(x)))
9080 return true
9081 }
9082 return false
9083 }
9084 func rewriteValue_OpRISCV64SRLW(v *ssa.Value) bool {
9085 v_1 := v.Args[1]
9086 v_0 := v.Args[0]
9087
9088
9089 for {
9090 x := v_0
9091 if v_1.Op != ssaop.OpRISCV64ANDI || ssa.AuxIntToInt64(v_1.AuxInt) != 31 {
9092 break
9093 }
9094 y := v_1.Args[0]
9095 v.Reset(ssaop.OpRISCV64SRLW)
9096 v.AddArg2(x, y)
9097 return true
9098 }
9099
9100
9101 for {
9102 x := v_0
9103 if v_1.Op != ssaop.OpRISCV64MOVDconst {
9104 break
9105 }
9106 val := ssa.AuxIntToInt64(v_1.AuxInt)
9107 v.Reset(ssaop.OpRISCV64SRLIW)
9108 v.AuxInt = ssa.Int64ToAuxInt(val & 31)
9109 v.AddArg(x)
9110 return true
9111 }
9112 return false
9113 }
9114 func rewriteValue_OpRISCV64SUB(v *ssa.Value) bool {
9115 v_1 := v.Args[1]
9116 v_0 := v.Args[0]
9117 b := v.Block
9118
9119
9120 for {
9121 x := v_0
9122 if v_1.Op != ssaop.OpRISCV64NEG {
9123 break
9124 }
9125 y := v_1.Args[0]
9126 v.Reset(ssaop.OpRISCV64ADD)
9127 v.AddArg2(x, y)
9128 return true
9129 }
9130
9131
9132 for {
9133 x := v_0
9134 if x != v_1 {
9135 break
9136 }
9137 v.Reset(ssaop.OpRISCV64MOVDconst)
9138 v.AuxInt = ssa.Int64ToAuxInt(0)
9139 return true
9140 }
9141
9142
9143
9144 for {
9145 x := v_0
9146 if v_1.Op != ssaop.OpRISCV64MOVDconst {
9147 break
9148 }
9149 val := ssa.AuxIntToInt64(v_1.AuxInt)
9150 if !(ssa.Is32Bit(-val)) {
9151 break
9152 }
9153 v.Reset(ssaop.OpRISCV64ADDI)
9154 v.AuxInt = ssa.Int64ToAuxInt(-val)
9155 v.AddArg(x)
9156 return true
9157 }
9158
9159
9160
9161 for {
9162 t := v.Type
9163 if v_0.Op != ssaop.OpRISCV64MOVDconst {
9164 break
9165 }
9166 val := ssa.AuxIntToInt64(v_0.AuxInt)
9167 y := v_1
9168 if !(ssa.Is32Bit(-val)) {
9169 break
9170 }
9171 v.Reset(ssaop.OpRISCV64NEG)
9172 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, t)
9173 v0.AuxInt = ssa.Int64ToAuxInt(-val)
9174 v0.AddArg(y)
9175 v.AddArg(v0)
9176 return true
9177 }
9178
9179
9180 for {
9181 x := v_0
9182 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
9183 break
9184 }
9185 v.CopyOf(x)
9186 return true
9187 }
9188
9189
9190 for {
9191 if v_0.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
9192 break
9193 }
9194 x := v_1
9195 v.Reset(ssaop.OpRISCV64NEG)
9196 v.AddArg(x)
9197 return true
9198 }
9199 return false
9200 }
9201 func rewriteValue_OpRISCV64SUBW(v *ssa.Value) bool {
9202 v_1 := v.Args[1]
9203 v_0 := v.Args[0]
9204
9205
9206 for {
9207 x := v_0
9208 if v_1.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
9209 break
9210 }
9211 v.Reset(ssaop.OpRISCV64ADDIW)
9212 v.AuxInt = ssa.Int64ToAuxInt(0)
9213 v.AddArg(x)
9214 return true
9215 }
9216
9217
9218 for {
9219 if v_0.Op != ssaop.OpRISCV64MOVDconst || ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
9220 break
9221 }
9222 x := v_1
9223 v.Reset(ssaop.OpRISCV64NEGW)
9224 v.AddArg(x)
9225 return true
9226 }
9227 return false
9228 }
9229 func rewriteValue_OpRISCV64XOR(v *ssa.Value) bool {
9230 v_1 := v.Args[1]
9231 v_0 := v.Args[0]
9232
9233
9234
9235 for {
9236 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
9237 if v_0.Op != ssaop.OpRISCV64MOVDconst {
9238 continue
9239 }
9240 val := ssa.AuxIntToInt64(v_0.AuxInt)
9241 x := v_1
9242 if !(ssa.Is32Bit(val)) {
9243 continue
9244 }
9245 v.Reset(ssaop.OpRISCV64XORI)
9246 v.AuxInt = ssa.Int64ToAuxInt(val)
9247 v.AddArg(x)
9248 return true
9249 }
9250 break
9251 }
9252
9253
9254 for {
9255 x := v_0
9256 if x != v_1 {
9257 break
9258 }
9259 v.Reset(ssaop.OpRISCV64MOVDconst)
9260 v.AuxInt = ssa.Int64ToAuxInt(0)
9261 return true
9262 }
9263 return false
9264 }
9265 func rewriteValue_OpRotateLeft16(v *ssa.Value) bool {
9266 v_1 := v.Args[1]
9267 v_0 := v.Args[0]
9268 b := v.Block
9269 typ := &b.Func.Config.Types
9270
9271
9272 for {
9273 t := v.Type
9274 x := v_0
9275 y := v_1
9276 v.Reset(ssaop.OpRISCV64OR)
9277 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
9278 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, y.Type)
9279 v1.AuxInt = ssa.Int64ToAuxInt(15)
9280 v1.AddArg(y)
9281 v0.AddArg2(x, v1)
9282 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9283 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9284 v3.AddArg(x)
9285 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, y.Type)
9286 v4.AuxInt = ssa.Int64ToAuxInt(15)
9287 v5 := b.NewValue0(v.Pos, ssaop.OpRISCV64NEG, y.Type)
9288 v5.AddArg(y)
9289 v4.AddArg(v5)
9290 v2.AddArg2(v3, v4)
9291 v.AddArg2(v0, v2)
9292 return true
9293 }
9294 }
9295 func rewriteValue_OpRotateLeft8(v *ssa.Value) bool {
9296 v_1 := v.Args[1]
9297 v_0 := v.Args[0]
9298 b := v.Block
9299 typ := &b.Func.Config.Types
9300
9301
9302 for {
9303 t := v.Type
9304 x := v_0
9305 y := v_1
9306 v.Reset(ssaop.OpRISCV64OR)
9307 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLL, t)
9308 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, y.Type)
9309 v1.AuxInt = ssa.Int64ToAuxInt(7)
9310 v1.AddArg(y)
9311 v0.AddArg2(x, v1)
9312 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9313 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
9314 v3.AddArg(x)
9315 v4 := b.NewValue0(v.Pos, ssaop.OpRISCV64ANDI, y.Type)
9316 v4.AuxInt = ssa.Int64ToAuxInt(7)
9317 v5 := b.NewValue0(v.Pos, ssaop.OpRISCV64NEG, y.Type)
9318 v5.AddArg(y)
9319 v4.AddArg(v5)
9320 v2.AddArg2(v3, v4)
9321 v.AddArg2(v0, v2)
9322 return true
9323 }
9324 }
9325 func rewriteValue_OpRsh16Ux16(v *ssa.Value) bool {
9326 v_1 := v.Args[1]
9327 v_0 := v.Args[0]
9328 b := v.Block
9329 typ := &b.Func.Config.Types
9330
9331
9332
9333 for {
9334 t := v.Type
9335 x := v_0
9336 y := v_1
9337 if !(!ssa.ShiftIsBounded(v)) {
9338 break
9339 }
9340 v.Reset(ssaop.OpRISCV64AND)
9341 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9342 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9343 v1.AddArg(x)
9344 v0.AddArg2(v1, y)
9345 v2 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
9346 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9347 v3.AuxInt = ssa.Int64ToAuxInt(64)
9348 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9349 v4.AddArg(y)
9350 v3.AddArg(v4)
9351 v2.AddArg(v3)
9352 v.AddArg2(v0, v2)
9353 return true
9354 }
9355
9356
9357
9358 for {
9359 x := v_0
9360 y := v_1
9361 if !(ssa.ShiftIsBounded(v)) {
9362 break
9363 }
9364 v.Reset(ssaop.OpRISCV64SRL)
9365 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9366 v0.AddArg(x)
9367 v.AddArg2(v0, y)
9368 return true
9369 }
9370 return false
9371 }
9372 func rewriteValue_OpRsh16Ux32(v *ssa.Value) bool {
9373 v_1 := v.Args[1]
9374 v_0 := v.Args[0]
9375 b := v.Block
9376 typ := &b.Func.Config.Types
9377
9378
9379
9380 for {
9381 t := v.Type
9382 x := v_0
9383 y := v_1
9384 if !(!ssa.ShiftIsBounded(v)) {
9385 break
9386 }
9387 v.Reset(ssaop.OpRISCV64AND)
9388 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9389 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9390 v1.AddArg(x)
9391 v0.AddArg2(v1, y)
9392 v2 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
9393 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9394 v3.AuxInt = ssa.Int64ToAuxInt(64)
9395 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
9396 v4.AddArg(y)
9397 v3.AddArg(v4)
9398 v2.AddArg(v3)
9399 v.AddArg2(v0, v2)
9400 return true
9401 }
9402
9403
9404
9405 for {
9406 x := v_0
9407 y := v_1
9408 if !(ssa.ShiftIsBounded(v)) {
9409 break
9410 }
9411 v.Reset(ssaop.OpRISCV64SRL)
9412 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9413 v0.AddArg(x)
9414 v.AddArg2(v0, y)
9415 return true
9416 }
9417 return false
9418 }
9419 func rewriteValue_OpRsh16Ux64(v *ssa.Value) bool {
9420 v_1 := v.Args[1]
9421 v_0 := v.Args[0]
9422 b := v.Block
9423 typ := &b.Func.Config.Types
9424
9425
9426
9427 for {
9428 t := v.Type
9429 x := v_0
9430 y := v_1
9431 if !(!ssa.ShiftIsBounded(v)) {
9432 break
9433 }
9434 v.Reset(ssaop.OpRISCV64AND)
9435 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9436 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9437 v1.AddArg(x)
9438 v0.AddArg2(v1, y)
9439 v2 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
9440 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9441 v3.AuxInt = ssa.Int64ToAuxInt(64)
9442 v3.AddArg(y)
9443 v2.AddArg(v3)
9444 v.AddArg2(v0, v2)
9445 return true
9446 }
9447
9448
9449
9450 for {
9451 x := v_0
9452 y := v_1
9453 if !(ssa.ShiftIsBounded(v)) {
9454 break
9455 }
9456 v.Reset(ssaop.OpRISCV64SRL)
9457 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9458 v0.AddArg(x)
9459 v.AddArg2(v0, y)
9460 return true
9461 }
9462 return false
9463 }
9464 func rewriteValue_OpRsh16Ux8(v *ssa.Value) bool {
9465 v_1 := v.Args[1]
9466 v_0 := v.Args[0]
9467 b := v.Block
9468 typ := &b.Func.Config.Types
9469
9470
9471
9472 for {
9473 t := v.Type
9474 x := v_0
9475 y := v_1
9476 if !(!ssa.ShiftIsBounded(v)) {
9477 break
9478 }
9479 v.Reset(ssaop.OpRISCV64AND)
9480 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
9481 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9482 v1.AddArg(x)
9483 v0.AddArg2(v1, y)
9484 v2 := b.NewValue0(v.Pos, ssaop.OpNeg16, t)
9485 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9486 v3.AuxInt = ssa.Int64ToAuxInt(64)
9487 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
9488 v4.AddArg(y)
9489 v3.AddArg(v4)
9490 v2.AddArg(v3)
9491 v.AddArg2(v0, v2)
9492 return true
9493 }
9494
9495
9496
9497 for {
9498 x := v_0
9499 y := v_1
9500 if !(ssa.ShiftIsBounded(v)) {
9501 break
9502 }
9503 v.Reset(ssaop.OpRISCV64SRL)
9504 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9505 v0.AddArg(x)
9506 v.AddArg2(v0, y)
9507 return true
9508 }
9509 return false
9510 }
9511 func rewriteValue_OpRsh16x16(v *ssa.Value) bool {
9512 v_1 := v.Args[1]
9513 v_0 := v.Args[0]
9514 b := v.Block
9515 typ := &b.Func.Config.Types
9516
9517
9518
9519 for {
9520 t := v.Type
9521 x := v_0
9522 y := v_1
9523 if !(!ssa.ShiftIsBounded(v)) {
9524 break
9525 }
9526 v.Reset(ssaop.OpRISCV64SRA)
9527 v.Type = t
9528 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9529 v0.AddArg(x)
9530 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9531 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9532 v2.AuxInt = ssa.Int64ToAuxInt(-1)
9533 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9534 v3.AuxInt = ssa.Int64ToAuxInt(64)
9535 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9536 v4.AddArg(y)
9537 v3.AddArg(v4)
9538 v2.AddArg(v3)
9539 v1.AddArg2(y, v2)
9540 v.AddArg2(v0, v1)
9541 return true
9542 }
9543
9544
9545
9546 for {
9547 x := v_0
9548 y := v_1
9549 if !(ssa.ShiftIsBounded(v)) {
9550 break
9551 }
9552 v.Reset(ssaop.OpRISCV64SRA)
9553 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9554 v0.AddArg(x)
9555 v.AddArg2(v0, y)
9556 return true
9557 }
9558 return false
9559 }
9560 func rewriteValue_OpRsh16x32(v *ssa.Value) bool {
9561 v_1 := v.Args[1]
9562 v_0 := v.Args[0]
9563 b := v.Block
9564 typ := &b.Func.Config.Types
9565
9566
9567
9568 for {
9569 t := v.Type
9570 x := v_0
9571 y := v_1
9572 if !(!ssa.ShiftIsBounded(v)) {
9573 break
9574 }
9575 v.Reset(ssaop.OpRISCV64SRA)
9576 v.Type = t
9577 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9578 v0.AddArg(x)
9579 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9580 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9581 v2.AuxInt = ssa.Int64ToAuxInt(-1)
9582 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9583 v3.AuxInt = ssa.Int64ToAuxInt(64)
9584 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
9585 v4.AddArg(y)
9586 v3.AddArg(v4)
9587 v2.AddArg(v3)
9588 v1.AddArg2(y, v2)
9589 v.AddArg2(v0, v1)
9590 return true
9591 }
9592
9593
9594
9595 for {
9596 x := v_0
9597 y := v_1
9598 if !(ssa.ShiftIsBounded(v)) {
9599 break
9600 }
9601 v.Reset(ssaop.OpRISCV64SRA)
9602 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9603 v0.AddArg(x)
9604 v.AddArg2(v0, y)
9605 return true
9606 }
9607 return false
9608 }
9609 func rewriteValue_OpRsh16x64(v *ssa.Value) bool {
9610 v_1 := v.Args[1]
9611 v_0 := v.Args[0]
9612 b := v.Block
9613 typ := &b.Func.Config.Types
9614
9615
9616
9617 for {
9618 t := v.Type
9619 x := v_0
9620 y := v_1
9621 if !(!ssa.ShiftIsBounded(v)) {
9622 break
9623 }
9624 v.Reset(ssaop.OpRISCV64SRA)
9625 v.Type = t
9626 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9627 v0.AddArg(x)
9628 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9629 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9630 v2.AuxInt = ssa.Int64ToAuxInt(-1)
9631 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9632 v3.AuxInt = ssa.Int64ToAuxInt(64)
9633 v3.AddArg(y)
9634 v2.AddArg(v3)
9635 v1.AddArg2(y, v2)
9636 v.AddArg2(v0, v1)
9637 return true
9638 }
9639
9640
9641
9642 for {
9643 x := v_0
9644 y := v_1
9645 if !(ssa.ShiftIsBounded(v)) {
9646 break
9647 }
9648 v.Reset(ssaop.OpRISCV64SRA)
9649 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9650 v0.AddArg(x)
9651 v.AddArg2(v0, y)
9652 return true
9653 }
9654 return false
9655 }
9656 func rewriteValue_OpRsh16x8(v *ssa.Value) bool {
9657 v_1 := v.Args[1]
9658 v_0 := v.Args[0]
9659 b := v.Block
9660 typ := &b.Func.Config.Types
9661
9662
9663
9664 for {
9665 t := v.Type
9666 x := v_0
9667 y := v_1
9668 if !(!ssa.ShiftIsBounded(v)) {
9669 break
9670 }
9671 v.Reset(ssaop.OpRISCV64SRA)
9672 v.Type = t
9673 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9674 v0.AddArg(x)
9675 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9676 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9677 v2.AuxInt = ssa.Int64ToAuxInt(-1)
9678 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9679 v3.AuxInt = ssa.Int64ToAuxInt(64)
9680 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
9681 v4.AddArg(y)
9682 v3.AddArg(v4)
9683 v2.AddArg(v3)
9684 v1.AddArg2(y, v2)
9685 v.AddArg2(v0, v1)
9686 return true
9687 }
9688
9689
9690
9691 for {
9692 x := v_0
9693 y := v_1
9694 if !(ssa.ShiftIsBounded(v)) {
9695 break
9696 }
9697 v.Reset(ssaop.OpRISCV64SRA)
9698 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt16to64, typ.Int64)
9699 v0.AddArg(x)
9700 v.AddArg2(v0, y)
9701 return true
9702 }
9703 return false
9704 }
9705 func rewriteValue_OpRsh32Ux16(v *ssa.Value) bool {
9706 v_1 := v.Args[1]
9707 v_0 := v.Args[0]
9708 b := v.Block
9709 typ := &b.Func.Config.Types
9710
9711
9712
9713 for {
9714 t := v.Type
9715 x := v_0
9716 y := v_1
9717 if !(!ssa.ShiftIsBounded(v)) {
9718 break
9719 }
9720 v.Reset(ssaop.OpRISCV64AND)
9721 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLW, t)
9722 v0.AddArg2(x, y)
9723 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
9724 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9725 v2.AuxInt = ssa.Int64ToAuxInt(32)
9726 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9727 v3.AddArg(y)
9728 v2.AddArg(v3)
9729 v1.AddArg(v2)
9730 v.AddArg2(v0, v1)
9731 return true
9732 }
9733
9734
9735
9736 for {
9737 x := v_0
9738 y := v_1
9739 if !(ssa.ShiftIsBounded(v)) {
9740 break
9741 }
9742 v.Reset(ssaop.OpRISCV64SRLW)
9743 v.AddArg2(x, y)
9744 return true
9745 }
9746 return false
9747 }
9748 func rewriteValue_OpRsh32Ux32(v *ssa.Value) bool {
9749 v_1 := v.Args[1]
9750 v_0 := v.Args[0]
9751 b := v.Block
9752 typ := &b.Func.Config.Types
9753
9754
9755
9756 for {
9757 t := v.Type
9758 x := v_0
9759 y := v_1
9760 if !(!ssa.ShiftIsBounded(v)) {
9761 break
9762 }
9763 v.Reset(ssaop.OpRISCV64AND)
9764 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLW, t)
9765 v0.AddArg2(x, y)
9766 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
9767 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9768 v2.AuxInt = ssa.Int64ToAuxInt(32)
9769 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
9770 v3.AddArg(y)
9771 v2.AddArg(v3)
9772 v1.AddArg(v2)
9773 v.AddArg2(v0, v1)
9774 return true
9775 }
9776
9777
9778
9779 for {
9780 x := v_0
9781 y := v_1
9782 if !(ssa.ShiftIsBounded(v)) {
9783 break
9784 }
9785 v.Reset(ssaop.OpRISCV64SRLW)
9786 v.AddArg2(x, y)
9787 return true
9788 }
9789 return false
9790 }
9791 func rewriteValue_OpRsh32Ux64(v *ssa.Value) bool {
9792 v_1 := v.Args[1]
9793 v_0 := v.Args[0]
9794 b := v.Block
9795
9796
9797
9798 for {
9799 t := v.Type
9800 x := v_0
9801 y := v_1
9802 if !(!ssa.ShiftIsBounded(v)) {
9803 break
9804 }
9805 v.Reset(ssaop.OpRISCV64AND)
9806 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLW, t)
9807 v0.AddArg2(x, y)
9808 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
9809 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9810 v2.AuxInt = ssa.Int64ToAuxInt(32)
9811 v2.AddArg(y)
9812 v1.AddArg(v2)
9813 v.AddArg2(v0, v1)
9814 return true
9815 }
9816
9817
9818
9819 for {
9820 x := v_0
9821 y := v_1
9822 if !(ssa.ShiftIsBounded(v)) {
9823 break
9824 }
9825 v.Reset(ssaop.OpRISCV64SRLW)
9826 v.AddArg2(x, y)
9827 return true
9828 }
9829 return false
9830 }
9831 func rewriteValue_OpRsh32Ux8(v *ssa.Value) bool {
9832 v_1 := v.Args[1]
9833 v_0 := v.Args[0]
9834 b := v.Block
9835 typ := &b.Func.Config.Types
9836
9837
9838
9839 for {
9840 t := v.Type
9841 x := v_0
9842 y := v_1
9843 if !(!ssa.ShiftIsBounded(v)) {
9844 break
9845 }
9846 v.Reset(ssaop.OpRISCV64AND)
9847 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRLW, t)
9848 v0.AddArg2(x, y)
9849 v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t)
9850 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
9851 v2.AuxInt = ssa.Int64ToAuxInt(32)
9852 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
9853 v3.AddArg(y)
9854 v2.AddArg(v3)
9855 v1.AddArg(v2)
9856 v.AddArg2(v0, v1)
9857 return true
9858 }
9859
9860
9861
9862 for {
9863 x := v_0
9864 y := v_1
9865 if !(ssa.ShiftIsBounded(v)) {
9866 break
9867 }
9868 v.Reset(ssaop.OpRISCV64SRLW)
9869 v.AddArg2(x, y)
9870 return true
9871 }
9872 return false
9873 }
9874 func rewriteValue_OpRsh32x16(v *ssa.Value) bool {
9875 v_1 := v.Args[1]
9876 v_0 := v.Args[0]
9877 b := v.Block
9878 typ := &b.Func.Config.Types
9879
9880
9881
9882 for {
9883 t := v.Type
9884 x := v_0
9885 y := v_1
9886 if !(!ssa.ShiftIsBounded(v)) {
9887 break
9888 }
9889 v.Reset(ssaop.OpRISCV64SRAW)
9890 v.Type = t
9891 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9892 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9893 v1.AuxInt = ssa.Int64ToAuxInt(-1)
9894 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9895 v2.AuxInt = ssa.Int64ToAuxInt(32)
9896 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
9897 v3.AddArg(y)
9898 v2.AddArg(v3)
9899 v1.AddArg(v2)
9900 v0.AddArg2(y, v1)
9901 v.AddArg2(x, v0)
9902 return true
9903 }
9904
9905
9906
9907 for {
9908 x := v_0
9909 y := v_1
9910 if !(ssa.ShiftIsBounded(v)) {
9911 break
9912 }
9913 v.Reset(ssaop.OpRISCV64SRAW)
9914 v.AddArg2(x, y)
9915 return true
9916 }
9917 return false
9918 }
9919 func rewriteValue_OpRsh32x32(v *ssa.Value) bool {
9920 v_1 := v.Args[1]
9921 v_0 := v.Args[0]
9922 b := v.Block
9923 typ := &b.Func.Config.Types
9924
9925
9926
9927 for {
9928 t := v.Type
9929 x := v_0
9930 y := v_1
9931 if !(!ssa.ShiftIsBounded(v)) {
9932 break
9933 }
9934 v.Reset(ssaop.OpRISCV64SRAW)
9935 v.Type = t
9936 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9937 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9938 v1.AuxInt = ssa.Int64ToAuxInt(-1)
9939 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9940 v2.AuxInt = ssa.Int64ToAuxInt(32)
9941 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
9942 v3.AddArg(y)
9943 v2.AddArg(v3)
9944 v1.AddArg(v2)
9945 v0.AddArg2(y, v1)
9946 v.AddArg2(x, v0)
9947 return true
9948 }
9949
9950
9951
9952 for {
9953 x := v_0
9954 y := v_1
9955 if !(ssa.ShiftIsBounded(v)) {
9956 break
9957 }
9958 v.Reset(ssaop.OpRISCV64SRAW)
9959 v.AddArg2(x, y)
9960 return true
9961 }
9962 return false
9963 }
9964 func rewriteValue_OpRsh32x64(v *ssa.Value) bool {
9965 v_1 := v.Args[1]
9966 v_0 := v.Args[0]
9967 b := v.Block
9968
9969
9970
9971 for {
9972 t := v.Type
9973 x := v_0
9974 y := v_1
9975 if !(!ssa.ShiftIsBounded(v)) {
9976 break
9977 }
9978 v.Reset(ssaop.OpRISCV64SRAW)
9979 v.Type = t
9980 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
9981 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
9982 v1.AuxInt = ssa.Int64ToAuxInt(-1)
9983 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
9984 v2.AuxInt = ssa.Int64ToAuxInt(32)
9985 v2.AddArg(y)
9986 v1.AddArg(v2)
9987 v0.AddArg2(y, v1)
9988 v.AddArg2(x, v0)
9989 return true
9990 }
9991
9992
9993
9994 for {
9995 x := v_0
9996 y := v_1
9997 if !(ssa.ShiftIsBounded(v)) {
9998 break
9999 }
10000 v.Reset(ssaop.OpRISCV64SRAW)
10001 v.AddArg2(x, y)
10002 return true
10003 }
10004 return false
10005 }
10006 func rewriteValue_OpRsh32x8(v *ssa.Value) bool {
10007 v_1 := v.Args[1]
10008 v_0 := v.Args[0]
10009 b := v.Block
10010 typ := &b.Func.Config.Types
10011
10012
10013
10014 for {
10015 t := v.Type
10016 x := v_0
10017 y := v_1
10018 if !(!ssa.ShiftIsBounded(v)) {
10019 break
10020 }
10021 v.Reset(ssaop.OpRISCV64SRAW)
10022 v.Type = t
10023 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10024 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10025 v1.AuxInt = ssa.Int64ToAuxInt(-1)
10026 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10027 v2.AuxInt = ssa.Int64ToAuxInt(32)
10028 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10029 v3.AddArg(y)
10030 v2.AddArg(v3)
10031 v1.AddArg(v2)
10032 v0.AddArg2(y, v1)
10033 v.AddArg2(x, v0)
10034 return true
10035 }
10036
10037
10038
10039 for {
10040 x := v_0
10041 y := v_1
10042 if !(ssa.ShiftIsBounded(v)) {
10043 break
10044 }
10045 v.Reset(ssaop.OpRISCV64SRAW)
10046 v.AddArg2(x, y)
10047 return true
10048 }
10049 return false
10050 }
10051 func rewriteValue_OpRsh64Ux16(v *ssa.Value) bool {
10052 v_1 := v.Args[1]
10053 v_0 := v.Args[0]
10054 b := v.Block
10055 typ := &b.Func.Config.Types
10056
10057
10058
10059 for {
10060 t := v.Type
10061 x := v_0
10062 y := v_1
10063 if !(!ssa.ShiftIsBounded(v)) {
10064 break
10065 }
10066 v.Reset(ssaop.OpRISCV64AND)
10067 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10068 v0.AddArg2(x, y)
10069 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
10070 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10071 v2.AuxInt = ssa.Int64ToAuxInt(64)
10072 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
10073 v3.AddArg(y)
10074 v2.AddArg(v3)
10075 v1.AddArg(v2)
10076 v.AddArg2(v0, v1)
10077 return true
10078 }
10079
10080
10081
10082 for {
10083 x := v_0
10084 y := v_1
10085 if !(ssa.ShiftIsBounded(v)) {
10086 break
10087 }
10088 v.Reset(ssaop.OpRISCV64SRL)
10089 v.AddArg2(x, y)
10090 return true
10091 }
10092 return false
10093 }
10094 func rewriteValue_OpRsh64Ux32(v *ssa.Value) bool {
10095 v_1 := v.Args[1]
10096 v_0 := v.Args[0]
10097 b := v.Block
10098 typ := &b.Func.Config.Types
10099
10100
10101
10102 for {
10103 t := v.Type
10104 x := v_0
10105 y := v_1
10106 if !(!ssa.ShiftIsBounded(v)) {
10107 break
10108 }
10109 v.Reset(ssaop.OpRISCV64AND)
10110 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10111 v0.AddArg2(x, y)
10112 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
10113 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10114 v2.AuxInt = ssa.Int64ToAuxInt(64)
10115 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
10116 v3.AddArg(y)
10117 v2.AddArg(v3)
10118 v1.AddArg(v2)
10119 v.AddArg2(v0, v1)
10120 return true
10121 }
10122
10123
10124
10125 for {
10126 x := v_0
10127 y := v_1
10128 if !(ssa.ShiftIsBounded(v)) {
10129 break
10130 }
10131 v.Reset(ssaop.OpRISCV64SRL)
10132 v.AddArg2(x, y)
10133 return true
10134 }
10135 return false
10136 }
10137 func rewriteValue_OpRsh64Ux64(v *ssa.Value) bool {
10138 v_1 := v.Args[1]
10139 v_0 := v.Args[0]
10140 b := v.Block
10141
10142
10143
10144 for {
10145 t := v.Type
10146 x := v_0
10147 y := v_1
10148 if !(!ssa.ShiftIsBounded(v)) {
10149 break
10150 }
10151 v.Reset(ssaop.OpRISCV64AND)
10152 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10153 v0.AddArg2(x, y)
10154 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
10155 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10156 v2.AuxInt = ssa.Int64ToAuxInt(64)
10157 v2.AddArg(y)
10158 v1.AddArg(v2)
10159 v.AddArg2(v0, v1)
10160 return true
10161 }
10162
10163
10164
10165 for {
10166 x := v_0
10167 y := v_1
10168 if !(ssa.ShiftIsBounded(v)) {
10169 break
10170 }
10171 v.Reset(ssaop.OpRISCV64SRL)
10172 v.AddArg2(x, y)
10173 return true
10174 }
10175 return false
10176 }
10177 func rewriteValue_OpRsh64Ux8(v *ssa.Value) bool {
10178 v_1 := v.Args[1]
10179 v_0 := v.Args[0]
10180 b := v.Block
10181 typ := &b.Func.Config.Types
10182
10183
10184
10185 for {
10186 t := v.Type
10187 x := v_0
10188 y := v_1
10189 if !(!ssa.ShiftIsBounded(v)) {
10190 break
10191 }
10192 v.Reset(ssaop.OpRISCV64AND)
10193 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10194 v0.AddArg2(x, y)
10195 v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t)
10196 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10197 v2.AuxInt = ssa.Int64ToAuxInt(64)
10198 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10199 v3.AddArg(y)
10200 v2.AddArg(v3)
10201 v1.AddArg(v2)
10202 v.AddArg2(v0, v1)
10203 return true
10204 }
10205
10206
10207
10208 for {
10209 x := v_0
10210 y := v_1
10211 if !(ssa.ShiftIsBounded(v)) {
10212 break
10213 }
10214 v.Reset(ssaop.OpRISCV64SRL)
10215 v.AddArg2(x, y)
10216 return true
10217 }
10218 return false
10219 }
10220 func rewriteValue_OpRsh64x16(v *ssa.Value) bool {
10221 v_1 := v.Args[1]
10222 v_0 := v.Args[0]
10223 b := v.Block
10224 typ := &b.Func.Config.Types
10225
10226
10227
10228 for {
10229 t := v.Type
10230 x := v_0
10231 y := v_1
10232 if !(!ssa.ShiftIsBounded(v)) {
10233 break
10234 }
10235 v.Reset(ssaop.OpRISCV64SRA)
10236 v.Type = t
10237 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10238 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10239 v1.AuxInt = ssa.Int64ToAuxInt(-1)
10240 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10241 v2.AuxInt = ssa.Int64ToAuxInt(64)
10242 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
10243 v3.AddArg(y)
10244 v2.AddArg(v3)
10245 v1.AddArg(v2)
10246 v0.AddArg2(y, v1)
10247 v.AddArg2(x, v0)
10248 return true
10249 }
10250
10251
10252
10253 for {
10254 x := v_0
10255 y := v_1
10256 if !(ssa.ShiftIsBounded(v)) {
10257 break
10258 }
10259 v.Reset(ssaop.OpRISCV64SRA)
10260 v.AddArg2(x, y)
10261 return true
10262 }
10263 return false
10264 }
10265 func rewriteValue_OpRsh64x32(v *ssa.Value) bool {
10266 v_1 := v.Args[1]
10267 v_0 := v.Args[0]
10268 b := v.Block
10269 typ := &b.Func.Config.Types
10270
10271
10272
10273 for {
10274 t := v.Type
10275 x := v_0
10276 y := v_1
10277 if !(!ssa.ShiftIsBounded(v)) {
10278 break
10279 }
10280 v.Reset(ssaop.OpRISCV64SRA)
10281 v.Type = t
10282 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10283 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10284 v1.AuxInt = ssa.Int64ToAuxInt(-1)
10285 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10286 v2.AuxInt = ssa.Int64ToAuxInt(64)
10287 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
10288 v3.AddArg(y)
10289 v2.AddArg(v3)
10290 v1.AddArg(v2)
10291 v0.AddArg2(y, v1)
10292 v.AddArg2(x, v0)
10293 return true
10294 }
10295
10296
10297
10298 for {
10299 x := v_0
10300 y := v_1
10301 if !(ssa.ShiftIsBounded(v)) {
10302 break
10303 }
10304 v.Reset(ssaop.OpRISCV64SRA)
10305 v.AddArg2(x, y)
10306 return true
10307 }
10308 return false
10309 }
10310 func rewriteValue_OpRsh64x64(v *ssa.Value) bool {
10311 v_1 := v.Args[1]
10312 v_0 := v.Args[0]
10313 b := v.Block
10314
10315
10316
10317 for {
10318 t := v.Type
10319 x := v_0
10320 y := v_1
10321 if !(!ssa.ShiftIsBounded(v)) {
10322 break
10323 }
10324 v.Reset(ssaop.OpRISCV64SRA)
10325 v.Type = t
10326 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10327 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10328 v1.AuxInt = ssa.Int64ToAuxInt(-1)
10329 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10330 v2.AuxInt = ssa.Int64ToAuxInt(64)
10331 v2.AddArg(y)
10332 v1.AddArg(v2)
10333 v0.AddArg2(y, v1)
10334 v.AddArg2(x, v0)
10335 return true
10336 }
10337
10338
10339
10340 for {
10341 x := v_0
10342 y := v_1
10343 if !(ssa.ShiftIsBounded(v)) {
10344 break
10345 }
10346 v.Reset(ssaop.OpRISCV64SRA)
10347 v.AddArg2(x, y)
10348 return true
10349 }
10350 return false
10351 }
10352 func rewriteValue_OpRsh64x8(v *ssa.Value) bool {
10353 v_1 := v.Args[1]
10354 v_0 := v.Args[0]
10355 b := v.Block
10356 typ := &b.Func.Config.Types
10357
10358
10359
10360 for {
10361 t := v.Type
10362 x := v_0
10363 y := v_1
10364 if !(!ssa.ShiftIsBounded(v)) {
10365 break
10366 }
10367 v.Reset(ssaop.OpRISCV64SRA)
10368 v.Type = t
10369 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10370 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10371 v1.AuxInt = ssa.Int64ToAuxInt(-1)
10372 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10373 v2.AuxInt = ssa.Int64ToAuxInt(64)
10374 v3 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10375 v3.AddArg(y)
10376 v2.AddArg(v3)
10377 v1.AddArg(v2)
10378 v0.AddArg2(y, v1)
10379 v.AddArg2(x, v0)
10380 return true
10381 }
10382
10383
10384
10385 for {
10386 x := v_0
10387 y := v_1
10388 if !(ssa.ShiftIsBounded(v)) {
10389 break
10390 }
10391 v.Reset(ssaop.OpRISCV64SRA)
10392 v.AddArg2(x, y)
10393 return true
10394 }
10395 return false
10396 }
10397 func rewriteValue_OpRsh8Ux16(v *ssa.Value) bool {
10398 v_1 := v.Args[1]
10399 v_0 := v.Args[0]
10400 b := v.Block
10401 typ := &b.Func.Config.Types
10402
10403
10404
10405 for {
10406 t := v.Type
10407 x := v_0
10408 y := v_1
10409 if !(!ssa.ShiftIsBounded(v)) {
10410 break
10411 }
10412 v.Reset(ssaop.OpRISCV64AND)
10413 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10414 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10415 v1.AddArg(x)
10416 v0.AddArg2(v1, y)
10417 v2 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
10418 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10419 v3.AuxInt = ssa.Int64ToAuxInt(64)
10420 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
10421 v4.AddArg(y)
10422 v3.AddArg(v4)
10423 v2.AddArg(v3)
10424 v.AddArg2(v0, v2)
10425 return true
10426 }
10427
10428
10429
10430 for {
10431 x := v_0
10432 y := v_1
10433 if !(ssa.ShiftIsBounded(v)) {
10434 break
10435 }
10436 v.Reset(ssaop.OpRISCV64SRL)
10437 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10438 v0.AddArg(x)
10439 v.AddArg2(v0, y)
10440 return true
10441 }
10442 return false
10443 }
10444 func rewriteValue_OpRsh8Ux32(v *ssa.Value) bool {
10445 v_1 := v.Args[1]
10446 v_0 := v.Args[0]
10447 b := v.Block
10448 typ := &b.Func.Config.Types
10449
10450
10451
10452 for {
10453 t := v.Type
10454 x := v_0
10455 y := v_1
10456 if !(!ssa.ShiftIsBounded(v)) {
10457 break
10458 }
10459 v.Reset(ssaop.OpRISCV64AND)
10460 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10461 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10462 v1.AddArg(x)
10463 v0.AddArg2(v1, y)
10464 v2 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
10465 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10466 v3.AuxInt = ssa.Int64ToAuxInt(64)
10467 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
10468 v4.AddArg(y)
10469 v3.AddArg(v4)
10470 v2.AddArg(v3)
10471 v.AddArg2(v0, v2)
10472 return true
10473 }
10474
10475
10476
10477 for {
10478 x := v_0
10479 y := v_1
10480 if !(ssa.ShiftIsBounded(v)) {
10481 break
10482 }
10483 v.Reset(ssaop.OpRISCV64SRL)
10484 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10485 v0.AddArg(x)
10486 v.AddArg2(v0, y)
10487 return true
10488 }
10489 return false
10490 }
10491 func rewriteValue_OpRsh8Ux64(v *ssa.Value) bool {
10492 v_1 := v.Args[1]
10493 v_0 := v.Args[0]
10494 b := v.Block
10495 typ := &b.Func.Config.Types
10496
10497
10498
10499 for {
10500 t := v.Type
10501 x := v_0
10502 y := v_1
10503 if !(!ssa.ShiftIsBounded(v)) {
10504 break
10505 }
10506 v.Reset(ssaop.OpRISCV64AND)
10507 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10508 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10509 v1.AddArg(x)
10510 v0.AddArg2(v1, y)
10511 v2 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
10512 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10513 v3.AuxInt = ssa.Int64ToAuxInt(64)
10514 v3.AddArg(y)
10515 v2.AddArg(v3)
10516 v.AddArg2(v0, v2)
10517 return true
10518 }
10519
10520
10521
10522 for {
10523 x := v_0
10524 y := v_1
10525 if !(ssa.ShiftIsBounded(v)) {
10526 break
10527 }
10528 v.Reset(ssaop.OpRISCV64SRL)
10529 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10530 v0.AddArg(x)
10531 v.AddArg2(v0, y)
10532 return true
10533 }
10534 return false
10535 }
10536 func rewriteValue_OpRsh8Ux8(v *ssa.Value) bool {
10537 v_1 := v.Args[1]
10538 v_0 := v.Args[0]
10539 b := v.Block
10540 typ := &b.Func.Config.Types
10541
10542
10543
10544 for {
10545 t := v.Type
10546 x := v_0
10547 y := v_1
10548 if !(!ssa.ShiftIsBounded(v)) {
10549 break
10550 }
10551 v.Reset(ssaop.OpRISCV64AND)
10552 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SRL, t)
10553 v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10554 v1.AddArg(x)
10555 v0.AddArg2(v1, y)
10556 v2 := b.NewValue0(v.Pos, ssaop.OpNeg8, t)
10557 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, t)
10558 v3.AuxInt = ssa.Int64ToAuxInt(64)
10559 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10560 v4.AddArg(y)
10561 v3.AddArg(v4)
10562 v2.AddArg(v3)
10563 v.AddArg2(v0, v2)
10564 return true
10565 }
10566
10567
10568
10569 for {
10570 x := v_0
10571 y := v_1
10572 if !(ssa.ShiftIsBounded(v)) {
10573 break
10574 }
10575 v.Reset(ssaop.OpRISCV64SRL)
10576 v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10577 v0.AddArg(x)
10578 v.AddArg2(v0, y)
10579 return true
10580 }
10581 return false
10582 }
10583 func rewriteValue_OpRsh8x16(v *ssa.Value) bool {
10584 v_1 := v.Args[1]
10585 v_0 := v.Args[0]
10586 b := v.Block
10587 typ := &b.Func.Config.Types
10588
10589
10590
10591 for {
10592 t := v.Type
10593 x := v_0
10594 y := v_1
10595 if !(!ssa.ShiftIsBounded(v)) {
10596 break
10597 }
10598 v.Reset(ssaop.OpRISCV64SRA)
10599 v.Type = t
10600 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10601 v0.AddArg(x)
10602 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10603 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10604 v2.AuxInt = ssa.Int64ToAuxInt(-1)
10605 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10606 v3.AuxInt = ssa.Int64ToAuxInt(64)
10607 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.UInt64)
10608 v4.AddArg(y)
10609 v3.AddArg(v4)
10610 v2.AddArg(v3)
10611 v1.AddArg2(y, v2)
10612 v.AddArg2(v0, v1)
10613 return true
10614 }
10615
10616
10617
10618 for {
10619 x := v_0
10620 y := v_1
10621 if !(ssa.ShiftIsBounded(v)) {
10622 break
10623 }
10624 v.Reset(ssaop.OpRISCV64SRA)
10625 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10626 v0.AddArg(x)
10627 v.AddArg2(v0, y)
10628 return true
10629 }
10630 return false
10631 }
10632 func rewriteValue_OpRsh8x32(v *ssa.Value) bool {
10633 v_1 := v.Args[1]
10634 v_0 := v.Args[0]
10635 b := v.Block
10636 typ := &b.Func.Config.Types
10637
10638
10639
10640 for {
10641 t := v.Type
10642 x := v_0
10643 y := v_1
10644 if !(!ssa.ShiftIsBounded(v)) {
10645 break
10646 }
10647 v.Reset(ssaop.OpRISCV64SRA)
10648 v.Type = t
10649 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10650 v0.AddArg(x)
10651 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10652 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10653 v2.AuxInt = ssa.Int64ToAuxInt(-1)
10654 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10655 v3.AuxInt = ssa.Int64ToAuxInt(64)
10656 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.UInt64)
10657 v4.AddArg(y)
10658 v3.AddArg(v4)
10659 v2.AddArg(v3)
10660 v1.AddArg2(y, v2)
10661 v.AddArg2(v0, v1)
10662 return true
10663 }
10664
10665
10666
10667 for {
10668 x := v_0
10669 y := v_1
10670 if !(ssa.ShiftIsBounded(v)) {
10671 break
10672 }
10673 v.Reset(ssaop.OpRISCV64SRA)
10674 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10675 v0.AddArg(x)
10676 v.AddArg2(v0, y)
10677 return true
10678 }
10679 return false
10680 }
10681 func rewriteValue_OpRsh8x64(v *ssa.Value) bool {
10682 v_1 := v.Args[1]
10683 v_0 := v.Args[0]
10684 b := v.Block
10685 typ := &b.Func.Config.Types
10686
10687
10688
10689 for {
10690 t := v.Type
10691 x := v_0
10692 y := v_1
10693 if !(!ssa.ShiftIsBounded(v)) {
10694 break
10695 }
10696 v.Reset(ssaop.OpRISCV64SRA)
10697 v.Type = t
10698 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10699 v0.AddArg(x)
10700 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10701 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10702 v2.AuxInt = ssa.Int64ToAuxInt(-1)
10703 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10704 v3.AuxInt = ssa.Int64ToAuxInt(64)
10705 v3.AddArg(y)
10706 v2.AddArg(v3)
10707 v1.AddArg2(y, v2)
10708 v.AddArg2(v0, v1)
10709 return true
10710 }
10711
10712
10713
10714 for {
10715 x := v_0
10716 y := v_1
10717 if !(ssa.ShiftIsBounded(v)) {
10718 break
10719 }
10720 v.Reset(ssaop.OpRISCV64SRA)
10721 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10722 v0.AddArg(x)
10723 v.AddArg2(v0, y)
10724 return true
10725 }
10726 return false
10727 }
10728 func rewriteValue_OpRsh8x8(v *ssa.Value) bool {
10729 v_1 := v.Args[1]
10730 v_0 := v.Args[0]
10731 b := v.Block
10732 typ := &b.Func.Config.Types
10733
10734
10735
10736 for {
10737 t := v.Type
10738 x := v_0
10739 y := v_1
10740 if !(!ssa.ShiftIsBounded(v)) {
10741 break
10742 }
10743 v.Reset(ssaop.OpRISCV64SRA)
10744 v.Type = t
10745 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10746 v0.AddArg(x)
10747 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64OR, y.Type)
10748 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADDI, y.Type)
10749 v2.AuxInt = ssa.Int64ToAuxInt(-1)
10750 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTIU, y.Type)
10751 v3.AuxInt = ssa.Int64ToAuxInt(64)
10752 v4 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64)
10753 v4.AddArg(y)
10754 v3.AddArg(v4)
10755 v2.AddArg(v3)
10756 v1.AddArg2(y, v2)
10757 v.AddArg2(v0, v1)
10758 return true
10759 }
10760
10761
10762
10763 for {
10764 x := v_0
10765 y := v_1
10766 if !(ssa.ShiftIsBounded(v)) {
10767 break
10768 }
10769 v.Reset(ssaop.OpRISCV64SRA)
10770 v0 := b.NewValue0(v.Pos, ssaop.OpSignExt8to64, typ.Int64)
10771 v0.AddArg(x)
10772 v.AddArg2(v0, y)
10773 return true
10774 }
10775 return false
10776 }
10777 func rewriteValue_OpSelect0(v *ssa.Value) bool {
10778 v_0 := v.Args[0]
10779 b := v.Block
10780 typ := &b.Func.Config.Types
10781
10782
10783 for {
10784 if v_0.Op != ssaop.OpAdd64carry {
10785 break
10786 }
10787 c := v_0.Args[2]
10788 x := v_0.Args[0]
10789 y := v_0.Args[1]
10790 v.Reset(ssaop.OpRISCV64ADD)
10791 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADD, typ.UInt64)
10792 v0.AddArg2(x, y)
10793 v.AddArg2(v0, c)
10794 return true
10795 }
10796
10797
10798 for {
10799 if v_0.Op != ssaop.OpSub64borrow {
10800 break
10801 }
10802 c := v_0.Args[2]
10803 x := v_0.Args[0]
10804 y := v_0.Args[1]
10805 v.Reset(ssaop.OpRISCV64SUB)
10806 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.UInt64)
10807 v0.AddArg2(x, y)
10808 v.AddArg2(v0, c)
10809 return true
10810 }
10811
10812
10813
10814 for {
10815 m := v_0
10816 if m.Op != ssaop.OpRISCV64LoweredMuluhilo {
10817 break
10818 }
10819 y := m.Args[1]
10820 x := m.Args[0]
10821 if !(m.Uses == 1) {
10822 break
10823 }
10824 v.Reset(ssaop.OpRISCV64MULHU)
10825 v.AddArg2(x, y)
10826 return true
10827 }
10828 return false
10829 }
10830 func rewriteValue_OpSelect1(v *ssa.Value) bool {
10831 v_0 := v.Args[0]
10832 b := v.Block
10833 typ := &b.Func.Config.Types
10834
10835
10836 for {
10837 if v_0.Op != ssaop.OpAdd64carry {
10838 break
10839 }
10840 c := v_0.Args[2]
10841 x := v_0.Args[0]
10842 y := v_0.Args[1]
10843 v.Reset(ssaop.OpRISCV64OR)
10844 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTU, typ.UInt64)
10845 s := b.NewValue0(v.Pos, ssaop.OpRISCV64ADD, typ.UInt64)
10846 s.AddArg2(x, y)
10847 v0.AddArg2(s, x)
10848 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTU, typ.UInt64)
10849 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64ADD, typ.UInt64)
10850 v3.AddArg2(s, c)
10851 v2.AddArg2(v3, s)
10852 v.AddArg2(v0, v2)
10853 return true
10854 }
10855
10856
10857 for {
10858 if v_0.Op != ssaop.OpSub64borrow {
10859 break
10860 }
10861 c := v_0.Args[2]
10862 x := v_0.Args[0]
10863 y := v_0.Args[1]
10864 v.Reset(ssaop.OpRISCV64OR)
10865 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTU, typ.UInt64)
10866 s := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.UInt64)
10867 s.AddArg2(x, y)
10868 v0.AddArg2(x, s)
10869 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64SLTU, typ.UInt64)
10870 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64SUB, typ.UInt64)
10871 v3.AddArg2(s, c)
10872 v2.AddArg2(s, v3)
10873 v.AddArg2(v0, v2)
10874 return true
10875 }
10876
10877
10878
10879 for {
10880 m := v_0
10881 if m.Op != ssaop.OpRISCV64LoweredMuluhilo {
10882 break
10883 }
10884 y := m.Args[1]
10885 x := m.Args[0]
10886 if !(m.Uses == 1) {
10887 break
10888 }
10889 v.Reset(ssaop.OpRISCV64MUL)
10890 v.AddArg2(x, y)
10891 return true
10892 }
10893 return false
10894 }
10895 func rewriteValue_OpSlicemask(v *ssa.Value) bool {
10896 v_0 := v.Args[0]
10897 b := v.Block
10898
10899
10900 for {
10901 t := v.Type
10902 x := v_0
10903 v.Reset(ssaop.OpRISCV64SRAI)
10904 v.AuxInt = ssa.Int64ToAuxInt(63)
10905 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64NEG, t)
10906 v0.AddArg(x)
10907 v.AddArg(v0)
10908 return true
10909 }
10910 }
10911 func rewriteValue_OpStore(v *ssa.Value) bool {
10912 v_2 := v.Args[2]
10913 v_1 := v.Args[1]
10914 v_0 := v.Args[0]
10915
10916
10917
10918 for {
10919 t := ssa.AuxToType(v.Aux)
10920 ptr := v_0
10921 val := v_1
10922 mem := v_2
10923 if !(t.Size() == 1) {
10924 break
10925 }
10926 v.Reset(ssaop.OpRISCV64MOVBstore)
10927 v.AddArg3(ptr, val, mem)
10928 return true
10929 }
10930
10931
10932
10933 for {
10934 t := ssa.AuxToType(v.Aux)
10935 ptr := v_0
10936 val := v_1
10937 mem := v_2
10938 if !(t.Size() == 2) {
10939 break
10940 }
10941 v.Reset(ssaop.OpRISCV64MOVHstore)
10942 v.AddArg3(ptr, val, mem)
10943 return true
10944 }
10945
10946
10947
10948 for {
10949 t := ssa.AuxToType(v.Aux)
10950 ptr := v_0
10951 val := v_1
10952 mem := v_2
10953 if !(t.Size() == 4 && !t.IsFloat()) {
10954 break
10955 }
10956 v.Reset(ssaop.OpRISCV64MOVWstore)
10957 v.AddArg3(ptr, val, mem)
10958 return true
10959 }
10960
10961
10962
10963 for {
10964 t := ssa.AuxToType(v.Aux)
10965 ptr := v_0
10966 val := v_1
10967 mem := v_2
10968 if !(t.Size() == 8 && !t.IsFloat()) {
10969 break
10970 }
10971 v.Reset(ssaop.OpRISCV64MOVDstore)
10972 v.AddArg3(ptr, val, mem)
10973 return true
10974 }
10975
10976
10977
10978 for {
10979 t := ssa.AuxToType(v.Aux)
10980 ptr := v_0
10981 val := v_1
10982 mem := v_2
10983 if !(t.Size() == 4 && t.IsFloat()) {
10984 break
10985 }
10986 v.Reset(ssaop.OpRISCV64FMOVWstore)
10987 v.AddArg3(ptr, val, mem)
10988 return true
10989 }
10990
10991
10992
10993 for {
10994 t := ssa.AuxToType(v.Aux)
10995 ptr := v_0
10996 val := v_1
10997 mem := v_2
10998 if !(t.Size() == 8 && t.IsFloat()) {
10999 break
11000 }
11001 v.Reset(ssaop.OpRISCV64FMOVDstore)
11002 v.AddArg3(ptr, val, mem)
11003 return true
11004 }
11005 return false
11006 }
11007 func rewriteValue_OpZero(v *ssa.Value) bool {
11008 v_1 := v.Args[1]
11009 v_0 := v.Args[0]
11010 b := v.Block
11011 config := b.Func.Config
11012 typ := &b.Func.Config.Types
11013
11014
11015 for {
11016 if ssa.AuxIntToInt64(v.AuxInt) != 0 {
11017 break
11018 }
11019 mem := v_1
11020 v.CopyOf(mem)
11021 return true
11022 }
11023
11024
11025 for {
11026 if ssa.AuxIntToInt64(v.AuxInt) != 1 {
11027 break
11028 }
11029 ptr := v_0
11030 mem := v_1
11031 v.Reset(ssaop.OpRISCV64MOVBstore)
11032 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11033 v0.AuxInt = ssa.Int64ToAuxInt(0)
11034 v.AddArg3(ptr, v0, mem)
11035 return true
11036 }
11037
11038
11039
11040 for {
11041 if ssa.AuxIntToInt64(v.AuxInt) != 2 {
11042 break
11043 }
11044 t := ssa.AuxToType(v.Aux)
11045 ptr := v_0
11046 mem := v_1
11047 if !(t.Alignment()%2 == 0) {
11048 break
11049 }
11050 v.Reset(ssaop.OpRISCV64MOVHstore)
11051 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11052 v0.AuxInt = ssa.Int64ToAuxInt(0)
11053 v.AddArg3(ptr, v0, mem)
11054 return true
11055 }
11056
11057
11058 for {
11059 if ssa.AuxIntToInt64(v.AuxInt) != 2 {
11060 break
11061 }
11062 ptr := v_0
11063 mem := v_1
11064 v.Reset(ssaop.OpRISCV64MOVBstore)
11065 v.AuxInt = ssa.Int32ToAuxInt(1)
11066 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11067 v0.AuxInt = ssa.Int64ToAuxInt(0)
11068 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11069 v1.AddArg3(ptr, v0, mem)
11070 v.AddArg3(ptr, v0, v1)
11071 return true
11072 }
11073
11074
11075
11076 for {
11077 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
11078 break
11079 }
11080 t := ssa.AuxToType(v.Aux)
11081 ptr := v_0
11082 mem := v_1
11083 if !(t.Alignment()%4 == 0) {
11084 break
11085 }
11086 v.Reset(ssaop.OpRISCV64MOVWstore)
11087 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11088 v0.AuxInt = ssa.Int64ToAuxInt(0)
11089 v.AddArg3(ptr, v0, mem)
11090 return true
11091 }
11092
11093
11094
11095 for {
11096 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
11097 break
11098 }
11099 t := ssa.AuxToType(v.Aux)
11100 ptr := v_0
11101 mem := v_1
11102 if !(t.Alignment()%2 == 0) {
11103 break
11104 }
11105 v.Reset(ssaop.OpRISCV64MOVHstore)
11106 v.AuxInt = ssa.Int32ToAuxInt(2)
11107 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11108 v0.AuxInt = ssa.Int64ToAuxInt(0)
11109 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11110 v1.AddArg3(ptr, v0, mem)
11111 v.AddArg3(ptr, v0, v1)
11112 return true
11113 }
11114
11115
11116 for {
11117 if ssa.AuxIntToInt64(v.AuxInt) != 4 {
11118 break
11119 }
11120 ptr := v_0
11121 mem := v_1
11122 v.Reset(ssaop.OpRISCV64MOVBstore)
11123 v.AuxInt = ssa.Int32ToAuxInt(3)
11124 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11125 v0.AuxInt = ssa.Int64ToAuxInt(0)
11126 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11127 v1.AuxInt = ssa.Int32ToAuxInt(2)
11128 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11129 v2.AuxInt = ssa.Int32ToAuxInt(1)
11130 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11131 v3.AddArg3(ptr, v0, mem)
11132 v2.AddArg3(ptr, v0, v3)
11133 v1.AddArg3(ptr, v0, v2)
11134 v.AddArg3(ptr, v0, v1)
11135 return true
11136 }
11137
11138
11139
11140 for {
11141 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
11142 break
11143 }
11144 t := ssa.AuxToType(v.Aux)
11145 ptr := v_0
11146 mem := v_1
11147 if !(t.Alignment()%8 == 0) {
11148 break
11149 }
11150 v.Reset(ssaop.OpRISCV64MOVDstore)
11151 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11152 v0.AuxInt = ssa.Int64ToAuxInt(0)
11153 v.AddArg3(ptr, v0, mem)
11154 return true
11155 }
11156
11157
11158
11159 for {
11160 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
11161 break
11162 }
11163 t := ssa.AuxToType(v.Aux)
11164 ptr := v_0
11165 mem := v_1
11166 if !(t.Alignment()%4 == 0) {
11167 break
11168 }
11169 v.Reset(ssaop.OpRISCV64MOVWstore)
11170 v.AuxInt = ssa.Int32ToAuxInt(4)
11171 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11172 v0.AuxInt = ssa.Int64ToAuxInt(0)
11173 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVWstore, types.TypeMem)
11174 v1.AddArg3(ptr, v0, mem)
11175 v.AddArg3(ptr, v0, v1)
11176 return true
11177 }
11178
11179
11180
11181 for {
11182 if ssa.AuxIntToInt64(v.AuxInt) != 8 {
11183 break
11184 }
11185 t := ssa.AuxToType(v.Aux)
11186 ptr := v_0
11187 mem := v_1
11188 if !(t.Alignment()%2 == 0) {
11189 break
11190 }
11191 v.Reset(ssaop.OpRISCV64MOVHstore)
11192 v.AuxInt = ssa.Int32ToAuxInt(6)
11193 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11194 v0.AuxInt = ssa.Int64ToAuxInt(0)
11195 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11196 v1.AuxInt = ssa.Int32ToAuxInt(4)
11197 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11198 v2.AuxInt = ssa.Int32ToAuxInt(2)
11199 v3 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11200 v3.AddArg3(ptr, v0, mem)
11201 v2.AddArg3(ptr, v0, v3)
11202 v1.AddArg3(ptr, v0, v2)
11203 v.AddArg3(ptr, v0, v1)
11204 return true
11205 }
11206
11207
11208 for {
11209 if ssa.AuxIntToInt64(v.AuxInt) != 3 {
11210 break
11211 }
11212 ptr := v_0
11213 mem := v_1
11214 v.Reset(ssaop.OpRISCV64MOVBstore)
11215 v.AuxInt = ssa.Int32ToAuxInt(2)
11216 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11217 v0.AuxInt = ssa.Int64ToAuxInt(0)
11218 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11219 v1.AuxInt = ssa.Int32ToAuxInt(1)
11220 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVBstore, types.TypeMem)
11221 v2.AddArg3(ptr, v0, mem)
11222 v1.AddArg3(ptr, v0, v2)
11223 v.AddArg3(ptr, v0, v1)
11224 return true
11225 }
11226
11227
11228
11229 for {
11230 if ssa.AuxIntToInt64(v.AuxInt) != 6 {
11231 break
11232 }
11233 t := ssa.AuxToType(v.Aux)
11234 ptr := v_0
11235 mem := v_1
11236 if !(t.Alignment()%2 == 0) {
11237 break
11238 }
11239 v.Reset(ssaop.OpRISCV64MOVHstore)
11240 v.AuxInt = ssa.Int32ToAuxInt(4)
11241 v0 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11242 v0.AuxInt = ssa.Int64ToAuxInt(0)
11243 v1 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11244 v1.AuxInt = ssa.Int32ToAuxInt(2)
11245 v2 := b.NewValue0(v.Pos, ssaop.OpRISCV64MOVHstore, types.TypeMem)
11246 v2.AddArg3(ptr, v0, mem)
11247 v1.AddArg3(ptr, v0, v2)
11248 v.AddArg3(ptr, v0, v1)
11249 return true
11250 }
11251
11252
11253
11254 for {
11255 s := ssa.AuxIntToInt64(v.AuxInt)
11256 t := ssa.AuxToType(v.Aux)
11257 ptr := v_0
11258 mem := v_1
11259 if !(s <= 24*ssa.MoveSize(t.Alignment(), config)) {
11260 break
11261 }
11262 v.Reset(ssaop.OpRISCV64LoweredZero)
11263 v.AuxInt = ssa.Int64ToAuxInt(s)
11264 v.Aux = ssa.Int64ToAux(t.Alignment())
11265 v.AddArg2(ptr, mem)
11266 return true
11267 }
11268
11269
11270
11271 for {
11272 s := ssa.AuxIntToInt64(v.AuxInt)
11273 t := ssa.AuxToType(v.Aux)
11274 ptr := v_0
11275 mem := v_1
11276 if !(s > 24*ssa.MoveSize(t.Alignment(), config)) {
11277 break
11278 }
11279 v.Reset(ssaop.OpRISCV64LoweredZeroLoop)
11280 v.AuxInt = ssa.Int64ToAuxInt(s)
11281 v.Aux = ssa.Int64ToAux(t.Alignment())
11282 v.AddArg2(ptr, mem)
11283 return true
11284 }
11285 return false
11286 }
11287 func RewriteBlock(b *ssa.Block) bool {
11288 typ := &b.Func.Config.Types
11289 switch b.Kind {
11290 case block.BlockRISCV64BEQ:
11291
11292
11293 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11294 v_0 := b.Controls[0]
11295 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11296 break
11297 }
11298 cond := b.Controls[1]
11299 b.ResetWithControl(block.BlockRISCV64BEQZ, cond)
11300 return true
11301 }
11302
11303
11304 for b.Controls[1].Op == ssaop.OpRISCV64MOVDconst {
11305 cond := b.Controls[0]
11306 v_1 := b.Controls[1]
11307 if ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
11308 break
11309 }
11310 b.ResetWithControl(block.BlockRISCV64BEQZ, cond)
11311 return true
11312 }
11313 case block.BlockRISCV64BEQZ:
11314
11315
11316 for b.Controls[0].Op == ssaop.OpRISCV64SEQZ {
11317 v_0 := b.Controls[0]
11318 x := v_0.Args[0]
11319 b.ResetWithControl(block.BlockRISCV64BNEZ, x)
11320 return true
11321 }
11322
11323
11324 for b.Controls[0].Op == ssaop.OpRISCV64SNEZ {
11325 v_0 := b.Controls[0]
11326 x := v_0.Args[0]
11327 b.ResetWithControl(block.BlockRISCV64BEQZ, x)
11328 return true
11329 }
11330
11331
11332 for b.Controls[0].Op == ssaop.OpRISCV64NEG {
11333 v_0 := b.Controls[0]
11334 x := v_0.Args[0]
11335 b.ResetWithControl(block.BlockRISCV64BEQZ, x)
11336 return true
11337 }
11338
11339
11340 for b.Controls[0].Op == ssaop.OpRISCV64FNES {
11341 v_0 := b.Controls[0]
11342 t := v_0.Type
11343 _ = v_0.Args[1]
11344 v_0_0 := v_0.Args[0]
11345 v_0_1 := v_0.Args[1]
11346 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11347 x := v_0_0
11348 y := v_0_1
11349 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FEQS, t)
11350 v0.AddArg2(x, y)
11351 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11352 return true
11353 }
11354 }
11355
11356
11357 for b.Controls[0].Op == ssaop.OpRISCV64FNED {
11358 v_0 := b.Controls[0]
11359 t := v_0.Type
11360 _ = v_0.Args[1]
11361 v_0_0 := v_0.Args[0]
11362 v_0_1 := v_0.Args[1]
11363 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11364 x := v_0_0
11365 y := v_0_1
11366 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FEQD, t)
11367 v0.AddArg2(x, y)
11368 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11369 return true
11370 }
11371 }
11372
11373
11374 for b.Controls[0].Op == ssaop.OpRISCV64SUB {
11375 v_0 := b.Controls[0]
11376 y := v_0.Args[1]
11377 x := v_0.Args[0]
11378 b.ResetWithControl2(block.BlockRISCV64BEQ, x, y)
11379 return true
11380 }
11381
11382
11383 for b.Controls[0].Op == ssaop.OpRISCV64SLT {
11384 v_0 := b.Controls[0]
11385 y := v_0.Args[1]
11386 x := v_0.Args[0]
11387 b.ResetWithControl2(block.BlockRISCV64BGE, x, y)
11388 return true
11389 }
11390
11391
11392 for b.Controls[0].Op == ssaop.OpRISCV64SLTU {
11393 v_0 := b.Controls[0]
11394 y := v_0.Args[1]
11395 x := v_0.Args[0]
11396 b.ResetWithControl2(block.BlockRISCV64BGEU, x, y)
11397 return true
11398 }
11399
11400
11401 for b.Controls[0].Op == ssaop.OpRISCV64SLTI {
11402 v_0 := b.Controls[0]
11403 x := ssa.AuxIntToInt64(v_0.AuxInt)
11404 y := v_0.Args[0]
11405 v0 := b.NewValue0(b.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11406 v0.AuxInt = ssa.Int64ToAuxInt(x)
11407 b.ResetWithControl2(block.BlockRISCV64BGE, y, v0)
11408 return true
11409 }
11410
11411
11412 for b.Controls[0].Op == ssaop.OpRISCV64SLTIU {
11413 v_0 := b.Controls[0]
11414 x := ssa.AuxIntToInt64(v_0.AuxInt)
11415 y := v_0.Args[0]
11416 v0 := b.NewValue0(b.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11417 v0.AuxInt = ssa.Int64ToAuxInt(x)
11418 b.ResetWithControl2(block.BlockRISCV64BGEU, y, v0)
11419 return true
11420 }
11421
11422
11423
11424 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11425 a := b.Controls[0]
11426 x := ssa.AuxIntToInt64(a.AuxInt)
11427 y := a.Args[0]
11428 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
11429 break
11430 }
11431 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11432 v0.AuxInt = ssa.Int64ToAuxInt(1)
11433 v1 := b.NewValue0(a.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
11434 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
11435 v1.AddArg(y)
11436 v0.AddArg(v1)
11437 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11438 return true
11439 }
11440
11441
11442
11443 for b.Controls[0].Op == ssaop.OpRISCV64AND {
11444 a := b.Controls[0]
11445 _ = a.Args[1]
11446 a_0 := a.Args[0]
11447 a_1 := a.Args[1]
11448 for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 {
11449 if a_0.Op != ssaop.OpRISCV64MOVDconst {
11450 continue
11451 }
11452 x := ssa.AuxIntToInt64(a_0.AuxInt)
11453 y := a_1
11454 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
11455 continue
11456 }
11457 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11458 v0.AuxInt = ssa.Int64ToAuxInt(1)
11459 v1 := b.NewValue0(a.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
11460 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
11461 v1.AddArg(y)
11462 v0.AddArg(v1)
11463 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11464 return true
11465 }
11466 break
11467 }
11468
11469
11470
11471 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11472 a := b.Controls[0]
11473 x := ssa.AuxIntToInt64(a.AuxInt)
11474 a_0 := a.Args[0]
11475 if a_0.Op != ssaop.OpRISCV64SRLI {
11476 break
11477 }
11478 y := ssa.AuxIntToInt64(a_0.AuxInt)
11479 z := a_0.Args[0]
11480 if !(ssa.IsPowerOfTwo(uint64(x)) && ssa.Is12Bit(x<<y) && a.Uses == 1) {
11481 break
11482 }
11483 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11484 v0.AuxInt = ssa.Int64ToAuxInt(x << y)
11485 v0.AddArg(z)
11486 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11487 return true
11488 }
11489
11490
11491 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11492 v_0 := b.Controls[0]
11493 c := ssa.AuxIntToInt64(v_0.AuxInt)
11494 v_0_0 := v_0.Args[0]
11495 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
11496 break
11497 }
11498 v_0_0_0 := v_0_0.Args[0]
11499 if v_0_0_0.Op != ssaop.OpRISCV64FNEGD {
11500 break
11501 }
11502 x := v_0_0_0.Args[0]
11503 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
11504 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_0000_0000) | int64(bits.Reverse8(uint8(c))&0b1111_1111))
11505 v1 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
11506 v1.AddArg(x)
11507 v0.AddArg(v1)
11508 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11509 return true
11510 }
11511
11512
11513 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11514 v_0 := b.Controls[0]
11515 c := ssa.AuxIntToInt64(v_0.AuxInt)
11516 v_0_0 := v_0.Args[0]
11517 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
11518 break
11519 }
11520 v_0_0_0 := v_0_0.Args[0]
11521 if v_0_0_0.Op != ssaop.OpRISCV64FABSD {
11522 break
11523 }
11524 x := v_0_0_0.Args[0]
11525 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
11526 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_1111_0000) | int64(bits.Reverse8(uint8(c))&0b0000_1111))
11527 v1 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
11528 v1.AddArg(x)
11529 v0.AddArg(v1)
11530 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11531 return true
11532 }
11533 case block.BlockRISCV64BGE:
11534
11535
11536 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11537 v_0 := b.Controls[0]
11538 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11539 break
11540 }
11541 cond := b.Controls[1]
11542 b.ResetWithControl(block.BlockRISCV64BLEZ, cond)
11543 return true
11544 }
11545
11546
11547 for b.Controls[1].Op == ssaop.OpRISCV64MOVDconst {
11548 cond := b.Controls[0]
11549 v_1 := b.Controls[1]
11550 if ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
11551 break
11552 }
11553 b.ResetWithControl(block.BlockRISCV64BGEZ, cond)
11554 return true
11555 }
11556 case block.BlockRISCV64BGEU:
11557
11558
11559 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11560 v_0 := b.Controls[0]
11561 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11562 break
11563 }
11564 cond := b.Controls[1]
11565 b.ResetWithControl(block.BlockRISCV64BEQZ, cond)
11566 return true
11567 }
11568 case block.BlockRISCV64BLT:
11569
11570
11571 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11572 v_0 := b.Controls[0]
11573 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11574 break
11575 }
11576 cond := b.Controls[1]
11577 b.ResetWithControl(block.BlockRISCV64BGTZ, cond)
11578 return true
11579 }
11580
11581
11582 for b.Controls[1].Op == ssaop.OpRISCV64MOVDconst {
11583 cond := b.Controls[0]
11584 v_1 := b.Controls[1]
11585 if ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
11586 break
11587 }
11588 b.ResetWithControl(block.BlockRISCV64BLTZ, cond)
11589 return true
11590 }
11591 case block.BlockRISCV64BLTU:
11592
11593
11594 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11595 v_0 := b.Controls[0]
11596 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11597 break
11598 }
11599 cond := b.Controls[1]
11600 b.ResetWithControl(block.BlockRISCV64BNEZ, cond)
11601 return true
11602 }
11603 case block.BlockRISCV64BNE:
11604
11605
11606 for b.Controls[0].Op == ssaop.OpRISCV64MOVDconst {
11607 v_0 := b.Controls[0]
11608 if ssa.AuxIntToInt64(v_0.AuxInt) != 0 {
11609 break
11610 }
11611 cond := b.Controls[1]
11612 b.ResetWithControl(block.BlockRISCV64BNEZ, cond)
11613 return true
11614 }
11615
11616
11617 for b.Controls[1].Op == ssaop.OpRISCV64MOVDconst {
11618 cond := b.Controls[0]
11619 v_1 := b.Controls[1]
11620 if ssa.AuxIntToInt64(v_1.AuxInt) != 0 {
11621 break
11622 }
11623 b.ResetWithControl(block.BlockRISCV64BNEZ, cond)
11624 return true
11625 }
11626 case block.BlockRISCV64BNEZ:
11627
11628
11629 for b.Controls[0].Op == ssaop.OpRISCV64SEQZ {
11630 v_0 := b.Controls[0]
11631 x := v_0.Args[0]
11632 b.ResetWithControl(block.BlockRISCV64BEQZ, x)
11633 return true
11634 }
11635
11636
11637 for b.Controls[0].Op == ssaop.OpRISCV64SNEZ {
11638 v_0 := b.Controls[0]
11639 x := v_0.Args[0]
11640 b.ResetWithControl(block.BlockRISCV64BNEZ, x)
11641 return true
11642 }
11643
11644
11645 for b.Controls[0].Op == ssaop.OpRISCV64NEG {
11646 v_0 := b.Controls[0]
11647 x := v_0.Args[0]
11648 b.ResetWithControl(block.BlockRISCV64BNEZ, x)
11649 return true
11650 }
11651
11652
11653 for b.Controls[0].Op == ssaop.OpRISCV64FNES {
11654 v_0 := b.Controls[0]
11655 t := v_0.Type
11656 _ = v_0.Args[1]
11657 v_0_0 := v_0.Args[0]
11658 v_0_1 := v_0.Args[1]
11659 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11660 x := v_0_0
11661 y := v_0_1
11662 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FEQS, t)
11663 v0.AddArg2(x, y)
11664 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11665 return true
11666 }
11667 }
11668
11669
11670 for b.Controls[0].Op == ssaop.OpRISCV64FNED {
11671 v_0 := b.Controls[0]
11672 t := v_0.Type
11673 _ = v_0.Args[1]
11674 v_0_0 := v_0.Args[0]
11675 v_0_1 := v_0.Args[1]
11676 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11677 x := v_0_0
11678 y := v_0_1
11679 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FEQD, t)
11680 v0.AddArg2(x, y)
11681 b.ResetWithControl(block.BlockRISCV64BEQZ, v0)
11682 return true
11683 }
11684 }
11685
11686
11687 for b.Controls[0].Op == ssaop.OpRISCV64SUB {
11688 v_0 := b.Controls[0]
11689 y := v_0.Args[1]
11690 x := v_0.Args[0]
11691 b.ResetWithControl2(block.BlockRISCV64BNE, x, y)
11692 return true
11693 }
11694
11695
11696 for b.Controls[0].Op == ssaop.OpRISCV64SLT {
11697 v_0 := b.Controls[0]
11698 y := v_0.Args[1]
11699 x := v_0.Args[0]
11700 b.ResetWithControl2(block.BlockRISCV64BLT, x, y)
11701 return true
11702 }
11703
11704
11705 for b.Controls[0].Op == ssaop.OpRISCV64SLTU {
11706 v_0 := b.Controls[0]
11707 y := v_0.Args[1]
11708 x := v_0.Args[0]
11709 b.ResetWithControl2(block.BlockRISCV64BLTU, x, y)
11710 return true
11711 }
11712
11713
11714 for b.Controls[0].Op == ssaop.OpRISCV64SLTI {
11715 v_0 := b.Controls[0]
11716 x := ssa.AuxIntToInt64(v_0.AuxInt)
11717 y := v_0.Args[0]
11718 v0 := b.NewValue0(b.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11719 v0.AuxInt = ssa.Int64ToAuxInt(x)
11720 b.ResetWithControl2(block.BlockRISCV64BLT, y, v0)
11721 return true
11722 }
11723
11724
11725 for b.Controls[0].Op == ssaop.OpRISCV64SLTIU {
11726 v_0 := b.Controls[0]
11727 x := ssa.AuxIntToInt64(v_0.AuxInt)
11728 y := v_0.Args[0]
11729 v0 := b.NewValue0(b.Pos, ssaop.OpRISCV64MOVDconst, typ.UInt64)
11730 v0.AuxInt = ssa.Int64ToAuxInt(x)
11731 b.ResetWithControl2(block.BlockRISCV64BLTU, y, v0)
11732 return true
11733 }
11734
11735
11736
11737 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11738 a := b.Controls[0]
11739 x := ssa.AuxIntToInt64(a.AuxInt)
11740 y := a.Args[0]
11741 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
11742 break
11743 }
11744 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11745 v0.AuxInt = ssa.Int64ToAuxInt(1)
11746 v1 := b.NewValue0(a.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
11747 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
11748 v1.AddArg(y)
11749 v0.AddArg(v1)
11750 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11751 return true
11752 }
11753
11754
11755
11756 for b.Controls[0].Op == ssaop.OpRISCV64AND {
11757 a := b.Controls[0]
11758 _ = a.Args[1]
11759 a_0 := a.Args[0]
11760 a_1 := a.Args[1]
11761 for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 {
11762 if a_0.Op != ssaop.OpRISCV64MOVDconst {
11763 continue
11764 }
11765 x := ssa.AuxIntToInt64(a_0.AuxInt)
11766 y := a_1
11767 if !(ssa.IsPowerOfTwo(uint64(x)) && !ssa.Is12Bit(x) && a.Uses == 1) {
11768 continue
11769 }
11770 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11771 v0.AuxInt = ssa.Int64ToAuxInt(1)
11772 v1 := b.NewValue0(a.Pos, ssaop.OpRISCV64SRLI, typ.UInt64)
11773 v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(x)))
11774 v1.AddArg(y)
11775 v0.AddArg(v1)
11776 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11777 return true
11778 }
11779 break
11780 }
11781
11782
11783
11784 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11785 a := b.Controls[0]
11786 x := ssa.AuxIntToInt64(a.AuxInt)
11787 a_0 := a.Args[0]
11788 if a_0.Op != ssaop.OpRISCV64SRLI {
11789 break
11790 }
11791 y := ssa.AuxIntToInt64(a_0.AuxInt)
11792 z := a_0.Args[0]
11793 if !(ssa.IsPowerOfTwo(uint64(x)) && ssa.Is12Bit(x<<y) && a.Uses == 1) {
11794 break
11795 }
11796 v0 := b.NewValue0(a.Pos, ssaop.OpRISCV64ANDI, typ.UInt64)
11797 v0.AuxInt = ssa.Int64ToAuxInt(x << y)
11798 v0.AddArg(z)
11799 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11800 return true
11801 }
11802
11803
11804 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11805 v_0 := b.Controls[0]
11806 c := ssa.AuxIntToInt64(v_0.AuxInt)
11807 v_0_0 := v_0.Args[0]
11808 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
11809 break
11810 }
11811 v_0_0_0 := v_0_0.Args[0]
11812 if v_0_0_0.Op != ssaop.OpRISCV64FNEGD {
11813 break
11814 }
11815 x := v_0_0_0.Args[0]
11816 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
11817 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_0000_0000) | int64(bits.Reverse8(uint8(c))&0b1111_1111))
11818 v1 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
11819 v1.AddArg(x)
11820 v0.AddArg(v1)
11821 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11822 return true
11823 }
11824
11825
11826 for b.Controls[0].Op == ssaop.OpRISCV64ANDI {
11827 v_0 := b.Controls[0]
11828 c := ssa.AuxIntToInt64(v_0.AuxInt)
11829 v_0_0 := v_0.Args[0]
11830 if v_0_0.Op != ssaop.OpRISCV64FCLASSD {
11831 break
11832 }
11833 v_0_0_0 := v_0_0.Args[0]
11834 if v_0_0_0.Op != ssaop.OpRISCV64FABSD {
11835 break
11836 }
11837 x := v_0_0_0.Args[0]
11838 v0 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64ANDI, typ.Int64)
11839 v0.AuxInt = ssa.Int64ToAuxInt((c & 0b11_1111_0000) | int64(bits.Reverse8(uint8(c))&0b0000_1111))
11840 v1 := b.NewValue0(v_0.Pos, ssaop.OpRISCV64FCLASSD, typ.Int64)
11841 v1.AddArg(x)
11842 v0.AddArg(v1)
11843 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11844 return true
11845 }
11846 case block.BlockIf:
11847
11848
11849 for {
11850 cond := b.Controls[0]
11851 v0 := b.NewValue0(cond.Pos, ssaop.OpRISCV64MOVBUreg, typ.UInt64)
11852 v0.AddArg(cond)
11853 b.ResetWithControl(block.BlockRISCV64BNEZ, v0)
11854 return true
11855 }
11856 case block.BlockJumpTable:
11857
11858
11859 for {
11860 idx := b.Controls[0]
11861 v0 := b.NewValue0(b.Pos, ssaop.OpRISCV64MOVaddr, typ.Uintptr)
11862 v0.Aux = ssa.SymToAux(ssa.MakeJumpTableSym(b))
11863 v1 := b.NewValue0(b.Pos, ssaop.OpSB, typ.Uintptr)
11864 v0.AddArg(v1)
11865 b.ResetWithControl2(block.BlockRISCV64JUMPTABLE, idx, v0)
11866 b.Aux = ssa.SymToAux(ssa.MakeJumpTableSym(b))
11867 return true
11868 }
11869 }
11870 return false
11871 }
11872
View as plain text