@@ -416,8 +416,11 @@ var optab = []Optab{
416
416
417
417
{AVMOVQ , C_ELEM , C_NONE , C_NONE , C_ARNG , C_NONE , 45 , 4 , 0 , 0 },
418
418
419
- {APRELD , C_SOREG , C_U5CON , C_NONE , C_NONE , C_NONE , 46 , 4 , 0 , 0 },
420
- {APRELDX , C_SOREG , C_DCON , C_U5CON , C_NONE , C_NONE , 47 , 20 , 0 , 0 },
419
+ {AVMOVQ , C_SOREG , C_NONE , C_NONE , C_ARNG , C_NONE , 46 , 4 , 0 , 0 },
420
+ {AXVMOVQ , C_SOREG , C_NONE , C_NONE , C_ARNG , C_NONE , 46 , 4 , 0 , 0 },
421
+
422
+ {APRELD , C_SOREG , C_U5CON , C_NONE , C_NONE , C_NONE , 47 , 4 , 0 , 0 },
423
+ {APRELDX , C_SOREG , C_DCON , C_U5CON , C_NONE , C_NONE , 48 , 20 , 0 , 0 },
421
424
422
425
{obj .APCALIGN , C_U12CON , C_NONE , C_NONE , C_NONE , C_NONE , 0 , 0 , 0 , 0 },
423
426
{obj .APCDATA , C_32CON , C_NONE , C_NONE , C_32CON , C_NONE , 0 , 0 , 0 , 0 },
@@ -2395,7 +2398,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2395
2398
o1 = uint32 (c .regoff (& p .From ))
2396
2399
2397
2400
case 39 : // vmov Rn, Vd.<T>[index]
2398
- v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2401
+ v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2399
2402
if v == 0 {
2400
2403
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2401
2404
}
@@ -2407,7 +2410,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2407
2410
o1 = v | (index << 10 ) | (Rj << 5 ) | Vd
2408
2411
2409
2412
case 40 : // vmov Vd.<T>[index], Rn
2410
- v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2413
+ v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2411
2414
if v == 0 {
2412
2415
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2413
2416
}
@@ -2419,7 +2422,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2419
2422
o1 = v | (index << 10 ) | (Vj << 5 ) | Rd
2420
2423
2421
2424
case 41 : // vmov Rn, Vd.<T>
2422
- v , _ := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2425
+ v , _ := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2423
2426
if v == 0 {
2424
2427
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2425
2428
}
@@ -2429,7 +2432,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2429
2432
o1 = v | (Rj << 5 ) | Vd
2430
2433
2431
2434
case 42 : // vmov xj, xd.<T>
2432
- v , _ := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2435
+ v , _ := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2433
2436
if v == 0 {
2434
2437
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2435
2438
}
@@ -2439,7 +2442,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2439
2442
o1 = v | (Xj << 5 ) | Xd
2440
2443
2441
2444
case 43 : // vmov xj, xd.<T>[index]
2442
- v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2445
+ v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2443
2446
if v == 0 {
2444
2447
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2445
2448
}
@@ -2451,7 +2454,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2451
2454
o1 = v | (index << 10 ) | (Xj << 5 ) | Xd
2452
2455
2453
2456
case 44 : // vmov xj.<T>[index], xd
2454
- v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2457
+ v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2455
2458
if v == 0 {
2456
2459
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2457
2460
}
@@ -2463,7 +2466,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2463
2466
o1 = v | (index << 10 ) | (Xj << 5 ) | Xd
2464
2467
2465
2468
case 45 : // vmov vj.<T>[index], vd.<T>
2466
- v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg )
2469
+ v , m := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , false )
2467
2470
if v == 0 {
2468
2471
c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2469
2472
}
@@ -2474,12 +2477,23 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
2474
2477
c .checkindex (p , index , m )
2475
2478
o1 = v | (index << 10 ) | (vj << 5 ) | vd
2476
2479
2477
- case 46 : // preld offset(Rbase), $hint
2480
+ case 46 : // vmov offset(vj), vd.<T>
2481
+ v , _ := c .specialLsxMovInst (p .As , p .From .Reg , p .To .Reg , true )
2482
+ if v == 0 {
2483
+ c .ctxt .Diag ("illegal arng type combination: %v\n " , p )
2484
+ }
2485
+
2486
+ si := c .regoff (& p .From )
2487
+ Rj := uint32 (p .From .Reg & EXT_REG_MASK )
2488
+ Vd := uint32 (p .To .Reg & EXT_REG_MASK )
2489
+ o1 = v | uint32 (si << 10 ) | (Rj << 5 ) | Vd
2490
+
2491
+ case 47 : // preld offset(Rbase), $hint
2478
2492
offs := c .regoff (& p .From )
2479
2493
hint := p .GetFrom3 ().Offset
2480
2494
o1 = OP_12IR_5I (c .opiir (p .As ), uint32 (offs ), uint32 (p .From .Reg ), uint32 (hint ))
2481
2495
2482
- case 47 : // preldx offset(Rbase), $n, $hint
2496
+ case 48 : // preldx offset(Rbase), $n, $hint
2483
2497
offs := c .regoff (& p .From )
2484
2498
hint := p .RestArgs [1 ].Offset
2485
2499
n := uint64 (p .GetFrom3 ().Offset )
@@ -4192,7 +4206,7 @@ func (c *ctxt0) specialFpMovInst(a obj.As, fclass int, tclass int) uint32 {
4192
4206
return 0
4193
4207
}
4194
4208
4195
- func (c * ctxt0 ) specialLsxMovInst (a obj.As , fReg , tReg int16 ) (op_code , index_mask uint32 ) {
4209
+ func (c * ctxt0 ) specialLsxMovInst (a obj.As , fReg , tReg int16 , offset_flag bool ) (op_code , index_mask uint32 ) {
4196
4210
farng := (fReg >> EXT_TYPE_SHIFT ) & EXT_TYPE_MASK
4197
4211
tarng := (tReg >> EXT_TYPE_SHIFT ) & EXT_TYPE_MASK
4198
4212
fclass := c .rclass (fReg )
@@ -4258,29 +4272,58 @@ func (c *ctxt0) specialLsxMovInst(a obj.As, fReg, tReg int16) (op_code, index_ma
4258
4272
}
4259
4273
4260
4274
case C_REG | (C_ARNG << 16 ):
4261
- // vmov Rn, Vd.<T>
4262
- switch a {
4263
- case AVMOVQ :
4264
- switch tarng {
4265
- case ARNG_16B :
4266
- return (0x1CA7C0 << 10 ), 0x0 // vreplgr2vr.b
4267
- case ARNG_8H :
4268
- return (0x1CA7C1 << 10 ), 0x0 // vreplgr2vr.h
4269
- case ARNG_4W :
4270
- return (0x1CA7C2 << 10 ), 0x0 // vreplgr2vr.w
4271
- case ARNG_2V :
4272
- return (0x1CA7C3 << 10 ), 0x0 // vreplgr2vr.d
4275
+ switch {
4276
+ case offset_flag :
4277
+ // vmov offset(vj), vd.<T>
4278
+ switch a {
4279
+ case AVMOVQ :
4280
+ switch tarng {
4281
+ case ARNG_16B :
4282
+ return (0xC2 << 22 ), 0x0 // vldrepl.b
4283
+ case ARNG_8H :
4284
+ return (0x182 << 21 ), 0x0 // vldrepl.h
4285
+ case ARNG_4W :
4286
+ return (0x302 << 20 ), 0x0 // vldrepl.w
4287
+ case ARNG_2V :
4288
+ return (0x602 << 19 ), 0x0 // vldrepl.d
4289
+ }
4290
+ case AXVMOVQ :
4291
+ switch tarng {
4292
+ case ARNG_32B :
4293
+ return (0xCA << 22 ), 0x0 // xvldrepl.b
4294
+ case ARNG_16H :
4295
+ return (0x192 << 21 ), 0x0 // xvldrepl.h
4296
+ case ARNG_8W :
4297
+ return (0x322 << 20 ), 0x0 // xvldrepl.w
4298
+ case ARNG_4V :
4299
+ return (0x642 << 19 ), 0x0 // xvldrepl.d
4300
+ }
4273
4301
}
4274
- case AXVMOVQ :
4275
- switch tarng {
4276
- case ARNG_32B :
4277
- return (0x1DA7C0 << 10 ), 0x0 // xvreplgr2vr.b
4278
- case ARNG_16H :
4279
- return (0x1DA7C1 << 10 ), 0x0 // xvreplgr2vr.h
4280
- case ARNG_8W :
4281
- return (0x1DA7C2 << 10 ), 0x0 // xvreplgr2vr.w
4282
- case ARNG_4V :
4283
- return (0x1DA7C3 << 10 ), 0x0 // xvreplgr2vr.d
4302
+ default :
4303
+ // vmov Rn, Vd.<T>
4304
+ switch a {
4305
+ case AVMOVQ :
4306
+ switch tarng {
4307
+ case ARNG_16B :
4308
+ return (0x1CA7C0 << 10 ), 0x0 // vreplgr2vr.b
4309
+ case ARNG_8H :
4310
+ return (0x1CA7C1 << 10 ), 0x0 // vreplgr2vr.h
4311
+ case ARNG_4W :
4312
+ return (0x1CA7C2 << 10 ), 0x0 // vreplgr2vr.w
4313
+ case ARNG_2V :
4314
+ return (0x1CA7C3 << 10 ), 0x0 // vreplgr2vr.d
4315
+ }
4316
+ case AXVMOVQ :
4317
+ switch tarng {
4318
+ case ARNG_32B :
4319
+ return (0x1DA7C0 << 10 ), 0x0 // xvreplgr2vr.b
4320
+ case ARNG_16H :
4321
+ return (0x1DA7C1 << 10 ), 0x0 // xvreplgr2vr.h
4322
+ case ARNG_8W :
4323
+ return (0x1DA7C2 << 10 ), 0x0 // xvreplgr2vr.w
4324
+ case ARNG_4V :
4325
+ return (0x1DA7C3 << 10 ), 0x0 // xvreplgr2vr.d
4326
+ }
4284
4327
}
4285
4328
}
4286
4329
0 commit comments