@@ -2497,22 +2497,22 @@ static bool DisassembleNLdSt(MCInst &MI, unsigned Opcode, uint32_t insn,
2497
2497
// 0 represents standard alignment, i.e., unaligned data access.
2498
2498
unsigned alignment = 0 ;
2499
2499
2500
- if (Name. find ( " LN " ) != std::string::npos) {
2501
- // To one lane instructions.
2502
- // See, for example, 8.6.317 VLD4 (single 4-element structure to one lane).
2500
+ unsigned elem = 0 ; // legal values: {1, 2, 3, 4}
2501
+ if (Name. startswith ( " VST1 " ) || Name. startswith ( " VLD1 " ))
2502
+ elem = 1 ;
2503
2503
2504
- unsigned elem = 0 ; // legal values: {1, 2, 3, 4}
2505
- if (Name.startswith (" VST1" ) || Name.startswith (" VLD1" ))
2506
- elem = 1 ;
2504
+ if (Name.startswith (" VST2" ) || Name.startswith (" VLD2" ))
2505
+ elem = 2 ;
2507
2506
2508
- if (Name.startswith (" VST2 " ) || Name.startswith (" VLD2 " ))
2509
- elem = 2 ;
2507
+ if (Name.startswith (" VST3 " ) || Name.startswith (" VLD3 " ))
2508
+ elem = 3 ;
2510
2509
2511
- if (Name.startswith (" VST3 " ) || Name.startswith (" VLD3 " ))
2512
- elem = 3 ;
2510
+ if (Name.startswith (" VST4 " ) || Name.startswith (" VLD4 " ))
2511
+ elem = 4 ;
2513
2512
2514
- if (Name.startswith (" VST4" ) || Name.startswith (" VLD4" ))
2515
- elem = 4 ;
2513
+ if (Name.find (" LN" ) != std::string::npos) {
2514
+ // To one lane instructions.
2515
+ // See, for example, 8.6.317 VLD4 (single 4-element structure to one lane).
2516
2516
2517
2517
// Utility function takes number of elements, size, and index_align.
2518
2518
if (!Align4OneLaneInst (elem,
@@ -2533,7 +2533,8 @@ static bool DisassembleNLdSt(MCInst &MI, unsigned Opcode, uint32_t insn,
2533
2533
// See, for example, A8.6.316 VLD4 (multiple 4-element structures).
2534
2534
2535
2535
// Inst{5-4} encodes alignment.
2536
- switch (slice (insn, 5 , 4 )) {
2536
+ unsigned align = slice (insn, 5 , 4 );
2537
+ switch (align) {
2537
2538
default :
2538
2539
break ;
2539
2540
case 1 :
@@ -2544,22 +2545,42 @@ static bool DisassembleNLdSt(MCInst &MI, unsigned Opcode, uint32_t insn,
2544
2545
alignment = 256 ; break ;
2545
2546
}
2546
2547
2547
- // n == 2 && type == 0b1001 -> DblSpaced = true
2548
- if (Name.startswith (" VST2" ) || Name.startswith (" VLD2" ))
2549
- DblSpaced = slice (insn, 11 , 8 ) == 9 ;
2550
-
2551
- // n == 3 && type == 0b0101 -> DblSpaced = true
2552
- if (Name.startswith (" VST3" ) || Name.startswith (" VLD3" )) {
2548
+ unsigned type = slice (insn, 11 , 8 );
2549
+ // Reject UNDEFINED instructions based on type and align.
2550
+ // Plus set DblSpaced flag where appropriate.
2551
+ switch (elem) {
2552
+ default :
2553
+ break ;
2554
+ case 1 :
2555
+ // n == 1
2556
+ // A8.6.307 & A8.6.391
2557
+ if ((type == 7 && slice (align, 1 , 1 ) == 1 ) ||
2558
+ (type == 10 && align == 3 ) ||
2559
+ (type == 6 && slice (align, 1 , 1 ) == 1 ))
2560
+ return false ;
2561
+ break ;
2562
+ case 2 :
2563
+ // n == 2 && type == 0b1001 -> DblSpaced = true
2564
+ // A8.6.310 & A8.6.393
2565
+ if ((type == 8 || type == 9 ) && align == 3 )
2566
+ return false ;
2567
+ DblSpaced = (type == 9 );
2568
+ break ;
2569
+ case 3 :
2570
+ // n == 3 && type == 0b0101 -> DblSpaced = true
2553
2571
// A8.6.313 & A8.6.395
2554
- if (slice (insn, 7 , 6 ) == 3 && slice (insn, 5 , 5 ) == 1 )
2572
+ if (slice (insn, 7 , 6 ) == 3 || slice (align, 1 , 1 ) == 1 )
2555
2573
return false ;
2556
-
2557
- DblSpaced = slice (insn, 11 , 8 ) == 5 ;
2574
+ DblSpaced = (type == 5 );
2575
+ break ;
2576
+ case 4 :
2577
+ // n == 4 && type == 0b0001 -> DblSpaced = true
2578
+ // A8.6.316 & A8.6.397
2579
+ if (slice (insn, 7 , 6 ) == 3 )
2580
+ return false ;
2581
+ DblSpaced = (type == 1 );
2582
+ break ;
2558
2583
}
2559
-
2560
- // n == 4 && type == 0b0001 -> DblSpaced = true
2561
- if (Name.startswith (" VST4" ) || Name.startswith (" VLD4" ))
2562
- DblSpaced = slice (insn, 11 , 8 ) == 1 ;
2563
2584
}
2564
2585
return DisassembleNLdSt0 (MI, Opcode, insn, NumOps, NumOpsAdded,
2565
2586
slice (insn, 21 , 21 ) == 0 , DblSpaced, alignment/8 , B);
0 commit comments