/
rewriteMIPS64.go
8506 lines (8503 loc) · 210 KB
/
rewriteMIPS64.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated from _gen/MIPS64.rules using 'go generate'; DO NOT EDIT.
package ssa
import "github.com/go-asm/go/cmd/compile/types"
func rewriteValueMIPS64(v *Value) bool {
switch v.Op {
case OpAbs:
v.Op = OpMIPS64ABSD
return true
case OpAdd16:
v.Op = OpMIPS64ADDV
return true
case OpAdd32:
v.Op = OpMIPS64ADDV
return true
case OpAdd32F:
v.Op = OpMIPS64ADDF
return true
case OpAdd64:
v.Op = OpMIPS64ADDV
return true
case OpAdd64F:
v.Op = OpMIPS64ADDD
return true
case OpAdd8:
v.Op = OpMIPS64ADDV
return true
case OpAddPtr:
v.Op = OpMIPS64ADDV
return true
case OpAddr:
return rewriteValueMIPS64_OpAddr(v)
case OpAnd16:
v.Op = OpMIPS64AND
return true
case OpAnd32:
v.Op = OpMIPS64AND
return true
case OpAnd64:
v.Op = OpMIPS64AND
return true
case OpAnd8:
v.Op = OpMIPS64AND
return true
case OpAndB:
v.Op = OpMIPS64AND
return true
case OpAtomicAdd32:
v.Op = OpMIPS64LoweredAtomicAdd32
return true
case OpAtomicAdd64:
v.Op = OpMIPS64LoweredAtomicAdd64
return true
case OpAtomicAnd32:
v.Op = OpMIPS64LoweredAtomicAnd32
return true
case OpAtomicAnd8:
return rewriteValueMIPS64_OpAtomicAnd8(v)
case OpAtomicCompareAndSwap32:
return rewriteValueMIPS64_OpAtomicCompareAndSwap32(v)
case OpAtomicCompareAndSwap64:
v.Op = OpMIPS64LoweredAtomicCas64
return true
case OpAtomicExchange32:
v.Op = OpMIPS64LoweredAtomicExchange32
return true
case OpAtomicExchange64:
v.Op = OpMIPS64LoweredAtomicExchange64
return true
case OpAtomicLoad32:
v.Op = OpMIPS64LoweredAtomicLoad32
return true
case OpAtomicLoad64:
v.Op = OpMIPS64LoweredAtomicLoad64
return true
case OpAtomicLoad8:
v.Op = OpMIPS64LoweredAtomicLoad8
return true
case OpAtomicLoadPtr:
v.Op = OpMIPS64LoweredAtomicLoad64
return true
case OpAtomicOr32:
v.Op = OpMIPS64LoweredAtomicOr32
return true
case OpAtomicOr8:
return rewriteValueMIPS64_OpAtomicOr8(v)
case OpAtomicStore32:
v.Op = OpMIPS64LoweredAtomicStore32
return true
case OpAtomicStore64:
v.Op = OpMIPS64LoweredAtomicStore64
return true
case OpAtomicStore8:
v.Op = OpMIPS64LoweredAtomicStore8
return true
case OpAtomicStorePtrNoWB:
v.Op = OpMIPS64LoweredAtomicStore64
return true
case OpAvg64u:
return rewriteValueMIPS64_OpAvg64u(v)
case OpClosureCall:
v.Op = OpMIPS64CALLclosure
return true
case OpCom16:
return rewriteValueMIPS64_OpCom16(v)
case OpCom32:
return rewriteValueMIPS64_OpCom32(v)
case OpCom64:
return rewriteValueMIPS64_OpCom64(v)
case OpCom8:
return rewriteValueMIPS64_OpCom8(v)
case OpConst16:
return rewriteValueMIPS64_OpConst16(v)
case OpConst32:
return rewriteValueMIPS64_OpConst32(v)
case OpConst32F:
return rewriteValueMIPS64_OpConst32F(v)
case OpConst64:
return rewriteValueMIPS64_OpConst64(v)
case OpConst64F:
return rewriteValueMIPS64_OpConst64F(v)
case OpConst8:
return rewriteValueMIPS64_OpConst8(v)
case OpConstBool:
return rewriteValueMIPS64_OpConstBool(v)
case OpConstNil:
return rewriteValueMIPS64_OpConstNil(v)
case OpCvt32Fto32:
v.Op = OpMIPS64TRUNCFW
return true
case OpCvt32Fto64:
v.Op = OpMIPS64TRUNCFV
return true
case OpCvt32Fto64F:
v.Op = OpMIPS64MOVFD
return true
case OpCvt32to32F:
v.Op = OpMIPS64MOVWF
return true
case OpCvt32to64F:
v.Op = OpMIPS64MOVWD
return true
case OpCvt64Fto32:
v.Op = OpMIPS64TRUNCDW
return true
case OpCvt64Fto32F:
v.Op = OpMIPS64MOVDF
return true
case OpCvt64Fto64:
v.Op = OpMIPS64TRUNCDV
return true
case OpCvt64to32F:
v.Op = OpMIPS64MOVVF
return true
case OpCvt64to64F:
v.Op = OpMIPS64MOVVD
return true
case OpCvtBoolToUint8:
v.Op = OpCopy
return true
case OpDiv16:
return rewriteValueMIPS64_OpDiv16(v)
case OpDiv16u:
return rewriteValueMIPS64_OpDiv16u(v)
case OpDiv32:
return rewriteValueMIPS64_OpDiv32(v)
case OpDiv32F:
v.Op = OpMIPS64DIVF
return true
case OpDiv32u:
return rewriteValueMIPS64_OpDiv32u(v)
case OpDiv64:
return rewriteValueMIPS64_OpDiv64(v)
case OpDiv64F:
v.Op = OpMIPS64DIVD
return true
case OpDiv64u:
return rewriteValueMIPS64_OpDiv64u(v)
case OpDiv8:
return rewriteValueMIPS64_OpDiv8(v)
case OpDiv8u:
return rewriteValueMIPS64_OpDiv8u(v)
case OpEq16:
return rewriteValueMIPS64_OpEq16(v)
case OpEq32:
return rewriteValueMIPS64_OpEq32(v)
case OpEq32F:
return rewriteValueMIPS64_OpEq32F(v)
case OpEq64:
return rewriteValueMIPS64_OpEq64(v)
case OpEq64F:
return rewriteValueMIPS64_OpEq64F(v)
case OpEq8:
return rewriteValueMIPS64_OpEq8(v)
case OpEqB:
return rewriteValueMIPS64_OpEqB(v)
case OpEqPtr:
return rewriteValueMIPS64_OpEqPtr(v)
case OpGetCallerPC:
v.Op = OpMIPS64LoweredGetCallerPC
return true
case OpGetCallerSP:
v.Op = OpMIPS64LoweredGetCallerSP
return true
case OpGetClosurePtr:
v.Op = OpMIPS64LoweredGetClosurePtr
return true
case OpHmul32:
return rewriteValueMIPS64_OpHmul32(v)
case OpHmul32u:
return rewriteValueMIPS64_OpHmul32u(v)
case OpHmul64:
return rewriteValueMIPS64_OpHmul64(v)
case OpHmul64u:
return rewriteValueMIPS64_OpHmul64u(v)
case OpInterCall:
v.Op = OpMIPS64CALLinter
return true
case OpIsInBounds:
return rewriteValueMIPS64_OpIsInBounds(v)
case OpIsNonNil:
return rewriteValueMIPS64_OpIsNonNil(v)
case OpIsSliceInBounds:
return rewriteValueMIPS64_OpIsSliceInBounds(v)
case OpLeq16:
return rewriteValueMIPS64_OpLeq16(v)
case OpLeq16U:
return rewriteValueMIPS64_OpLeq16U(v)
case OpLeq32:
return rewriteValueMIPS64_OpLeq32(v)
case OpLeq32F:
return rewriteValueMIPS64_OpLeq32F(v)
case OpLeq32U:
return rewriteValueMIPS64_OpLeq32U(v)
case OpLeq64:
return rewriteValueMIPS64_OpLeq64(v)
case OpLeq64F:
return rewriteValueMIPS64_OpLeq64F(v)
case OpLeq64U:
return rewriteValueMIPS64_OpLeq64U(v)
case OpLeq8:
return rewriteValueMIPS64_OpLeq8(v)
case OpLeq8U:
return rewriteValueMIPS64_OpLeq8U(v)
case OpLess16:
return rewriteValueMIPS64_OpLess16(v)
case OpLess16U:
return rewriteValueMIPS64_OpLess16U(v)
case OpLess32:
return rewriteValueMIPS64_OpLess32(v)
case OpLess32F:
return rewriteValueMIPS64_OpLess32F(v)
case OpLess32U:
return rewriteValueMIPS64_OpLess32U(v)
case OpLess64:
return rewriteValueMIPS64_OpLess64(v)
case OpLess64F:
return rewriteValueMIPS64_OpLess64F(v)
case OpLess64U:
return rewriteValueMIPS64_OpLess64U(v)
case OpLess8:
return rewriteValueMIPS64_OpLess8(v)
case OpLess8U:
return rewriteValueMIPS64_OpLess8U(v)
case OpLoad:
return rewriteValueMIPS64_OpLoad(v)
case OpLocalAddr:
return rewriteValueMIPS64_OpLocalAddr(v)
case OpLsh16x16:
return rewriteValueMIPS64_OpLsh16x16(v)
case OpLsh16x32:
return rewriteValueMIPS64_OpLsh16x32(v)
case OpLsh16x64:
return rewriteValueMIPS64_OpLsh16x64(v)
case OpLsh16x8:
return rewriteValueMIPS64_OpLsh16x8(v)
case OpLsh32x16:
return rewriteValueMIPS64_OpLsh32x16(v)
case OpLsh32x32:
return rewriteValueMIPS64_OpLsh32x32(v)
case OpLsh32x64:
return rewriteValueMIPS64_OpLsh32x64(v)
case OpLsh32x8:
return rewriteValueMIPS64_OpLsh32x8(v)
case OpLsh64x16:
return rewriteValueMIPS64_OpLsh64x16(v)
case OpLsh64x32:
return rewriteValueMIPS64_OpLsh64x32(v)
case OpLsh64x64:
return rewriteValueMIPS64_OpLsh64x64(v)
case OpLsh64x8:
return rewriteValueMIPS64_OpLsh64x8(v)
case OpLsh8x16:
return rewriteValueMIPS64_OpLsh8x16(v)
case OpLsh8x32:
return rewriteValueMIPS64_OpLsh8x32(v)
case OpLsh8x64:
return rewriteValueMIPS64_OpLsh8x64(v)
case OpLsh8x8:
return rewriteValueMIPS64_OpLsh8x8(v)
case OpMIPS64ADDV:
return rewriteValueMIPS64_OpMIPS64ADDV(v)
case OpMIPS64ADDVconst:
return rewriteValueMIPS64_OpMIPS64ADDVconst(v)
case OpMIPS64AND:
return rewriteValueMIPS64_OpMIPS64AND(v)
case OpMIPS64ANDconst:
return rewriteValueMIPS64_OpMIPS64ANDconst(v)
case OpMIPS64LoweredAtomicAdd32:
return rewriteValueMIPS64_OpMIPS64LoweredAtomicAdd32(v)
case OpMIPS64LoweredAtomicAdd64:
return rewriteValueMIPS64_OpMIPS64LoweredAtomicAdd64(v)
case OpMIPS64LoweredAtomicStore32:
return rewriteValueMIPS64_OpMIPS64LoweredAtomicStore32(v)
case OpMIPS64LoweredAtomicStore64:
return rewriteValueMIPS64_OpMIPS64LoweredAtomicStore64(v)
case OpMIPS64MOVBUload:
return rewriteValueMIPS64_OpMIPS64MOVBUload(v)
case OpMIPS64MOVBUreg:
return rewriteValueMIPS64_OpMIPS64MOVBUreg(v)
case OpMIPS64MOVBload:
return rewriteValueMIPS64_OpMIPS64MOVBload(v)
case OpMIPS64MOVBreg:
return rewriteValueMIPS64_OpMIPS64MOVBreg(v)
case OpMIPS64MOVBstore:
return rewriteValueMIPS64_OpMIPS64MOVBstore(v)
case OpMIPS64MOVBstorezero:
return rewriteValueMIPS64_OpMIPS64MOVBstorezero(v)
case OpMIPS64MOVDload:
return rewriteValueMIPS64_OpMIPS64MOVDload(v)
case OpMIPS64MOVDstore:
return rewriteValueMIPS64_OpMIPS64MOVDstore(v)
case OpMIPS64MOVFload:
return rewriteValueMIPS64_OpMIPS64MOVFload(v)
case OpMIPS64MOVFstore:
return rewriteValueMIPS64_OpMIPS64MOVFstore(v)
case OpMIPS64MOVHUload:
return rewriteValueMIPS64_OpMIPS64MOVHUload(v)
case OpMIPS64MOVHUreg:
return rewriteValueMIPS64_OpMIPS64MOVHUreg(v)
case OpMIPS64MOVHload:
return rewriteValueMIPS64_OpMIPS64MOVHload(v)
case OpMIPS64MOVHreg:
return rewriteValueMIPS64_OpMIPS64MOVHreg(v)
case OpMIPS64MOVHstore:
return rewriteValueMIPS64_OpMIPS64MOVHstore(v)
case OpMIPS64MOVHstorezero:
return rewriteValueMIPS64_OpMIPS64MOVHstorezero(v)
case OpMIPS64MOVVload:
return rewriteValueMIPS64_OpMIPS64MOVVload(v)
case OpMIPS64MOVVnop:
return rewriteValueMIPS64_OpMIPS64MOVVnop(v)
case OpMIPS64MOVVreg:
return rewriteValueMIPS64_OpMIPS64MOVVreg(v)
case OpMIPS64MOVVstore:
return rewriteValueMIPS64_OpMIPS64MOVVstore(v)
case OpMIPS64MOVVstorezero:
return rewriteValueMIPS64_OpMIPS64MOVVstorezero(v)
case OpMIPS64MOVWUload:
return rewriteValueMIPS64_OpMIPS64MOVWUload(v)
case OpMIPS64MOVWUreg:
return rewriteValueMIPS64_OpMIPS64MOVWUreg(v)
case OpMIPS64MOVWload:
return rewriteValueMIPS64_OpMIPS64MOVWload(v)
case OpMIPS64MOVWreg:
return rewriteValueMIPS64_OpMIPS64MOVWreg(v)
case OpMIPS64MOVWstore:
return rewriteValueMIPS64_OpMIPS64MOVWstore(v)
case OpMIPS64MOVWstorezero:
return rewriteValueMIPS64_OpMIPS64MOVWstorezero(v)
case OpMIPS64NEGV:
return rewriteValueMIPS64_OpMIPS64NEGV(v)
case OpMIPS64NOR:
return rewriteValueMIPS64_OpMIPS64NOR(v)
case OpMIPS64NORconst:
return rewriteValueMIPS64_OpMIPS64NORconst(v)
case OpMIPS64OR:
return rewriteValueMIPS64_OpMIPS64OR(v)
case OpMIPS64ORconst:
return rewriteValueMIPS64_OpMIPS64ORconst(v)
case OpMIPS64SGT:
return rewriteValueMIPS64_OpMIPS64SGT(v)
case OpMIPS64SGTU:
return rewriteValueMIPS64_OpMIPS64SGTU(v)
case OpMIPS64SGTUconst:
return rewriteValueMIPS64_OpMIPS64SGTUconst(v)
case OpMIPS64SGTconst:
return rewriteValueMIPS64_OpMIPS64SGTconst(v)
case OpMIPS64SLLV:
return rewriteValueMIPS64_OpMIPS64SLLV(v)
case OpMIPS64SLLVconst:
return rewriteValueMIPS64_OpMIPS64SLLVconst(v)
case OpMIPS64SRAV:
return rewriteValueMIPS64_OpMIPS64SRAV(v)
case OpMIPS64SRAVconst:
return rewriteValueMIPS64_OpMIPS64SRAVconst(v)
case OpMIPS64SRLV:
return rewriteValueMIPS64_OpMIPS64SRLV(v)
case OpMIPS64SRLVconst:
return rewriteValueMIPS64_OpMIPS64SRLVconst(v)
case OpMIPS64SUBV:
return rewriteValueMIPS64_OpMIPS64SUBV(v)
case OpMIPS64SUBVconst:
return rewriteValueMIPS64_OpMIPS64SUBVconst(v)
case OpMIPS64XOR:
return rewriteValueMIPS64_OpMIPS64XOR(v)
case OpMIPS64XORconst:
return rewriteValueMIPS64_OpMIPS64XORconst(v)
case OpMod16:
return rewriteValueMIPS64_OpMod16(v)
case OpMod16u:
return rewriteValueMIPS64_OpMod16u(v)
case OpMod32:
return rewriteValueMIPS64_OpMod32(v)
case OpMod32u:
return rewriteValueMIPS64_OpMod32u(v)
case OpMod64:
return rewriteValueMIPS64_OpMod64(v)
case OpMod64u:
return rewriteValueMIPS64_OpMod64u(v)
case OpMod8:
return rewriteValueMIPS64_OpMod8(v)
case OpMod8u:
return rewriteValueMIPS64_OpMod8u(v)
case OpMove:
return rewriteValueMIPS64_OpMove(v)
case OpMul16:
return rewriteValueMIPS64_OpMul16(v)
case OpMul32:
return rewriteValueMIPS64_OpMul32(v)
case OpMul32F:
v.Op = OpMIPS64MULF
return true
case OpMul64:
return rewriteValueMIPS64_OpMul64(v)
case OpMul64F:
v.Op = OpMIPS64MULD
return true
case OpMul64uhilo:
v.Op = OpMIPS64MULVU
return true
case OpMul8:
return rewriteValueMIPS64_OpMul8(v)
case OpNeg16:
v.Op = OpMIPS64NEGV
return true
case OpNeg32:
v.Op = OpMIPS64NEGV
return true
case OpNeg32F:
v.Op = OpMIPS64NEGF
return true
case OpNeg64:
v.Op = OpMIPS64NEGV
return true
case OpNeg64F:
v.Op = OpMIPS64NEGD
return true
case OpNeg8:
v.Op = OpMIPS64NEGV
return true
case OpNeq16:
return rewriteValueMIPS64_OpNeq16(v)
case OpNeq32:
return rewriteValueMIPS64_OpNeq32(v)
case OpNeq32F:
return rewriteValueMIPS64_OpNeq32F(v)
case OpNeq64:
return rewriteValueMIPS64_OpNeq64(v)
case OpNeq64F:
return rewriteValueMIPS64_OpNeq64F(v)
case OpNeq8:
return rewriteValueMIPS64_OpNeq8(v)
case OpNeqB:
v.Op = OpMIPS64XOR
return true
case OpNeqPtr:
return rewriteValueMIPS64_OpNeqPtr(v)
case OpNilCheck:
v.Op = OpMIPS64LoweredNilCheck
return true
case OpNot:
return rewriteValueMIPS64_OpNot(v)
case OpOffPtr:
return rewriteValueMIPS64_OpOffPtr(v)
case OpOr16:
v.Op = OpMIPS64OR
return true
case OpOr32:
v.Op = OpMIPS64OR
return true
case OpOr64:
v.Op = OpMIPS64OR
return true
case OpOr8:
v.Op = OpMIPS64OR
return true
case OpOrB:
v.Op = OpMIPS64OR
return true
case OpPanicBounds:
return rewriteValueMIPS64_OpPanicBounds(v)
case OpRotateLeft16:
return rewriteValueMIPS64_OpRotateLeft16(v)
case OpRotateLeft32:
return rewriteValueMIPS64_OpRotateLeft32(v)
case OpRotateLeft64:
return rewriteValueMIPS64_OpRotateLeft64(v)
case OpRotateLeft8:
return rewriteValueMIPS64_OpRotateLeft8(v)
case OpRound32F:
v.Op = OpCopy
return true
case OpRound64F:
v.Op = OpCopy
return true
case OpRsh16Ux16:
return rewriteValueMIPS64_OpRsh16Ux16(v)
case OpRsh16Ux32:
return rewriteValueMIPS64_OpRsh16Ux32(v)
case OpRsh16Ux64:
return rewriteValueMIPS64_OpRsh16Ux64(v)
case OpRsh16Ux8:
return rewriteValueMIPS64_OpRsh16Ux8(v)
case OpRsh16x16:
return rewriteValueMIPS64_OpRsh16x16(v)
case OpRsh16x32:
return rewriteValueMIPS64_OpRsh16x32(v)
case OpRsh16x64:
return rewriteValueMIPS64_OpRsh16x64(v)
case OpRsh16x8:
return rewriteValueMIPS64_OpRsh16x8(v)
case OpRsh32Ux16:
return rewriteValueMIPS64_OpRsh32Ux16(v)
case OpRsh32Ux32:
return rewriteValueMIPS64_OpRsh32Ux32(v)
case OpRsh32Ux64:
return rewriteValueMIPS64_OpRsh32Ux64(v)
case OpRsh32Ux8:
return rewriteValueMIPS64_OpRsh32Ux8(v)
case OpRsh32x16:
return rewriteValueMIPS64_OpRsh32x16(v)
case OpRsh32x32:
return rewriteValueMIPS64_OpRsh32x32(v)
case OpRsh32x64:
return rewriteValueMIPS64_OpRsh32x64(v)
case OpRsh32x8:
return rewriteValueMIPS64_OpRsh32x8(v)
case OpRsh64Ux16:
return rewriteValueMIPS64_OpRsh64Ux16(v)
case OpRsh64Ux32:
return rewriteValueMIPS64_OpRsh64Ux32(v)
case OpRsh64Ux64:
return rewriteValueMIPS64_OpRsh64Ux64(v)
case OpRsh64Ux8:
return rewriteValueMIPS64_OpRsh64Ux8(v)
case OpRsh64x16:
return rewriteValueMIPS64_OpRsh64x16(v)
case OpRsh64x32:
return rewriteValueMIPS64_OpRsh64x32(v)
case OpRsh64x64:
return rewriteValueMIPS64_OpRsh64x64(v)
case OpRsh64x8:
return rewriteValueMIPS64_OpRsh64x8(v)
case OpRsh8Ux16:
return rewriteValueMIPS64_OpRsh8Ux16(v)
case OpRsh8Ux32:
return rewriteValueMIPS64_OpRsh8Ux32(v)
case OpRsh8Ux64:
return rewriteValueMIPS64_OpRsh8Ux64(v)
case OpRsh8Ux8:
return rewriteValueMIPS64_OpRsh8Ux8(v)
case OpRsh8x16:
return rewriteValueMIPS64_OpRsh8x16(v)
case OpRsh8x32:
return rewriteValueMIPS64_OpRsh8x32(v)
case OpRsh8x64:
return rewriteValueMIPS64_OpRsh8x64(v)
case OpRsh8x8:
return rewriteValueMIPS64_OpRsh8x8(v)
case OpSelect0:
return rewriteValueMIPS64_OpSelect0(v)
case OpSelect1:
return rewriteValueMIPS64_OpSelect1(v)
case OpSignExt16to32:
v.Op = OpMIPS64MOVHreg
return true
case OpSignExt16to64:
v.Op = OpMIPS64MOVHreg
return true
case OpSignExt32to64:
v.Op = OpMIPS64MOVWreg
return true
case OpSignExt8to16:
v.Op = OpMIPS64MOVBreg
return true
case OpSignExt8to32:
v.Op = OpMIPS64MOVBreg
return true
case OpSignExt8to64:
v.Op = OpMIPS64MOVBreg
return true
case OpSlicemask:
return rewriteValueMIPS64_OpSlicemask(v)
case OpSqrt:
v.Op = OpMIPS64SQRTD
return true
case OpSqrt32:
v.Op = OpMIPS64SQRTF
return true
case OpStaticCall:
v.Op = OpMIPS64CALLstatic
return true
case OpStore:
return rewriteValueMIPS64_OpStore(v)
case OpSub16:
v.Op = OpMIPS64SUBV
return true
case OpSub32:
v.Op = OpMIPS64SUBV
return true
case OpSub32F:
v.Op = OpMIPS64SUBF
return true
case OpSub64:
v.Op = OpMIPS64SUBV
return true
case OpSub64F:
v.Op = OpMIPS64SUBD
return true
case OpSub8:
v.Op = OpMIPS64SUBV
return true
case OpSubPtr:
v.Op = OpMIPS64SUBV
return true
case OpTailCall:
v.Op = OpMIPS64CALLtail
return true
case OpTrunc16to8:
v.Op = OpCopy
return true
case OpTrunc32to16:
v.Op = OpCopy
return true
case OpTrunc32to8:
v.Op = OpCopy
return true
case OpTrunc64to16:
v.Op = OpCopy
return true
case OpTrunc64to32:
v.Op = OpCopy
return true
case OpTrunc64to8:
v.Op = OpCopy
return true
case OpWB:
v.Op = OpMIPS64LoweredWB
return true
case OpXor16:
v.Op = OpMIPS64XOR
return true
case OpXor32:
v.Op = OpMIPS64XOR
return true
case OpXor64:
v.Op = OpMIPS64XOR
return true
case OpXor8:
v.Op = OpMIPS64XOR
return true
case OpZero:
return rewriteValueMIPS64_OpZero(v)
case OpZeroExt16to32:
v.Op = OpMIPS64MOVHUreg
return true
case OpZeroExt16to64:
v.Op = OpMIPS64MOVHUreg
return true
case OpZeroExt32to64:
v.Op = OpMIPS64MOVWUreg
return true
case OpZeroExt8to16:
v.Op = OpMIPS64MOVBUreg
return true
case OpZeroExt8to32:
v.Op = OpMIPS64MOVBUreg
return true
case OpZeroExt8to64:
v.Op = OpMIPS64MOVBUreg
return true
}
return false
}
func rewriteValueMIPS64_OpAddr(v *Value) bool {
v_0 := v.Args[0]
// match: (Addr {sym} base)
// result: (MOVVaddr {sym} base)
for {
sym := auxToSym(v.Aux)
base := v_0
v.reset(OpMIPS64MOVVaddr)
v.Aux = symToAux(sym)
v.AddArg(base)
return true
}
}
func rewriteValueMIPS64_OpAtomicAnd8(v *Value) bool {
v_2 := v.Args[2]
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
config := b.Func.Config
typ := &b.Func.Config.Types
// match: (AtomicAnd8 ptr val mem)
// cond: !config.BigEndian
// result: (LoweredAtomicAnd32 (AND <typ.UInt32Ptr> (MOVVconst [^3]) ptr) (OR <typ.UInt64> (SLLV <typ.UInt32> (ZeroExt8to32 val) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] ptr))) (NORconst [0] <typ.UInt64> (SLLV <typ.UInt64> (MOVVconst [0xff]) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] ptr))))) mem)
for {
ptr := v_0
val := v_1
mem := v_2
if !(!config.BigEndian) {
break
}
v.reset(OpMIPS64LoweredAtomicAnd32)
v0 := b.NewValue0(v.Pos, OpMIPS64AND, typ.UInt32Ptr)
v1 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v1.AuxInt = int64ToAuxInt(^3)
v0.AddArg2(v1, ptr)
v2 := b.NewValue0(v.Pos, OpMIPS64OR, typ.UInt64)
v3 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt32)
v4 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
v4.AddArg(val)
v5 := b.NewValue0(v.Pos, OpMIPS64SLLVconst, typ.UInt64)
v5.AuxInt = int64ToAuxInt(3)
v6 := b.NewValue0(v.Pos, OpMIPS64ANDconst, typ.UInt64)
v6.AuxInt = int64ToAuxInt(3)
v6.AddArg(ptr)
v5.AddArg(v6)
v3.AddArg2(v4, v5)
v7 := b.NewValue0(v.Pos, OpMIPS64NORconst, typ.UInt64)
v7.AuxInt = int64ToAuxInt(0)
v8 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt64)
v9 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v9.AuxInt = int64ToAuxInt(0xff)
v8.AddArg2(v9, v5)
v7.AddArg(v8)
v2.AddArg2(v3, v7)
v.AddArg3(v0, v2, mem)
return true
}
// match: (AtomicAnd8 ptr val mem)
// cond: config.BigEndian
// result: (LoweredAtomicAnd32 (AND <typ.UInt32Ptr> (MOVVconst [^3]) ptr) (OR <typ.UInt64> (SLLV <typ.UInt32> (ZeroExt8to32 val) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] (XORconst <typ.UInt64> [3] ptr)))) (NORconst [0] <typ.UInt64> (SLLV <typ.UInt64> (MOVVconst [0xff]) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] (XORconst <typ.UInt64> [3] ptr)))))) mem)
for {
ptr := v_0
val := v_1
mem := v_2
if !(config.BigEndian) {
break
}
v.reset(OpMIPS64LoweredAtomicAnd32)
v0 := b.NewValue0(v.Pos, OpMIPS64AND, typ.UInt32Ptr)
v1 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v1.AuxInt = int64ToAuxInt(^3)
v0.AddArg2(v1, ptr)
v2 := b.NewValue0(v.Pos, OpMIPS64OR, typ.UInt64)
v3 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt32)
v4 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
v4.AddArg(val)
v5 := b.NewValue0(v.Pos, OpMIPS64SLLVconst, typ.UInt64)
v5.AuxInt = int64ToAuxInt(3)
v6 := b.NewValue0(v.Pos, OpMIPS64ANDconst, typ.UInt64)
v6.AuxInt = int64ToAuxInt(3)
v7 := b.NewValue0(v.Pos, OpMIPS64XORconst, typ.UInt64)
v7.AuxInt = int64ToAuxInt(3)
v7.AddArg(ptr)
v6.AddArg(v7)
v5.AddArg(v6)
v3.AddArg2(v4, v5)
v8 := b.NewValue0(v.Pos, OpMIPS64NORconst, typ.UInt64)
v8.AuxInt = int64ToAuxInt(0)
v9 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt64)
v10 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v10.AuxInt = int64ToAuxInt(0xff)
v9.AddArg2(v10, v5)
v8.AddArg(v9)
v2.AddArg2(v3, v8)
v.AddArg3(v0, v2, mem)
return true
}
return false
}
func rewriteValueMIPS64_OpAtomicCompareAndSwap32(v *Value) bool {
v_3 := v.Args[3]
v_2 := v.Args[2]
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (AtomicCompareAndSwap32 ptr old new mem)
// result: (LoweredAtomicCas32 ptr (SignExt32to64 old) new mem)
for {
ptr := v_0
old := v_1
new := v_2
mem := v_3
v.reset(OpMIPS64LoweredAtomicCas32)
v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
v0.AddArg(old)
v.AddArg4(ptr, v0, new, mem)
return true
}
}
func rewriteValueMIPS64_OpAtomicOr8(v *Value) bool {
v_2 := v.Args[2]
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
config := b.Func.Config
typ := &b.Func.Config.Types
// match: (AtomicOr8 ptr val mem)
// cond: !config.BigEndian
// result: (LoweredAtomicOr32 (AND <typ.UInt32Ptr> (MOVVconst [^3]) ptr) (SLLV <typ.UInt32> (ZeroExt8to32 val) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] ptr))) mem)
for {
ptr := v_0
val := v_1
mem := v_2
if !(!config.BigEndian) {
break
}
v.reset(OpMIPS64LoweredAtomicOr32)
v0 := b.NewValue0(v.Pos, OpMIPS64AND, typ.UInt32Ptr)
v1 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v1.AuxInt = int64ToAuxInt(^3)
v0.AddArg2(v1, ptr)
v2 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt32)
v3 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
v3.AddArg(val)
v4 := b.NewValue0(v.Pos, OpMIPS64SLLVconst, typ.UInt64)
v4.AuxInt = int64ToAuxInt(3)
v5 := b.NewValue0(v.Pos, OpMIPS64ANDconst, typ.UInt64)
v5.AuxInt = int64ToAuxInt(3)
v5.AddArg(ptr)
v4.AddArg(v5)
v2.AddArg2(v3, v4)
v.AddArg3(v0, v2, mem)
return true
}
// match: (AtomicOr8 ptr val mem)
// cond: config.BigEndian
// result: (LoweredAtomicOr32 (AND <typ.UInt32Ptr> (MOVVconst [^3]) ptr) (SLLV <typ.UInt32> (ZeroExt8to32 val) (SLLVconst <typ.UInt64> [3] (ANDconst <typ.UInt64> [3] (XORconst <typ.UInt64> [3] ptr)))) mem)
for {
ptr := v_0
val := v_1
mem := v_2
if !(config.BigEndian) {
break
}
v.reset(OpMIPS64LoweredAtomicOr32)
v0 := b.NewValue0(v.Pos, OpMIPS64AND, typ.UInt32Ptr)
v1 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v1.AuxInt = int64ToAuxInt(^3)
v0.AddArg2(v1, ptr)
v2 := b.NewValue0(v.Pos, OpMIPS64SLLV, typ.UInt32)
v3 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
v3.AddArg(val)
v4 := b.NewValue0(v.Pos, OpMIPS64SLLVconst, typ.UInt64)
v4.AuxInt = int64ToAuxInt(3)
v5 := b.NewValue0(v.Pos, OpMIPS64ANDconst, typ.UInt64)
v5.AuxInt = int64ToAuxInt(3)
v6 := b.NewValue0(v.Pos, OpMIPS64XORconst, typ.UInt64)
v6.AuxInt = int64ToAuxInt(3)
v6.AddArg(ptr)
v5.AddArg(v6)
v4.AddArg(v5)
v2.AddArg2(v3, v4)
v.AddArg3(v0, v2, mem)
return true
}
return false
}
func rewriteValueMIPS64_OpAvg64u(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
// match: (Avg64u <t> x y)
// result: (ADDV (SRLVconst <t> (SUBV <t> x y) [1]) y)
for {
t := v.Type
x := v_0
y := v_1
v.reset(OpMIPS64ADDV)
v0 := b.NewValue0(v.Pos, OpMIPS64SRLVconst, t)
v0.AuxInt = int64ToAuxInt(1)
v1 := b.NewValue0(v.Pos, OpMIPS64SUBV, t)
v1.AddArg2(x, y)
v0.AddArg(v1)
v.AddArg2(v0, y)
return true
}
}
func rewriteValueMIPS64_OpCom16(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com16 x)
// result: (NOR (MOVVconst [0]) x)
for {
x := v_0
v.reset(OpMIPS64NOR)
v0 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v0.AuxInt = int64ToAuxInt(0)
v.AddArg2(v0, x)
return true
}
}
func rewriteValueMIPS64_OpCom32(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com32 x)
// result: (NOR (MOVVconst [0]) x)
for {
x := v_0
v.reset(OpMIPS64NOR)
v0 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v0.AuxInt = int64ToAuxInt(0)
v.AddArg2(v0, x)
return true
}
}
func rewriteValueMIPS64_OpCom64(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com64 x)
// result: (NOR (MOVVconst [0]) x)
for {
x := v_0
v.reset(OpMIPS64NOR)
v0 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v0.AuxInt = int64ToAuxInt(0)
v.AddArg2(v0, x)
return true
}
}
func rewriteValueMIPS64_OpCom8(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com8 x)
// result: (NOR (MOVVconst [0]) x)
for {
x := v_0
v.reset(OpMIPS64NOR)
v0 := b.NewValue0(v.Pos, OpMIPS64MOVVconst, typ.UInt64)
v0.AuxInt = int64ToAuxInt(0)
v.AddArg2(v0, x)
return true
}
}
func rewriteValueMIPS64_OpConst16(v *Value) bool {
// match: (Const16 [val])
// result: (MOVVconst [int64(val)])
for {
val := auxIntToInt16(v.AuxInt)
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(int64(val))
return true
}
}
func rewriteValueMIPS64_OpConst32(v *Value) bool {
// match: (Const32 [val])
// result: (MOVVconst [int64(val)])
for {
val := auxIntToInt32(v.AuxInt)
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(int64(val))
return true
}
}
func rewriteValueMIPS64_OpConst32F(v *Value) bool {
// match: (Const32F [val])
// result: (MOVFconst [float64(val)])
for {
val := auxIntToFloat32(v.AuxInt)
v.reset(OpMIPS64MOVFconst)
v.AuxInt = float64ToAuxInt(float64(val))
return true
}
}
func rewriteValueMIPS64_OpConst64(v *Value) bool {
// match: (Const64 [val])
// result: (MOVVconst [int64(val)])
for {
val := auxIntToInt64(v.AuxInt)