-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrewriteWasm.go
4986 lines (4983 loc) · 112 KB
/
rewriteWasm.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/Wasm.rules using 'go generate'; DO NOT EDIT.
package ssa
import "internal/buildcfg"
import "math"
import "cmd/compile/internal/types"
func rewriteValueWasm(v *Value) bool {
switch v.Op {
case OpAbs:
v.Op = OpWasmF64Abs
return true
case OpAdd16:
v.Op = OpWasmI64Add
return true
case OpAdd32:
v.Op = OpWasmI64Add
return true
case OpAdd32F:
v.Op = OpWasmF32Add
return true
case OpAdd64:
v.Op = OpWasmI64Add
return true
case OpAdd64F:
v.Op = OpWasmF64Add
return true
case OpAdd8:
v.Op = OpWasmI64Add
return true
case OpAddPtr:
v.Op = OpWasmI64Add
return true
case OpAddr:
return rewriteValueWasm_OpAddr(v)
case OpAnd16:
v.Op = OpWasmI64And
return true
case OpAnd32:
v.Op = OpWasmI64And
return true
case OpAnd64:
v.Op = OpWasmI64And
return true
case OpAnd8:
v.Op = OpWasmI64And
return true
case OpAndB:
v.Op = OpWasmI64And
return true
case OpBitLen16:
return rewriteValueWasm_OpBitLen16(v)
case OpBitLen32:
return rewriteValueWasm_OpBitLen32(v)
case OpBitLen64:
return rewriteValueWasm_OpBitLen64(v)
case OpBitLen8:
return rewriteValueWasm_OpBitLen8(v)
case OpCeil:
v.Op = OpWasmF64Ceil
return true
case OpClosureCall:
v.Op = OpWasmLoweredClosureCall
return true
case OpCom16:
return rewriteValueWasm_OpCom16(v)
case OpCom32:
return rewriteValueWasm_OpCom32(v)
case OpCom64:
return rewriteValueWasm_OpCom64(v)
case OpCom8:
return rewriteValueWasm_OpCom8(v)
case OpCondSelect:
v.Op = OpWasmSelect
return true
case OpConst16:
return rewriteValueWasm_OpConst16(v)
case OpConst32:
return rewriteValueWasm_OpConst32(v)
case OpConst32F:
v.Op = OpWasmF32Const
return true
case OpConst64:
v.Op = OpWasmI64Const
return true
case OpConst64F:
v.Op = OpWasmF64Const
return true
case OpConst8:
return rewriteValueWasm_OpConst8(v)
case OpConstBool:
return rewriteValueWasm_OpConstBool(v)
case OpConstNil:
return rewriteValueWasm_OpConstNil(v)
case OpConvert:
v.Op = OpWasmLoweredConvert
return true
case OpCopysign:
v.Op = OpWasmF64Copysign
return true
case OpCtz16:
return rewriteValueWasm_OpCtz16(v)
case OpCtz16NonZero:
v.Op = OpWasmI64Ctz
return true
case OpCtz32:
return rewriteValueWasm_OpCtz32(v)
case OpCtz32NonZero:
v.Op = OpWasmI64Ctz
return true
case OpCtz64:
v.Op = OpWasmI64Ctz
return true
case OpCtz64NonZero:
v.Op = OpWasmI64Ctz
return true
case OpCtz8:
return rewriteValueWasm_OpCtz8(v)
case OpCtz8NonZero:
v.Op = OpWasmI64Ctz
return true
case OpCvt32Fto32:
v.Op = OpWasmI64TruncSatF32S
return true
case OpCvt32Fto32U:
v.Op = OpWasmI64TruncSatF32U
return true
case OpCvt32Fto64:
v.Op = OpWasmI64TruncSatF32S
return true
case OpCvt32Fto64F:
v.Op = OpWasmF64PromoteF32
return true
case OpCvt32Fto64U:
v.Op = OpWasmI64TruncSatF32U
return true
case OpCvt32Uto32F:
return rewriteValueWasm_OpCvt32Uto32F(v)
case OpCvt32Uto64F:
return rewriteValueWasm_OpCvt32Uto64F(v)
case OpCvt32to32F:
return rewriteValueWasm_OpCvt32to32F(v)
case OpCvt32to64F:
return rewriteValueWasm_OpCvt32to64F(v)
case OpCvt64Fto32:
v.Op = OpWasmI64TruncSatF64S
return true
case OpCvt64Fto32F:
v.Op = OpWasmF32DemoteF64
return true
case OpCvt64Fto32U:
v.Op = OpWasmI64TruncSatF64U
return true
case OpCvt64Fto64:
v.Op = OpWasmI64TruncSatF64S
return true
case OpCvt64Fto64U:
v.Op = OpWasmI64TruncSatF64U
return true
case OpCvt64Uto32F:
v.Op = OpWasmF32ConvertI64U
return true
case OpCvt64Uto64F:
v.Op = OpWasmF64ConvertI64U
return true
case OpCvt64to32F:
v.Op = OpWasmF32ConvertI64S
return true
case OpCvt64to64F:
v.Op = OpWasmF64ConvertI64S
return true
case OpCvtBoolToUint8:
v.Op = OpCopy
return true
case OpDiv16:
return rewriteValueWasm_OpDiv16(v)
case OpDiv16u:
return rewriteValueWasm_OpDiv16u(v)
case OpDiv32:
return rewriteValueWasm_OpDiv32(v)
case OpDiv32F:
v.Op = OpWasmF32Div
return true
case OpDiv32u:
return rewriteValueWasm_OpDiv32u(v)
case OpDiv64:
return rewriteValueWasm_OpDiv64(v)
case OpDiv64F:
v.Op = OpWasmF64Div
return true
case OpDiv64u:
v.Op = OpWasmI64DivU
return true
case OpDiv8:
return rewriteValueWasm_OpDiv8(v)
case OpDiv8u:
return rewriteValueWasm_OpDiv8u(v)
case OpEq16:
return rewriteValueWasm_OpEq16(v)
case OpEq32:
return rewriteValueWasm_OpEq32(v)
case OpEq32F:
v.Op = OpWasmF32Eq
return true
case OpEq64:
v.Op = OpWasmI64Eq
return true
case OpEq64F:
v.Op = OpWasmF64Eq
return true
case OpEq8:
return rewriteValueWasm_OpEq8(v)
case OpEqB:
v.Op = OpWasmI64Eq
return true
case OpEqPtr:
v.Op = OpWasmI64Eq
return true
case OpFloor:
v.Op = OpWasmF64Floor
return true
case OpGetCallerPC:
v.Op = OpWasmLoweredGetCallerPC
return true
case OpGetCallerSP:
v.Op = OpWasmLoweredGetCallerSP
return true
case OpGetClosurePtr:
v.Op = OpWasmLoweredGetClosurePtr
return true
case OpInterCall:
v.Op = OpWasmLoweredInterCall
return true
case OpIsInBounds:
v.Op = OpWasmI64LtU
return true
case OpIsNonNil:
return rewriteValueWasm_OpIsNonNil(v)
case OpIsSliceInBounds:
v.Op = OpWasmI64LeU
return true
case OpLeq16:
return rewriteValueWasm_OpLeq16(v)
case OpLeq16U:
return rewriteValueWasm_OpLeq16U(v)
case OpLeq32:
return rewriteValueWasm_OpLeq32(v)
case OpLeq32F:
v.Op = OpWasmF32Le
return true
case OpLeq32U:
return rewriteValueWasm_OpLeq32U(v)
case OpLeq64:
v.Op = OpWasmI64LeS
return true
case OpLeq64F:
v.Op = OpWasmF64Le
return true
case OpLeq64U:
v.Op = OpWasmI64LeU
return true
case OpLeq8:
return rewriteValueWasm_OpLeq8(v)
case OpLeq8U:
return rewriteValueWasm_OpLeq8U(v)
case OpLess16:
return rewriteValueWasm_OpLess16(v)
case OpLess16U:
return rewriteValueWasm_OpLess16U(v)
case OpLess32:
return rewriteValueWasm_OpLess32(v)
case OpLess32F:
v.Op = OpWasmF32Lt
return true
case OpLess32U:
return rewriteValueWasm_OpLess32U(v)
case OpLess64:
v.Op = OpWasmI64LtS
return true
case OpLess64F:
v.Op = OpWasmF64Lt
return true
case OpLess64U:
v.Op = OpWasmI64LtU
return true
case OpLess8:
return rewriteValueWasm_OpLess8(v)
case OpLess8U:
return rewriteValueWasm_OpLess8U(v)
case OpLoad:
return rewriteValueWasm_OpLoad(v)
case OpLocalAddr:
return rewriteValueWasm_OpLocalAddr(v)
case OpLsh16x16:
return rewriteValueWasm_OpLsh16x16(v)
case OpLsh16x32:
return rewriteValueWasm_OpLsh16x32(v)
case OpLsh16x64:
v.Op = OpLsh64x64
return true
case OpLsh16x8:
return rewriteValueWasm_OpLsh16x8(v)
case OpLsh32x16:
return rewriteValueWasm_OpLsh32x16(v)
case OpLsh32x32:
return rewriteValueWasm_OpLsh32x32(v)
case OpLsh32x64:
v.Op = OpLsh64x64
return true
case OpLsh32x8:
return rewriteValueWasm_OpLsh32x8(v)
case OpLsh64x16:
return rewriteValueWasm_OpLsh64x16(v)
case OpLsh64x32:
return rewriteValueWasm_OpLsh64x32(v)
case OpLsh64x64:
return rewriteValueWasm_OpLsh64x64(v)
case OpLsh64x8:
return rewriteValueWasm_OpLsh64x8(v)
case OpLsh8x16:
return rewriteValueWasm_OpLsh8x16(v)
case OpLsh8x32:
return rewriteValueWasm_OpLsh8x32(v)
case OpLsh8x64:
v.Op = OpLsh64x64
return true
case OpLsh8x8:
return rewriteValueWasm_OpLsh8x8(v)
case OpMod16:
return rewriteValueWasm_OpMod16(v)
case OpMod16u:
return rewriteValueWasm_OpMod16u(v)
case OpMod32:
return rewriteValueWasm_OpMod32(v)
case OpMod32u:
return rewriteValueWasm_OpMod32u(v)
case OpMod64:
return rewriteValueWasm_OpMod64(v)
case OpMod64u:
v.Op = OpWasmI64RemU
return true
case OpMod8:
return rewriteValueWasm_OpMod8(v)
case OpMod8u:
return rewriteValueWasm_OpMod8u(v)
case OpMove:
return rewriteValueWasm_OpMove(v)
case OpMul16:
v.Op = OpWasmI64Mul
return true
case OpMul32:
v.Op = OpWasmI64Mul
return true
case OpMul32F:
v.Op = OpWasmF32Mul
return true
case OpMul64:
v.Op = OpWasmI64Mul
return true
case OpMul64F:
v.Op = OpWasmF64Mul
return true
case OpMul8:
v.Op = OpWasmI64Mul
return true
case OpNeg16:
return rewriteValueWasm_OpNeg16(v)
case OpNeg32:
return rewriteValueWasm_OpNeg32(v)
case OpNeg32F:
v.Op = OpWasmF32Neg
return true
case OpNeg64:
return rewriteValueWasm_OpNeg64(v)
case OpNeg64F:
v.Op = OpWasmF64Neg
return true
case OpNeg8:
return rewriteValueWasm_OpNeg8(v)
case OpNeq16:
return rewriteValueWasm_OpNeq16(v)
case OpNeq32:
return rewriteValueWasm_OpNeq32(v)
case OpNeq32F:
v.Op = OpWasmF32Ne
return true
case OpNeq64:
v.Op = OpWasmI64Ne
return true
case OpNeq64F:
v.Op = OpWasmF64Ne
return true
case OpNeq8:
return rewriteValueWasm_OpNeq8(v)
case OpNeqB:
v.Op = OpWasmI64Ne
return true
case OpNeqPtr:
v.Op = OpWasmI64Ne
return true
case OpNilCheck:
v.Op = OpWasmLoweredNilCheck
return true
case OpNot:
v.Op = OpWasmI64Eqz
return true
case OpOffPtr:
v.Op = OpWasmI64AddConst
return true
case OpOr16:
v.Op = OpWasmI64Or
return true
case OpOr32:
v.Op = OpWasmI64Or
return true
case OpOr64:
v.Op = OpWasmI64Or
return true
case OpOr8:
v.Op = OpWasmI64Or
return true
case OpOrB:
v.Op = OpWasmI64Or
return true
case OpPopCount16:
return rewriteValueWasm_OpPopCount16(v)
case OpPopCount32:
return rewriteValueWasm_OpPopCount32(v)
case OpPopCount64:
v.Op = OpWasmI64Popcnt
return true
case OpPopCount8:
return rewriteValueWasm_OpPopCount8(v)
case OpRotateLeft16:
return rewriteValueWasm_OpRotateLeft16(v)
case OpRotateLeft32:
v.Op = OpWasmI32Rotl
return true
case OpRotateLeft64:
v.Op = OpWasmI64Rotl
return true
case OpRotateLeft8:
return rewriteValueWasm_OpRotateLeft8(v)
case OpRound32F:
v.Op = OpCopy
return true
case OpRound64F:
v.Op = OpCopy
return true
case OpRoundToEven:
v.Op = OpWasmF64Nearest
return true
case OpRsh16Ux16:
return rewriteValueWasm_OpRsh16Ux16(v)
case OpRsh16Ux32:
return rewriteValueWasm_OpRsh16Ux32(v)
case OpRsh16Ux64:
return rewriteValueWasm_OpRsh16Ux64(v)
case OpRsh16Ux8:
return rewriteValueWasm_OpRsh16Ux8(v)
case OpRsh16x16:
return rewriteValueWasm_OpRsh16x16(v)
case OpRsh16x32:
return rewriteValueWasm_OpRsh16x32(v)
case OpRsh16x64:
return rewriteValueWasm_OpRsh16x64(v)
case OpRsh16x8:
return rewriteValueWasm_OpRsh16x8(v)
case OpRsh32Ux16:
return rewriteValueWasm_OpRsh32Ux16(v)
case OpRsh32Ux32:
return rewriteValueWasm_OpRsh32Ux32(v)
case OpRsh32Ux64:
return rewriteValueWasm_OpRsh32Ux64(v)
case OpRsh32Ux8:
return rewriteValueWasm_OpRsh32Ux8(v)
case OpRsh32x16:
return rewriteValueWasm_OpRsh32x16(v)
case OpRsh32x32:
return rewriteValueWasm_OpRsh32x32(v)
case OpRsh32x64:
return rewriteValueWasm_OpRsh32x64(v)
case OpRsh32x8:
return rewriteValueWasm_OpRsh32x8(v)
case OpRsh64Ux16:
return rewriteValueWasm_OpRsh64Ux16(v)
case OpRsh64Ux32:
return rewriteValueWasm_OpRsh64Ux32(v)
case OpRsh64Ux64:
return rewriteValueWasm_OpRsh64Ux64(v)
case OpRsh64Ux8:
return rewriteValueWasm_OpRsh64Ux8(v)
case OpRsh64x16:
return rewriteValueWasm_OpRsh64x16(v)
case OpRsh64x32:
return rewriteValueWasm_OpRsh64x32(v)
case OpRsh64x64:
return rewriteValueWasm_OpRsh64x64(v)
case OpRsh64x8:
return rewriteValueWasm_OpRsh64x8(v)
case OpRsh8Ux16:
return rewriteValueWasm_OpRsh8Ux16(v)
case OpRsh8Ux32:
return rewriteValueWasm_OpRsh8Ux32(v)
case OpRsh8Ux64:
return rewriteValueWasm_OpRsh8Ux64(v)
case OpRsh8Ux8:
return rewriteValueWasm_OpRsh8Ux8(v)
case OpRsh8x16:
return rewriteValueWasm_OpRsh8x16(v)
case OpRsh8x32:
return rewriteValueWasm_OpRsh8x32(v)
case OpRsh8x64:
return rewriteValueWasm_OpRsh8x64(v)
case OpRsh8x8:
return rewriteValueWasm_OpRsh8x8(v)
case OpSignExt16to32:
return rewriteValueWasm_OpSignExt16to32(v)
case OpSignExt16to64:
return rewriteValueWasm_OpSignExt16to64(v)
case OpSignExt32to64:
return rewriteValueWasm_OpSignExt32to64(v)
case OpSignExt8to16:
return rewriteValueWasm_OpSignExt8to16(v)
case OpSignExt8to32:
return rewriteValueWasm_OpSignExt8to32(v)
case OpSignExt8to64:
return rewriteValueWasm_OpSignExt8to64(v)
case OpSlicemask:
return rewriteValueWasm_OpSlicemask(v)
case OpSqrt:
v.Op = OpWasmF64Sqrt
return true
case OpSqrt32:
v.Op = OpWasmF32Sqrt
return true
case OpStaticCall:
v.Op = OpWasmLoweredStaticCall
return true
case OpStore:
return rewriteValueWasm_OpStore(v)
case OpSub16:
v.Op = OpWasmI64Sub
return true
case OpSub32:
v.Op = OpWasmI64Sub
return true
case OpSub32F:
v.Op = OpWasmF32Sub
return true
case OpSub64:
v.Op = OpWasmI64Sub
return true
case OpSub64F:
v.Op = OpWasmF64Sub
return true
case OpSub8:
v.Op = OpWasmI64Sub
return true
case OpSubPtr:
v.Op = OpWasmI64Sub
return true
case OpTailCall:
v.Op = OpWasmLoweredTailCall
return true
case OpTrunc:
v.Op = OpWasmF64Trunc
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 = OpWasmLoweredWB
return true
case OpWasmF64Add:
return rewriteValueWasm_OpWasmF64Add(v)
case OpWasmF64Mul:
return rewriteValueWasm_OpWasmF64Mul(v)
case OpWasmI64Add:
return rewriteValueWasm_OpWasmI64Add(v)
case OpWasmI64AddConst:
return rewriteValueWasm_OpWasmI64AddConst(v)
case OpWasmI64And:
return rewriteValueWasm_OpWasmI64And(v)
case OpWasmI64Eq:
return rewriteValueWasm_OpWasmI64Eq(v)
case OpWasmI64Eqz:
return rewriteValueWasm_OpWasmI64Eqz(v)
case OpWasmI64LeU:
return rewriteValueWasm_OpWasmI64LeU(v)
case OpWasmI64Load:
return rewriteValueWasm_OpWasmI64Load(v)
case OpWasmI64Load16S:
return rewriteValueWasm_OpWasmI64Load16S(v)
case OpWasmI64Load16U:
return rewriteValueWasm_OpWasmI64Load16U(v)
case OpWasmI64Load32S:
return rewriteValueWasm_OpWasmI64Load32S(v)
case OpWasmI64Load32U:
return rewriteValueWasm_OpWasmI64Load32U(v)
case OpWasmI64Load8S:
return rewriteValueWasm_OpWasmI64Load8S(v)
case OpWasmI64Load8U:
return rewriteValueWasm_OpWasmI64Load8U(v)
case OpWasmI64LtU:
return rewriteValueWasm_OpWasmI64LtU(v)
case OpWasmI64Mul:
return rewriteValueWasm_OpWasmI64Mul(v)
case OpWasmI64Ne:
return rewriteValueWasm_OpWasmI64Ne(v)
case OpWasmI64Or:
return rewriteValueWasm_OpWasmI64Or(v)
case OpWasmI64Shl:
return rewriteValueWasm_OpWasmI64Shl(v)
case OpWasmI64ShrS:
return rewriteValueWasm_OpWasmI64ShrS(v)
case OpWasmI64ShrU:
return rewriteValueWasm_OpWasmI64ShrU(v)
case OpWasmI64Store:
return rewriteValueWasm_OpWasmI64Store(v)
case OpWasmI64Store16:
return rewriteValueWasm_OpWasmI64Store16(v)
case OpWasmI64Store32:
return rewriteValueWasm_OpWasmI64Store32(v)
case OpWasmI64Store8:
return rewriteValueWasm_OpWasmI64Store8(v)
case OpWasmI64Xor:
return rewriteValueWasm_OpWasmI64Xor(v)
case OpXor16:
v.Op = OpWasmI64Xor
return true
case OpXor32:
v.Op = OpWasmI64Xor
return true
case OpXor64:
v.Op = OpWasmI64Xor
return true
case OpXor8:
v.Op = OpWasmI64Xor
return true
case OpZero:
return rewriteValueWasm_OpZero(v)
case OpZeroExt16to32:
return rewriteValueWasm_OpZeroExt16to32(v)
case OpZeroExt16to64:
return rewriteValueWasm_OpZeroExt16to64(v)
case OpZeroExt32to64:
return rewriteValueWasm_OpZeroExt32to64(v)
case OpZeroExt8to16:
return rewriteValueWasm_OpZeroExt8to16(v)
case OpZeroExt8to32:
return rewriteValueWasm_OpZeroExt8to32(v)
case OpZeroExt8to64:
return rewriteValueWasm_OpZeroExt8to64(v)
}
return false
}
func rewriteValueWasm_OpAddr(v *Value) bool {
v_0 := v.Args[0]
// match: (Addr {sym} base)
// result: (LoweredAddr {sym} [0] base)
for {
sym := auxToSym(v.Aux)
base := v_0
v.reset(OpWasmLoweredAddr)
v.AuxInt = int32ToAuxInt(0)
v.Aux = symToAux(sym)
v.AddArg(base)
return true
}
}
func rewriteValueWasm_OpBitLen16(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (BitLen16 x)
// result: (BitLen64 (ZeroExt16to64 x))
for {
x := v_0
v.reset(OpBitLen64)
v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpBitLen32(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (BitLen32 x)
// result: (BitLen64 (ZeroExt32to64 x))
for {
x := v_0
v.reset(OpBitLen64)
v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpBitLen64(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (BitLen64 x)
// result: (I64Sub (I64Const [64]) (I64Clz x))
for {
x := v_0
v.reset(OpWasmI64Sub)
v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v0.AuxInt = int64ToAuxInt(64)
v1 := b.NewValue0(v.Pos, OpWasmI64Clz, typ.Int64)
v1.AddArg(x)
v.AddArg2(v0, v1)
return true
}
}
func rewriteValueWasm_OpBitLen8(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (BitLen8 x)
// result: (BitLen64 (ZeroExt8to64 x))
for {
x := v_0
v.reset(OpBitLen64)
v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCom16(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com16 x)
// result: (I64Xor x (I64Const [-1]))
for {
x := v_0
v.reset(OpWasmI64Xor)
v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v0.AuxInt = int64ToAuxInt(-1)
v.AddArg2(x, v0)
return true
}
}
func rewriteValueWasm_OpCom32(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com32 x)
// result: (I64Xor x (I64Const [-1]))
for {
x := v_0
v.reset(OpWasmI64Xor)
v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v0.AuxInt = int64ToAuxInt(-1)
v.AddArg2(x, v0)
return true
}
}
func rewriteValueWasm_OpCom64(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com64 x)
// result: (I64Xor x (I64Const [-1]))
for {
x := v_0
v.reset(OpWasmI64Xor)
v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v0.AuxInt = int64ToAuxInt(-1)
v.AddArg2(x, v0)
return true
}
}
func rewriteValueWasm_OpCom8(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Com8 x)
// result: (I64Xor x (I64Const [-1]))
for {
x := v_0
v.reset(OpWasmI64Xor)
v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v0.AuxInt = int64ToAuxInt(-1)
v.AddArg2(x, v0)
return true
}
}
func rewriteValueWasm_OpConst16(v *Value) bool {
// match: (Const16 [c])
// result: (I64Const [int64(c)])
for {
c := auxIntToInt16(v.AuxInt)
v.reset(OpWasmI64Const)
v.AuxInt = int64ToAuxInt(int64(c))
return true
}
}
func rewriteValueWasm_OpConst32(v *Value) bool {
// match: (Const32 [c])
// result: (I64Const [int64(c)])
for {
c := auxIntToInt32(v.AuxInt)
v.reset(OpWasmI64Const)
v.AuxInt = int64ToAuxInt(int64(c))
return true
}
}
func rewriteValueWasm_OpConst8(v *Value) bool {
// match: (Const8 [c])
// result: (I64Const [int64(c)])
for {
c := auxIntToInt8(v.AuxInt)
v.reset(OpWasmI64Const)
v.AuxInt = int64ToAuxInt(int64(c))
return true
}
}
func rewriteValueWasm_OpConstBool(v *Value) bool {
// match: (ConstBool [c])
// result: (I64Const [b2i(c)])
for {
c := auxIntToBool(v.AuxInt)
v.reset(OpWasmI64Const)
v.AuxInt = int64ToAuxInt(b2i(c))
return true
}
}
func rewriteValueWasm_OpConstNil(v *Value) bool {
// match: (ConstNil)
// result: (I64Const [0])
for {
v.reset(OpWasmI64Const)
v.AuxInt = int64ToAuxInt(0)
return true
}
}
func rewriteValueWasm_OpCtz16(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Ctz16 x)
// result: (I64Ctz (I64Or x (I64Const [0x10000])))
for {
x := v_0
v.reset(OpWasmI64Ctz)
v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64)
v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v1.AuxInt = int64ToAuxInt(0x10000)
v0.AddArg2(x, v1)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCtz32(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Ctz32 x)
// result: (I64Ctz (I64Or x (I64Const [0x100000000])))
for {
x := v_0
v.reset(OpWasmI64Ctz)
v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64)
v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v1.AuxInt = int64ToAuxInt(0x100000000)
v0.AddArg2(x, v1)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCtz8(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Ctz8 x)
// result: (I64Ctz (I64Or x (I64Const [0x100])))
for {
x := v_0
v.reset(OpWasmI64Ctz)
v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64)
v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64)
v1.AuxInt = int64ToAuxInt(0x100)
v0.AddArg2(x, v1)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCvt32Uto32F(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Cvt32Uto32F x)
// result: (F32ConvertI64U (ZeroExt32to64 x))
for {
x := v_0
v.reset(OpWasmF32ConvertI64U)
v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCvt32Uto64F(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Cvt32Uto64F x)
// result: (F64ConvertI64U (ZeroExt32to64 x))
for {
x := v_0
v.reset(OpWasmF64ConvertI64U)
v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCvt32to32F(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Cvt32to32F x)
// result: (F32ConvertI64S (SignExt32to64 x))
for {
x := v_0
v.reset(OpWasmF32ConvertI64S)
v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpCvt32to64F(v *Value) bool {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Cvt32to64F x)
// result: (F64ConvertI64S (SignExt32to64 x))
for {
x := v_0
v.reset(OpWasmF64ConvertI64S)
v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
v0.AddArg(x)
v.AddArg(v0)
return true
}
}
func rewriteValueWasm_OpDiv16(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Div16 [false] x y)
// result: (I64DivS (SignExt16to64 x) (SignExt16to64 y))
for {
if auxIntToBool(v.AuxInt) != false {
break
}
x := v_0
y := v_1
v.reset(OpWasmI64DivS)
v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
v0.AddArg(x)
v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
v1.AddArg(y)
v.AddArg2(v0, v1)
return true
}
return false
}
func rewriteValueWasm_OpDiv16u(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
// match: (Div16u x y)
// result: (I64DivU (ZeroExt16to64 x) (ZeroExt16to64 y))
for {