~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to lib/Target/Hexagon/HexagonVLIWPacketizer.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include "HexagonMachineFunctionInfo.h"
49
49
 
50
50
#include <map>
 
51
#include <vector>
51
52
 
52
53
using namespace llvm;
53
54
 
 
55
static cl::opt<bool> PacketizeVolatiles("hexagon-packetize-volatiles",
 
56
      cl::ZeroOrMore, cl::Hidden, cl::init(true),
 
57
      cl::desc("Allow non-solo packetization of volatile memory references"));
 
58
 
 
59
namespace llvm {
 
60
  void initializeHexagonPacketizerPass(PassRegistry&);
 
61
}
 
62
 
 
63
 
54
64
namespace {
55
65
  class HexagonPacketizer : public MachineFunctionPass {
56
66
 
57
67
  public:
58
68
    static char ID;
59
 
    HexagonPacketizer() : MachineFunctionPass(ID) {}
 
69
    HexagonPacketizer() : MachineFunctionPass(ID) {
 
70
      initializeHexagonPacketizerPass(*PassRegistry::getPassRegistry());
 
71
    }
60
72
 
61
73
    void getAnalysisUsage(AnalysisUsage &AU) const {
62
74
      AU.setPreservesCFG();
63
75
      AU.addRequired<MachineDominatorTree>();
 
76
      AU.addRequired<MachineBranchProbabilityInfo>();
64
77
      AU.addPreserved<MachineDominatorTree>();
65
78
      AU.addRequired<MachineLoopInfo>();
66
79
      AU.addPreserved<MachineLoopInfo>();
96
109
    // schedule this instruction.
97
110
    bool FoundSequentialDependence;
98
111
 
 
112
    /// \brief A handle to the branch probability pass.
 
113
   const MachineBranchProbabilityInfo *MBPI;
 
114
 
 
115
   // Track MIs with ignored dependece.
 
116
   std::vector<MachineInstr*> IgnoreDepMIs;
 
117
 
99
118
  public:
100
119
    // Ctor.
101
120
    HexagonPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI,
102
 
                          MachineDominatorTree &MDT);
 
121
                          MachineDominatorTree &MDT,
 
122
                          const MachineBranchProbabilityInfo *MBPI);
103
123
 
104
124
    // initPacketizerState - initialize some internal flags.
105
125
    void initPacketizerState();
123
143
  private:
124
144
    bool IsCallDependent(MachineInstr* MI, SDep::Kind DepType, unsigned DepReg);
125
145
    bool PromoteToDotNew(MachineInstr* MI, SDep::Kind DepType,
126
 
                    MachineBasicBlock::iterator &MII,
127
 
                    const TargetRegisterClass* RC);
 
146
                         MachineBasicBlock::iterator &MII,
 
147
                         const TargetRegisterClass* RC);
128
148
    bool CanPromoteToDotNew(MachineInstr* MI, SUnit* PacketSU,
129
 
                    unsigned DepReg,
130
 
                    std::map <MachineInstr*, SUnit*> MIToSUnit,
131
 
                    MachineBasicBlock::iterator &MII,
132
 
                    const TargetRegisterClass* RC);
 
149
                            unsigned DepReg,
 
150
                            std::map <MachineInstr*, SUnit*> MIToSUnit,
 
151
                            MachineBasicBlock::iterator &MII,
 
152
                            const TargetRegisterClass* RC);
133
153
    bool CanPromoteToNewValue(MachineInstr* MI, SUnit* PacketSU,
134
 
                    unsigned DepReg,
135
 
                    std::map <MachineInstr*, SUnit*> MIToSUnit,
136
 
                    MachineBasicBlock::iterator &MII);
 
154
                              unsigned DepReg,
 
155
                              std::map <MachineInstr*, SUnit*> MIToSUnit,
 
156
                              MachineBasicBlock::iterator &MII);
137
157
    bool CanPromoteToNewValueStore(MachineInstr* MI, MachineInstr* PacketMI,
138
 
                    unsigned DepReg,
139
 
                    std::map <MachineInstr*, SUnit*> MIToSUnit);
 
158
                                   unsigned DepReg,
 
159
                                   std::map <MachineInstr*, SUnit*> MIToSUnit);
140
160
    bool DemoteToDotOld(MachineInstr* MI);
141
161
    bool ArePredicatesComplements(MachineInstr* MI1, MachineInstr* MI2,
142
162
                    std::map <MachineInstr*, SUnit*> MIToSUnit);
144
164
                    unsigned, std::map <MachineInstr*, SUnit*>);
145
165
    bool isNewifiable(MachineInstr* MI);
146
166
    bool isCondInst(MachineInstr* MI);
147
 
    bool IsNewifyStore (MachineInstr* MI);
148
167
    bool tryAllocateResourcesForConstExt(MachineInstr* MI);
149
168
    bool canReserveResourcesForConstExt(MachineInstr *MI);
150
169
    void reserveResourcesForConstExt(MachineInstr* MI);
152
171
  };
153
172
}
154
173
 
 
174
INITIALIZE_PASS_BEGIN(HexagonPacketizer, "packets", "Hexagon Packetizer",
 
175
                      false, false)
 
176
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
 
177
INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfo)
 
178
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
 
179
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
 
180
INITIALIZE_PASS_END(HexagonPacketizer, "packets", "Hexagon Packetizer",
 
181
                    false, false)
 
182
 
 
183
 
155
184
// HexagonPacketizerList Ctor.
156
185
HexagonPacketizerList::HexagonPacketizerList(
157
 
  MachineFunction &MF, MachineLoopInfo &MLI,MachineDominatorTree &MDT)
 
186
  MachineFunction &MF, MachineLoopInfo &MLI,MachineDominatorTree &MDT,
 
187
  const MachineBranchProbabilityInfo *MBPI)
158
188
  : VLIWPacketizerList(MF, MLI, MDT, true){
 
189
  this->MBPI = MBPI;
159
190
}
160
191
 
161
192
bool HexagonPacketizer::runOnMachineFunction(MachineFunction &Fn) {
162
193
  const TargetInstrInfo *TII = Fn.getTarget().getInstrInfo();
163
194
  MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
164
195
  MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
165
 
 
 
196
  const MachineBranchProbabilityInfo *MBPI =
 
197
    &getAnalysis<MachineBranchProbabilityInfo>();
166
198
  // Instantiate the packetizer.
167
 
  HexagonPacketizerList Packetizer(Fn, MLI, MDT);
 
199
  HexagonPacketizerList Packetizer(Fn, MLI, MDT, MBPI);
168
200
 
169
201
  // DFA state table should not be empty.
170
202
  assert(Packetizer.getResourceTracker() && "Empty DFA table!");
350
382
  return (MI->getDesc().isTerminator() || MI->getDesc().isCall());
351
383
}
352
384
 
353
 
// Function returns true if an instruction can be promoted to the new-value
354
 
// store. It will always return false for v2 and v3.
355
 
// It lists all the conditional and unconditional stores that can be promoted
356
 
// to the new-value stores.
357
 
 
358
 
bool HexagonPacketizerList::IsNewifyStore (MachineInstr* MI) {
359
 
  const HexagonRegisterInfo* QRI =
360
 
                          (const HexagonRegisterInfo *) TM.getRegisterInfo();
361
 
  switch (MI->getOpcode())
362
 
  {
363
 
    // store byte
364
 
    case Hexagon::STrib:
365
 
    case Hexagon::STrib_indexed:
366
 
    case Hexagon::STrib_indexed_shl_V4:
367
 
    case Hexagon::STrib_shl_V4:
368
 
    case Hexagon::STb_GP_V4:
369
 
    case Hexagon::POST_STbri:
370
 
    case Hexagon::STrib_cPt:
371
 
    case Hexagon::STrib_cdnPt_V4:
372
 
    case Hexagon::STrib_cNotPt:
373
 
    case Hexagon::STrib_cdnNotPt_V4:
374
 
    case Hexagon::STrib_indexed_cPt:
375
 
    case Hexagon::STrib_indexed_cdnPt_V4:
376
 
    case Hexagon::STrib_indexed_cNotPt:
377
 
    case Hexagon::STrib_indexed_cdnNotPt_V4:
378
 
    case Hexagon::STrib_indexed_shl_cPt_V4:
379
 
    case Hexagon::STrib_indexed_shl_cdnPt_V4:
380
 
    case Hexagon::STrib_indexed_shl_cNotPt_V4:
381
 
    case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
382
 
    case Hexagon::POST_STbri_cPt:
383
 
    case Hexagon::POST_STbri_cdnPt_V4:
384
 
    case Hexagon::POST_STbri_cNotPt:
385
 
    case Hexagon::POST_STbri_cdnNotPt_V4:
386
 
    case Hexagon::STb_GP_cPt_V4:
387
 
    case Hexagon::STb_GP_cNotPt_V4:
388
 
    case Hexagon::STb_GP_cdnPt_V4:
389
 
    case Hexagon::STb_GP_cdnNotPt_V4:
390
 
 
391
 
    // store halfword
392
 
    case Hexagon::STrih:
393
 
    case Hexagon::STrih_indexed:
394
 
    case Hexagon::STrih_indexed_shl_V4:
395
 
    case Hexagon::STrih_shl_V4:
396
 
    case Hexagon::STh_GP_V4:
397
 
    case Hexagon::POST_SThri:
398
 
    case Hexagon::STrih_cPt:
399
 
    case Hexagon::STrih_cdnPt_V4:
400
 
    case Hexagon::STrih_cNotPt:
401
 
    case Hexagon::STrih_cdnNotPt_V4:
402
 
    case Hexagon::STrih_indexed_cPt:
403
 
    case Hexagon::STrih_indexed_cdnPt_V4:
404
 
    case Hexagon::STrih_indexed_cNotPt:
405
 
    case Hexagon::STrih_indexed_cdnNotPt_V4:
406
 
    case Hexagon::STrih_indexed_shl_cPt_V4:
407
 
    case Hexagon::STrih_indexed_shl_cdnPt_V4:
408
 
    case Hexagon::STrih_indexed_shl_cNotPt_V4:
409
 
    case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
410
 
    case Hexagon::POST_SThri_cPt:
411
 
    case Hexagon::POST_SThri_cdnPt_V4:
412
 
    case Hexagon::POST_SThri_cNotPt:
413
 
    case Hexagon::POST_SThri_cdnNotPt_V4:
414
 
    case Hexagon::STh_GP_cPt_V4:
415
 
    case Hexagon::STh_GP_cNotPt_V4:
416
 
    case Hexagon::STh_GP_cdnPt_V4:
417
 
    case Hexagon::STh_GP_cdnNotPt_V4:
418
 
 
419
 
    // store word
420
 
    case Hexagon::STriw:
421
 
    case Hexagon::STriw_indexed:
422
 
    case Hexagon::STriw_indexed_shl_V4:
423
 
    case Hexagon::STriw_shl_V4:
424
 
    case Hexagon::STw_GP_V4:
425
 
    case Hexagon::POST_STwri:
426
 
    case Hexagon::STriw_cPt:
427
 
    case Hexagon::STriw_cdnPt_V4:
428
 
    case Hexagon::STriw_cNotPt:
429
 
    case Hexagon::STriw_cdnNotPt_V4:
430
 
    case Hexagon::STriw_indexed_cPt:
431
 
    case Hexagon::STriw_indexed_cdnPt_V4:
432
 
    case Hexagon::STriw_indexed_cNotPt:
433
 
    case Hexagon::STriw_indexed_cdnNotPt_V4:
434
 
    case Hexagon::STriw_indexed_shl_cPt_V4:
435
 
    case Hexagon::STriw_indexed_shl_cdnPt_V4:
436
 
    case Hexagon::STriw_indexed_shl_cNotPt_V4:
437
 
    case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
438
 
    case Hexagon::POST_STwri_cPt:
439
 
    case Hexagon::POST_STwri_cdnPt_V4:
440
 
    case Hexagon::POST_STwri_cNotPt:
441
 
    case Hexagon::POST_STwri_cdnNotPt_V4:
442
 
    case Hexagon::STw_GP_cPt_V4:
443
 
    case Hexagon::STw_GP_cNotPt_V4:
444
 
    case Hexagon::STw_GP_cdnPt_V4:
445
 
    case Hexagon::STw_GP_cdnNotPt_V4:
446
 
        return QRI->Subtarget.hasV4TOps();
447
 
  }
448
 
  return false;
449
 
}
450
 
 
451
385
static bool IsLoopN(MachineInstr *MI) {
452
386
  return (MI->getOpcode() == Hexagon::LOOP0_i ||
453
387
          MI->getOpcode() == Hexagon::LOOP0_r);
465
399
  return false;
466
400
}
467
401
 
468
 
// Return the new value instruction for a given store.
469
 
static int GetDotNewOp(const int opc) {
470
 
  switch (opc) {
471
 
  default: llvm_unreachable("Unknown .new type");
472
 
  // store new value byte
473
 
  case Hexagon::STrib:
474
 
    return Hexagon::STrib_nv_V4;
475
 
 
476
 
  case Hexagon::STrib_indexed:
477
 
    return Hexagon::STrib_indexed_nv_V4;
478
 
 
479
 
  case Hexagon::STrib_indexed_shl_V4:
480
 
    return Hexagon::STrib_indexed_shl_nv_V4;
481
 
 
482
 
  case Hexagon::STrib_shl_V4:
483
 
    return Hexagon::STrib_shl_nv_V4;
484
 
 
485
 
  case Hexagon::STb_GP_V4:
486
 
    return Hexagon::STb_GP_nv_V4;
487
 
 
488
 
  case Hexagon::POST_STbri:
489
 
    return Hexagon::POST_STbri_nv_V4;
490
 
 
491
 
  case Hexagon::STrib_cPt:
492
 
    return Hexagon::STrib_cPt_nv_V4;
493
 
 
494
 
  case Hexagon::STrib_cdnPt_V4:
495
 
    return Hexagon::STrib_cdnPt_nv_V4;
496
 
 
497
 
  case Hexagon::STrib_cNotPt:
498
 
    return Hexagon::STrib_cNotPt_nv_V4;
499
 
 
500
 
  case Hexagon::STrib_cdnNotPt_V4:
501
 
    return Hexagon::STrib_cdnNotPt_nv_V4;
502
 
 
503
 
  case Hexagon::STrib_indexed_cPt:
504
 
    return Hexagon::STrib_indexed_cPt_nv_V4;
505
 
 
506
 
  case Hexagon::STrib_indexed_cdnPt_V4:
507
 
    return Hexagon::STrib_indexed_cdnPt_nv_V4;
508
 
 
509
 
  case Hexagon::STrib_indexed_cNotPt:
510
 
    return Hexagon::STrib_indexed_cNotPt_nv_V4;
511
 
 
512
 
  case Hexagon::STrib_indexed_cdnNotPt_V4:
513
 
    return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
514
 
 
515
 
  case Hexagon::STrib_indexed_shl_cPt_V4:
516
 
    return Hexagon::STrib_indexed_shl_cPt_nv_V4;
517
 
 
518
 
  case Hexagon::STrib_indexed_shl_cdnPt_V4:
519
 
    return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
520
 
 
521
 
  case Hexagon::STrib_indexed_shl_cNotPt_V4:
522
 
    return Hexagon::STrib_indexed_shl_cNotPt_nv_V4;
523
 
 
524
 
  case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
525
 
    return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
526
 
 
527
 
  case Hexagon::POST_STbri_cPt:
528
 
    return Hexagon::POST_STbri_cPt_nv_V4;
529
 
 
530
 
  case Hexagon::POST_STbri_cdnPt_V4:
531
 
    return Hexagon::POST_STbri_cdnPt_nv_V4;
532
 
 
533
 
  case Hexagon::POST_STbri_cNotPt:
534
 
    return Hexagon::POST_STbri_cNotPt_nv_V4;
535
 
 
536
 
  case Hexagon::POST_STbri_cdnNotPt_V4:
537
 
    return Hexagon::POST_STbri_cdnNotPt_nv_V4;
538
 
 
539
 
  case Hexagon::STb_GP_cPt_V4:
540
 
    return Hexagon::STb_GP_cPt_nv_V4;
541
 
 
542
 
  case Hexagon::STb_GP_cNotPt_V4:
543
 
    return Hexagon::STb_GP_cNotPt_nv_V4;
544
 
 
545
 
  case Hexagon::STb_GP_cdnPt_V4:
546
 
    return Hexagon::STb_GP_cdnPt_nv_V4;
547
 
 
548
 
  case Hexagon::STb_GP_cdnNotPt_V4:
549
 
    return Hexagon::STb_GP_cdnNotPt_nv_V4;
550
 
 
551
 
  // store new value halfword
552
 
  case Hexagon::STrih:
553
 
    return Hexagon::STrih_nv_V4;
554
 
 
555
 
  case Hexagon::STrih_indexed:
556
 
    return Hexagon::STrih_indexed_nv_V4;
557
 
 
558
 
  case Hexagon::STrih_indexed_shl_V4:
559
 
    return Hexagon::STrih_indexed_shl_nv_V4;
560
 
 
561
 
  case Hexagon::STrih_shl_V4:
562
 
    return Hexagon::STrih_shl_nv_V4;
563
 
 
564
 
  case Hexagon::STh_GP_V4:
565
 
    return Hexagon::STh_GP_nv_V4;
566
 
 
567
 
  case Hexagon::POST_SThri:
568
 
    return Hexagon::POST_SThri_nv_V4;
569
 
 
570
 
  case Hexagon::STrih_cPt:
571
 
    return Hexagon::STrih_cPt_nv_V4;
572
 
 
573
 
  case Hexagon::STrih_cdnPt_V4:
574
 
    return Hexagon::STrih_cdnPt_nv_V4;
575
 
 
576
 
  case Hexagon::STrih_cNotPt:
577
 
    return Hexagon::STrih_cNotPt_nv_V4;
578
 
 
579
 
  case Hexagon::STrih_cdnNotPt_V4:
580
 
    return Hexagon::STrih_cdnNotPt_nv_V4;
581
 
 
582
 
  case Hexagon::STrih_indexed_cPt:
583
 
    return Hexagon::STrih_indexed_cPt_nv_V4;
584
 
 
585
 
  case Hexagon::STrih_indexed_cdnPt_V4:
586
 
    return Hexagon::STrih_indexed_cdnPt_nv_V4;
587
 
 
588
 
  case Hexagon::STrih_indexed_cNotPt:
589
 
    return Hexagon::STrih_indexed_cNotPt_nv_V4;
590
 
 
591
 
  case Hexagon::STrih_indexed_cdnNotPt_V4:
592
 
    return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
593
 
 
594
 
  case Hexagon::STrih_indexed_shl_cPt_V4:
595
 
    return Hexagon::STrih_indexed_shl_cPt_nv_V4;
596
 
 
597
 
  case Hexagon::STrih_indexed_shl_cdnPt_V4:
598
 
    return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
599
 
 
600
 
  case Hexagon::STrih_indexed_shl_cNotPt_V4:
601
 
    return Hexagon::STrih_indexed_shl_cNotPt_nv_V4;
602
 
 
603
 
  case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
604
 
    return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
605
 
 
606
 
  case Hexagon::POST_SThri_cPt:
607
 
    return Hexagon::POST_SThri_cPt_nv_V4;
608
 
 
609
 
  case Hexagon::POST_SThri_cdnPt_V4:
610
 
    return Hexagon::POST_SThri_cdnPt_nv_V4;
611
 
 
612
 
  case Hexagon::POST_SThri_cNotPt:
613
 
    return Hexagon::POST_SThri_cNotPt_nv_V4;
614
 
 
615
 
  case Hexagon::POST_SThri_cdnNotPt_V4:
616
 
    return Hexagon::POST_SThri_cdnNotPt_nv_V4;
617
 
 
618
 
  case Hexagon::STh_GP_cPt_V4:
619
 
    return Hexagon::STh_GP_cPt_nv_V4;
620
 
 
621
 
  case Hexagon::STh_GP_cNotPt_V4:
622
 
    return Hexagon::STh_GP_cNotPt_nv_V4;
623
 
 
624
 
  case Hexagon::STh_GP_cdnPt_V4:
625
 
    return Hexagon::STh_GP_cdnPt_nv_V4;
626
 
 
627
 
  case Hexagon::STh_GP_cdnNotPt_V4:
628
 
    return Hexagon::STh_GP_cdnNotPt_nv_V4;
629
 
 
630
 
  // store new value word
631
 
  case Hexagon::STriw:
632
 
    return Hexagon::STriw_nv_V4;
633
 
 
634
 
  case Hexagon::STriw_indexed:
635
 
    return Hexagon::STriw_indexed_nv_V4;
636
 
 
637
 
  case Hexagon::STriw_indexed_shl_V4:
638
 
    return Hexagon::STriw_indexed_shl_nv_V4;
639
 
 
640
 
  case Hexagon::STriw_shl_V4:
641
 
    return Hexagon::STriw_shl_nv_V4;
642
 
 
643
 
  case Hexagon::STw_GP_V4:
644
 
    return Hexagon::STw_GP_nv_V4;
645
 
 
646
 
  case Hexagon::POST_STwri:
647
 
    return Hexagon::POST_STwri_nv_V4;
648
 
 
649
 
  case Hexagon::STriw_cPt:
650
 
    return Hexagon::STriw_cPt_nv_V4;
651
 
 
652
 
  case Hexagon::STriw_cdnPt_V4:
653
 
    return Hexagon::STriw_cdnPt_nv_V4;
654
 
 
655
 
  case Hexagon::STriw_cNotPt:
656
 
    return Hexagon::STriw_cNotPt_nv_V4;
657
 
 
658
 
  case Hexagon::STriw_cdnNotPt_V4:
659
 
    return Hexagon::STriw_cdnNotPt_nv_V4;
660
 
 
661
 
  case Hexagon::STriw_indexed_cPt:
662
 
    return Hexagon::STriw_indexed_cPt_nv_V4;
663
 
 
664
 
  case Hexagon::STriw_indexed_cdnPt_V4:
665
 
    return Hexagon::STriw_indexed_cdnPt_nv_V4;
666
 
 
667
 
  case Hexagon::STriw_indexed_cNotPt:
668
 
    return Hexagon::STriw_indexed_cNotPt_nv_V4;
669
 
 
670
 
  case Hexagon::STriw_indexed_cdnNotPt_V4:
671
 
    return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
672
 
 
673
 
  case Hexagon::STriw_indexed_shl_cPt_V4:
674
 
    return Hexagon::STriw_indexed_shl_cPt_nv_V4;
675
 
 
676
 
  case Hexagon::STriw_indexed_shl_cdnPt_V4:
677
 
    return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
678
 
 
679
 
  case Hexagon::STriw_indexed_shl_cNotPt_V4:
680
 
    return Hexagon::STriw_indexed_shl_cNotPt_nv_V4;
681
 
 
682
 
  case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
683
 
    return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
684
 
 
685
 
  case Hexagon::POST_STwri_cPt:
686
 
    return Hexagon::POST_STwri_cPt_nv_V4;
687
 
 
688
 
  case Hexagon::POST_STwri_cdnPt_V4:
689
 
    return Hexagon::POST_STwri_cdnPt_nv_V4;
690
 
 
691
 
  case Hexagon::POST_STwri_cNotPt:
692
 
    return Hexagon::POST_STwri_cNotPt_nv_V4;
693
 
 
694
 
  case Hexagon::POST_STwri_cdnNotPt_V4:
695
 
    return Hexagon::POST_STwri_cdnNotPt_nv_V4;
696
 
 
697
 
  case Hexagon::STw_GP_cPt_V4:
698
 
    return Hexagon::STw_GP_cPt_nv_V4;
699
 
 
700
 
  case Hexagon::STw_GP_cNotPt_V4:
701
 
    return Hexagon::STw_GP_cNotPt_nv_V4;
702
 
 
703
 
  case Hexagon::STw_GP_cdnPt_V4:
704
 
    return Hexagon::STw_GP_cdnPt_nv_V4;
705
 
 
706
 
  case Hexagon::STw_GP_cdnNotPt_V4:
707
 
    return Hexagon::STw_GP_cdnNotPt_nv_V4;
708
 
 
709
 
  }
710
 
}
711
 
 
712
 
// Return .new predicate version for an instruction
713
 
static int GetDotNewPredOp(const int opc) {
714
 
  switch (opc) {
715
 
  default: llvm_unreachable("Unknown .new type");
716
 
  // Conditional stores
717
 
  // Store byte conditionally
718
 
  case Hexagon::STrib_cPt :
719
 
    return Hexagon::STrib_cdnPt_V4;
720
 
 
721
 
  case Hexagon::STrib_cNotPt :
722
 
    return Hexagon::STrib_cdnNotPt_V4;
723
 
 
724
 
  case Hexagon::STrib_indexed_cPt :
725
 
    return Hexagon::STrib_indexed_cdnPt_V4;
726
 
 
727
 
  case Hexagon::STrib_indexed_cNotPt :
728
 
    return Hexagon::STrib_indexed_cdnNotPt_V4;
729
 
 
730
 
  case Hexagon::STrib_imm_cPt_V4 :
731
 
    return Hexagon::STrib_imm_cdnPt_V4;
732
 
 
733
 
  case Hexagon::STrib_imm_cNotPt_V4 :
734
 
    return Hexagon::STrib_imm_cdnNotPt_V4;
735
 
 
736
 
  case Hexagon::POST_STbri_cPt :
737
 
    return Hexagon::POST_STbri_cdnPt_V4;
738
 
 
739
 
  case Hexagon::POST_STbri_cNotPt :
740
 
    return Hexagon::POST_STbri_cdnNotPt_V4;
741
 
 
742
 
  case Hexagon::STrib_indexed_shl_cPt_V4 :
743
 
    return Hexagon::STrib_indexed_shl_cdnPt_V4;
744
 
 
745
 
  case Hexagon::STrib_indexed_shl_cNotPt_V4 :
746
 
    return Hexagon::STrib_indexed_shl_cdnNotPt_V4;
747
 
 
748
 
  case Hexagon::STb_GP_cPt_V4 :
749
 
    return Hexagon::STb_GP_cdnPt_V4;
750
 
 
751
 
  case Hexagon::STb_GP_cNotPt_V4 :
752
 
    return Hexagon::STb_GP_cdnNotPt_V4;
753
 
 
754
 
  // Store doubleword conditionally
755
 
  case Hexagon::STrid_cPt :
756
 
    return Hexagon::STrid_cdnPt_V4;
757
 
 
758
 
  case Hexagon::STrid_cNotPt :
759
 
    return Hexagon::STrid_cdnNotPt_V4;
760
 
 
761
 
  case Hexagon::STrid_indexed_cPt :
762
 
    return Hexagon::STrid_indexed_cdnPt_V4;
763
 
 
764
 
  case Hexagon::STrid_indexed_cNotPt :
765
 
    return Hexagon::STrid_indexed_cdnNotPt_V4;
766
 
 
767
 
  case Hexagon::STrid_indexed_shl_cPt_V4 :
768
 
    return Hexagon::STrid_indexed_shl_cdnPt_V4;
769
 
 
770
 
  case Hexagon::STrid_indexed_shl_cNotPt_V4 :
771
 
    return Hexagon::STrid_indexed_shl_cdnNotPt_V4;
772
 
 
773
 
  case Hexagon::POST_STdri_cPt :
774
 
    return Hexagon::POST_STdri_cdnPt_V4;
775
 
 
776
 
  case Hexagon::POST_STdri_cNotPt :
777
 
    return Hexagon::POST_STdri_cdnNotPt_V4;
778
 
 
779
 
  case Hexagon::STd_GP_cPt_V4 :
780
 
    return Hexagon::STd_GP_cdnPt_V4;
781
 
 
782
 
  case Hexagon::STd_GP_cNotPt_V4 :
783
 
    return Hexagon::STd_GP_cdnNotPt_V4;
784
 
 
785
 
  // Store halfword conditionally
786
 
  case Hexagon::STrih_cPt :
787
 
    return Hexagon::STrih_cdnPt_V4;
788
 
 
789
 
  case Hexagon::STrih_cNotPt :
790
 
    return Hexagon::STrih_cdnNotPt_V4;
791
 
 
792
 
  case Hexagon::STrih_indexed_cPt :
793
 
    return Hexagon::STrih_indexed_cdnPt_V4;
794
 
 
795
 
  case Hexagon::STrih_indexed_cNotPt :
796
 
    return Hexagon::STrih_indexed_cdnNotPt_V4;
797
 
 
798
 
  case Hexagon::STrih_imm_cPt_V4 :
799
 
    return Hexagon::STrih_imm_cdnPt_V4;
800
 
 
801
 
  case Hexagon::STrih_imm_cNotPt_V4 :
802
 
    return Hexagon::STrih_imm_cdnNotPt_V4;
803
 
 
804
 
  case Hexagon::STrih_indexed_shl_cPt_V4 :
805
 
    return Hexagon::STrih_indexed_shl_cdnPt_V4;
806
 
 
807
 
  case Hexagon::STrih_indexed_shl_cNotPt_V4 :
808
 
    return Hexagon::STrih_indexed_shl_cdnNotPt_V4;
809
 
 
810
 
  case Hexagon::POST_SThri_cPt :
811
 
    return Hexagon::POST_SThri_cdnPt_V4;
812
 
 
813
 
  case Hexagon::POST_SThri_cNotPt :
814
 
    return Hexagon::POST_SThri_cdnNotPt_V4;
815
 
 
816
 
  case Hexagon::STh_GP_cPt_V4 :
817
 
    return Hexagon::STh_GP_cdnPt_V4;
818
 
 
819
 
  case Hexagon::STh_GP_cNotPt_V4 :
820
 
    return Hexagon::STh_GP_cdnNotPt_V4;
821
 
 
822
 
  // Store word conditionally
823
 
  case Hexagon::STriw_cPt :
824
 
    return Hexagon::STriw_cdnPt_V4;
825
 
 
826
 
  case Hexagon::STriw_cNotPt :
827
 
    return Hexagon::STriw_cdnNotPt_V4;
828
 
 
829
 
  case Hexagon::STriw_indexed_cPt :
830
 
    return Hexagon::STriw_indexed_cdnPt_V4;
831
 
 
832
 
  case Hexagon::STriw_indexed_cNotPt :
833
 
    return Hexagon::STriw_indexed_cdnNotPt_V4;
834
 
 
835
 
  case Hexagon::STriw_imm_cPt_V4 :
836
 
    return Hexagon::STriw_imm_cdnPt_V4;
837
 
 
838
 
  case Hexagon::STriw_imm_cNotPt_V4 :
839
 
    return Hexagon::STriw_imm_cdnNotPt_V4;
840
 
 
841
 
  case Hexagon::STriw_indexed_shl_cPt_V4 :
842
 
    return Hexagon::STriw_indexed_shl_cdnPt_V4;
843
 
 
844
 
  case Hexagon::STriw_indexed_shl_cNotPt_V4 :
845
 
    return Hexagon::STriw_indexed_shl_cdnNotPt_V4;
846
 
 
847
 
  case Hexagon::POST_STwri_cPt :
848
 
    return Hexagon::POST_STwri_cdnPt_V4;
849
 
 
850
 
  case Hexagon::POST_STwri_cNotPt :
851
 
    return Hexagon::POST_STwri_cdnNotPt_V4;
852
 
 
853
 
  case Hexagon::STw_GP_cPt_V4 :
854
 
    return Hexagon::STw_GP_cdnPt_V4;
855
 
 
856
 
  case Hexagon::STw_GP_cNotPt_V4 :
857
 
    return Hexagon::STw_GP_cdnNotPt_V4;
858
 
 
859
 
  // Condtional Jumps
860
 
  case Hexagon::JMP_c:
861
 
    return Hexagon::JMP_cdnPt;
862
 
 
863
 
  case Hexagon::JMP_cNot:
864
 
    return Hexagon::JMP_cdnNotPt;
865
 
 
866
 
  case Hexagon::JMPR_cPt:
867
 
    return Hexagon::JMPR_cdnPt_V3;
868
 
 
869
 
  case Hexagon::JMPR_cNotPt:
870
 
    return Hexagon::JMPR_cdnNotPt_V3;
871
 
 
872
 
  // Conditional Transfers
873
 
  case Hexagon::TFR_cPt:
874
 
    return Hexagon::TFR_cdnPt;
875
 
 
876
 
  case Hexagon::TFR_cNotPt:
877
 
    return Hexagon::TFR_cdnNotPt;
878
 
 
879
 
  case Hexagon::TFRI_cPt:
880
 
    return Hexagon::TFRI_cdnPt;
881
 
 
882
 
  case Hexagon::TFRI_cNotPt:
883
 
    return Hexagon::TFRI_cdnNotPt;
884
 
 
885
 
  // Load double word
886
 
  case Hexagon::LDrid_cPt :
887
 
    return Hexagon::LDrid_cdnPt;
888
 
 
889
 
  case Hexagon::LDrid_cNotPt :
890
 
    return Hexagon::LDrid_cdnNotPt;
891
 
 
892
 
  case Hexagon::LDrid_indexed_cPt :
893
 
    return Hexagon::LDrid_indexed_cdnPt;
894
 
 
895
 
  case Hexagon::LDrid_indexed_cNotPt :
896
 
    return Hexagon::LDrid_indexed_cdnNotPt;
897
 
 
898
 
  case Hexagon::POST_LDrid_cPt :
899
 
    return Hexagon::POST_LDrid_cdnPt_V4;
900
 
 
901
 
  case Hexagon::POST_LDrid_cNotPt :
902
 
    return Hexagon::POST_LDrid_cdnNotPt_V4;
903
 
 
904
 
  // Load word
905
 
  case Hexagon::LDriw_cPt :
906
 
    return Hexagon::LDriw_cdnPt;
907
 
 
908
 
  case Hexagon::LDriw_cNotPt :
909
 
    return Hexagon::LDriw_cdnNotPt;
910
 
 
911
 
  case Hexagon::LDriw_indexed_cPt :
912
 
    return Hexagon::LDriw_indexed_cdnPt;
913
 
 
914
 
  case Hexagon::LDriw_indexed_cNotPt :
915
 
    return Hexagon::LDriw_indexed_cdnNotPt;
916
 
 
917
 
  case Hexagon::POST_LDriw_cPt :
918
 
    return Hexagon::POST_LDriw_cdnPt_V4;
919
 
 
920
 
  case Hexagon::POST_LDriw_cNotPt :
921
 
    return Hexagon::POST_LDriw_cdnNotPt_V4;
922
 
 
923
 
  // Load halfword
924
 
  case Hexagon::LDrih_cPt :
925
 
    return Hexagon::LDrih_cdnPt;
926
 
 
927
 
  case Hexagon::LDrih_cNotPt :
928
 
    return Hexagon::LDrih_cdnNotPt;
929
 
 
930
 
  case Hexagon::LDrih_indexed_cPt :
931
 
    return Hexagon::LDrih_indexed_cdnPt;
932
 
 
933
 
  case Hexagon::LDrih_indexed_cNotPt :
934
 
    return Hexagon::LDrih_indexed_cdnNotPt;
935
 
 
936
 
  case Hexagon::POST_LDrih_cPt :
937
 
    return Hexagon::POST_LDrih_cdnPt_V4;
938
 
 
939
 
  case Hexagon::POST_LDrih_cNotPt :
940
 
    return Hexagon::POST_LDrih_cdnNotPt_V4;
941
 
 
942
 
  // Load byte
943
 
  case Hexagon::LDrib_cPt :
944
 
    return Hexagon::LDrib_cdnPt;
945
 
 
946
 
  case Hexagon::LDrib_cNotPt :
947
 
    return Hexagon::LDrib_cdnNotPt;
948
 
 
949
 
  case Hexagon::LDrib_indexed_cPt :
950
 
    return Hexagon::LDrib_indexed_cdnPt;
951
 
 
952
 
  case Hexagon::LDrib_indexed_cNotPt :
953
 
    return Hexagon::LDrib_indexed_cdnNotPt;
954
 
 
955
 
  case Hexagon::POST_LDrib_cPt :
956
 
    return Hexagon::POST_LDrib_cdnPt_V4;
957
 
 
958
 
  case Hexagon::POST_LDrib_cNotPt :
959
 
    return Hexagon::POST_LDrib_cdnNotPt_V4;
960
 
 
961
 
  // Load unsigned halfword
962
 
  case Hexagon::LDriuh_cPt :
963
 
    return Hexagon::LDriuh_cdnPt;
964
 
 
965
 
  case Hexagon::LDriuh_cNotPt :
966
 
    return Hexagon::LDriuh_cdnNotPt;
967
 
 
968
 
  case Hexagon::LDriuh_indexed_cPt :
969
 
    return Hexagon::LDriuh_indexed_cdnPt;
970
 
 
971
 
  case Hexagon::LDriuh_indexed_cNotPt :
972
 
    return Hexagon::LDriuh_indexed_cdnNotPt;
973
 
 
974
 
  case Hexagon::POST_LDriuh_cPt :
975
 
    return Hexagon::POST_LDriuh_cdnPt_V4;
976
 
 
977
 
  case Hexagon::POST_LDriuh_cNotPt :
978
 
    return Hexagon::POST_LDriuh_cdnNotPt_V4;
979
 
 
980
 
  // Load unsigned byte
981
 
  case Hexagon::LDriub_cPt :
982
 
    return Hexagon::LDriub_cdnPt;
983
 
 
984
 
  case Hexagon::LDriub_cNotPt :
985
 
    return Hexagon::LDriub_cdnNotPt;
986
 
 
987
 
  case Hexagon::LDriub_indexed_cPt :
988
 
    return Hexagon::LDriub_indexed_cdnPt;
989
 
 
990
 
  case Hexagon::LDriub_indexed_cNotPt :
991
 
    return Hexagon::LDriub_indexed_cdnNotPt;
992
 
 
993
 
  case Hexagon::POST_LDriub_cPt :
994
 
    return Hexagon::POST_LDriub_cdnPt_V4;
995
 
 
996
 
  case Hexagon::POST_LDriub_cNotPt :
997
 
    return Hexagon::POST_LDriub_cdnNotPt_V4;
998
 
 
999
 
  // V4 indexed+scaled load
1000
 
 
1001
 
  case Hexagon::LDrid_indexed_shl_cPt_V4 :
1002
 
    return Hexagon::LDrid_indexed_shl_cdnPt_V4;
1003
 
 
1004
 
  case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
1005
 
    return Hexagon::LDrid_indexed_shl_cdnNotPt_V4;
1006
 
 
1007
 
  case Hexagon::LDrib_indexed_shl_cPt_V4 :
1008
 
    return Hexagon::LDrib_indexed_shl_cdnPt_V4;
1009
 
 
1010
 
  case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
1011
 
    return Hexagon::LDrib_indexed_shl_cdnNotPt_V4;
1012
 
 
1013
 
  case Hexagon::LDriub_indexed_shl_cPt_V4 :
1014
 
    return Hexagon::LDriub_indexed_shl_cdnPt_V4;
1015
 
 
1016
 
  case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
1017
 
    return Hexagon::LDriub_indexed_shl_cdnNotPt_V4;
1018
 
 
1019
 
  case Hexagon::LDrih_indexed_shl_cPt_V4 :
1020
 
    return Hexagon::LDrih_indexed_shl_cdnPt_V4;
1021
 
 
1022
 
  case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
1023
 
    return Hexagon::LDrih_indexed_shl_cdnNotPt_V4;
1024
 
 
1025
 
  case Hexagon::LDriuh_indexed_shl_cPt_V4 :
1026
 
    return Hexagon::LDriuh_indexed_shl_cdnPt_V4;
1027
 
 
1028
 
  case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
1029
 
    return Hexagon::LDriuh_indexed_shl_cdnNotPt_V4;
1030
 
 
1031
 
  case Hexagon::LDriw_indexed_shl_cPt_V4 :
1032
 
    return Hexagon::LDriw_indexed_shl_cdnPt_V4;
1033
 
 
1034
 
  case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
1035
 
    return Hexagon::LDriw_indexed_shl_cdnNotPt_V4;
1036
 
 
1037
 
  // V4 global address load
1038
 
 
1039
 
  case Hexagon::LDd_GP_cPt_V4:
1040
 
    return Hexagon::LDd_GP_cdnPt_V4;
1041
 
 
1042
 
  case Hexagon::LDd_GP_cNotPt_V4:
1043
 
    return Hexagon::LDd_GP_cdnNotPt_V4;
1044
 
 
1045
 
  case Hexagon::LDb_GP_cPt_V4:
1046
 
    return Hexagon::LDb_GP_cdnPt_V4;
1047
 
 
1048
 
  case Hexagon::LDb_GP_cNotPt_V4:
1049
 
    return Hexagon::LDb_GP_cdnNotPt_V4;
1050
 
 
1051
 
  case Hexagon::LDub_GP_cPt_V4:
1052
 
    return Hexagon::LDub_GP_cdnPt_V4;
1053
 
 
1054
 
  case Hexagon::LDub_GP_cNotPt_V4:
1055
 
    return Hexagon::LDub_GP_cdnNotPt_V4;
1056
 
 
1057
 
  case Hexagon::LDh_GP_cPt_V4:
1058
 
    return Hexagon::LDh_GP_cdnPt_V4;
1059
 
 
1060
 
  case Hexagon::LDh_GP_cNotPt_V4:
1061
 
    return Hexagon::LDh_GP_cdnNotPt_V4;
1062
 
 
1063
 
  case Hexagon::LDuh_GP_cPt_V4:
1064
 
    return Hexagon::LDuh_GP_cdnPt_V4;
1065
 
 
1066
 
  case Hexagon::LDuh_GP_cNotPt_V4:
1067
 
    return Hexagon::LDuh_GP_cdnNotPt_V4;
1068
 
 
1069
 
  case Hexagon::LDw_GP_cPt_V4:
1070
 
    return Hexagon::LDw_GP_cdnPt_V4;
1071
 
 
1072
 
  case Hexagon::LDw_GP_cNotPt_V4:
1073
 
    return Hexagon::LDw_GP_cdnNotPt_V4;
1074
 
 
1075
 
  // Conditional store new-value byte
1076
 
  case Hexagon::STrib_cPt_nv_V4 :
1077
 
    return Hexagon::STrib_cdnPt_nv_V4;
1078
 
  case Hexagon::STrib_cNotPt_nv_V4 :
1079
 
    return Hexagon::STrib_cdnNotPt_nv_V4;
1080
 
 
1081
 
  case Hexagon::STrib_indexed_cPt_nv_V4 :
1082
 
    return Hexagon::STrib_indexed_cdnPt_nv_V4;
1083
 
  case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1084
 
    return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
1085
 
 
1086
 
  case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1087
 
    return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
1088
 
  case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1089
 
    return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
1090
 
 
1091
 
  case Hexagon::POST_STbri_cPt_nv_V4 :
1092
 
    return Hexagon::POST_STbri_cdnPt_nv_V4;
1093
 
  case Hexagon::POST_STbri_cNotPt_nv_V4 :
1094
 
    return Hexagon::POST_STbri_cdnNotPt_nv_V4;
1095
 
 
1096
 
  case Hexagon::STb_GP_cPt_nv_V4 :
1097
 
    return Hexagon::STb_GP_cdnPt_nv_V4;
1098
 
 
1099
 
  case Hexagon::STb_GP_cNotPt_nv_V4 :
1100
 
    return Hexagon::STb_GP_cdnNotPt_nv_V4;
1101
 
 
1102
 
  // Conditional store new-value halfword
1103
 
  case Hexagon::STrih_cPt_nv_V4 :
1104
 
    return Hexagon::STrih_cdnPt_nv_V4;
1105
 
  case Hexagon::STrih_cNotPt_nv_V4 :
1106
 
    return Hexagon::STrih_cdnNotPt_nv_V4;
1107
 
 
1108
 
  case Hexagon::STrih_indexed_cPt_nv_V4 :
1109
 
    return Hexagon::STrih_indexed_cdnPt_nv_V4;
1110
 
  case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1111
 
    return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
1112
 
 
1113
 
  case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1114
 
    return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
1115
 
  case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1116
 
    return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
1117
 
 
1118
 
  case Hexagon::POST_SThri_cPt_nv_V4 :
1119
 
    return Hexagon::POST_SThri_cdnPt_nv_V4;
1120
 
  case Hexagon::POST_SThri_cNotPt_nv_V4 :
1121
 
    return Hexagon::POST_SThri_cdnNotPt_nv_V4;
1122
 
 
1123
 
  case Hexagon::STh_GP_cPt_nv_V4 :
1124
 
    return Hexagon::STh_GP_cdnPt_nv_V4;
1125
 
 
1126
 
  case Hexagon::STh_GP_cNotPt_nv_V4 :
1127
 
    return Hexagon::STh_GP_cdnNotPt_nv_V4;
1128
 
 
1129
 
  // Conditional store new-value word
1130
 
  case Hexagon::STriw_cPt_nv_V4 :
1131
 
    return  Hexagon::STriw_cdnPt_nv_V4;
1132
 
  case Hexagon::STriw_cNotPt_nv_V4 :
1133
 
    return Hexagon::STriw_cdnNotPt_nv_V4;
1134
 
 
1135
 
  case Hexagon::STriw_indexed_cPt_nv_V4 :
1136
 
    return Hexagon::STriw_indexed_cdnPt_nv_V4;
1137
 
  case Hexagon::STriw_indexed_cNotPt_nv_V4 :
1138
 
    return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
1139
 
 
1140
 
  case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
1141
 
    return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
1142
 
  case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
1143
 
    return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
1144
 
 
1145
 
  case Hexagon::POST_STwri_cPt_nv_V4 :
1146
 
    return Hexagon::POST_STwri_cdnPt_nv_V4;
1147
 
  case Hexagon::POST_STwri_cNotPt_nv_V4:
1148
 
    return Hexagon::POST_STwri_cdnNotPt_nv_V4;
1149
 
 
1150
 
  case Hexagon::STw_GP_cPt_nv_V4 :
1151
 
    return Hexagon::STw_GP_cdnPt_nv_V4;
1152
 
 
1153
 
  case Hexagon::STw_GP_cNotPt_nv_V4 :
1154
 
    return Hexagon::STw_GP_cdnNotPt_nv_V4;
1155
 
 
1156
 
  // Conditional add
1157
 
  case Hexagon::ADD_ri_cPt :
1158
 
    return Hexagon::ADD_ri_cdnPt;
1159
 
  case Hexagon::ADD_ri_cNotPt :
1160
 
    return Hexagon::ADD_ri_cdnNotPt;
1161
 
 
1162
 
  case Hexagon::ADD_rr_cPt :
1163
 
    return Hexagon::ADD_rr_cdnPt;
1164
 
  case Hexagon::ADD_rr_cNotPt :
1165
 
    return Hexagon::ADD_rr_cdnNotPt;
1166
 
 
1167
 
  // Conditional logical Operations
1168
 
  case Hexagon::XOR_rr_cPt :
1169
 
    return Hexagon::XOR_rr_cdnPt;
1170
 
  case Hexagon::XOR_rr_cNotPt :
1171
 
    return Hexagon::XOR_rr_cdnNotPt;
1172
 
 
1173
 
  case Hexagon::AND_rr_cPt :
1174
 
    return Hexagon::AND_rr_cdnPt;
1175
 
  case Hexagon::AND_rr_cNotPt :
1176
 
    return Hexagon::AND_rr_cdnNotPt;
1177
 
 
1178
 
  case Hexagon::OR_rr_cPt :
1179
 
    return Hexagon::OR_rr_cdnPt;
1180
 
  case Hexagon::OR_rr_cNotPt :
1181
 
    return Hexagon::OR_rr_cdnNotPt;
1182
 
 
1183
 
  // Conditional Subtract
1184
 
  case Hexagon::SUB_rr_cPt :
1185
 
    return Hexagon::SUB_rr_cdnPt;
1186
 
  case Hexagon::SUB_rr_cNotPt :
1187
 
    return Hexagon::SUB_rr_cdnNotPt;
1188
 
 
1189
 
  // Conditional combine
1190
 
  case Hexagon::COMBINE_rr_cPt :
1191
 
    return Hexagon::COMBINE_rr_cdnPt;
1192
 
  case Hexagon::COMBINE_rr_cNotPt :
1193
 
    return Hexagon::COMBINE_rr_cdnNotPt;
1194
 
 
1195
 
  case Hexagon::ASLH_cPt_V4 :
1196
 
    return Hexagon::ASLH_cdnPt_V4;
1197
 
  case Hexagon::ASLH_cNotPt_V4 :
1198
 
    return Hexagon::ASLH_cdnNotPt_V4;
1199
 
 
1200
 
  case Hexagon::ASRH_cPt_V4 :
1201
 
    return Hexagon::ASRH_cdnPt_V4;
1202
 
  case Hexagon::ASRH_cNotPt_V4 :
1203
 
    return Hexagon::ASRH_cdnNotPt_V4;
1204
 
 
1205
 
  case Hexagon::SXTB_cPt_V4 :
1206
 
    return Hexagon::SXTB_cdnPt_V4;
1207
 
  case Hexagon::SXTB_cNotPt_V4 :
1208
 
    return Hexagon::SXTB_cdnNotPt_V4;
1209
 
 
1210
 
  case Hexagon::SXTH_cPt_V4 :
1211
 
    return Hexagon::SXTH_cdnPt_V4;
1212
 
  case Hexagon::SXTH_cNotPt_V4 :
1213
 
    return Hexagon::SXTH_cdnNotPt_V4;
1214
 
 
1215
 
  case Hexagon::ZXTB_cPt_V4 :
1216
 
    return Hexagon::ZXTB_cdnPt_V4;
1217
 
  case Hexagon::ZXTB_cNotPt_V4 :
1218
 
    return Hexagon::ZXTB_cdnNotPt_V4;
1219
 
 
1220
 
  case Hexagon::ZXTH_cPt_V4 :
1221
 
    return Hexagon::ZXTH_cdnPt_V4;
1222
 
  case Hexagon::ZXTH_cNotPt_V4 :
1223
 
    return Hexagon::ZXTH_cdnNotPt_V4;
1224
 
  }
1225
 
}
1226
 
 
1227
402
// Returns true if an instruction can be promoted to .new predicate
1228
403
// or new-value store.
1229
404
bool HexagonPacketizerList::isNewifiable(MachineInstr* MI) {
1230
 
  if ( isCondInst(MI) || IsNewifyStore(MI))
 
405
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
 
406
  if ( isCondInst(MI) || QII->mayBeNewStore(MI))
1231
407
    return true;
1232
408
  else
1233
409
    return false;
1261
437
 
1262
438
  int NewOpcode;
1263
439
  if (RC == &Hexagon::PredRegsRegClass)
1264
 
    NewOpcode = GetDotNewPredOp(MI->getOpcode());
 
440
    NewOpcode = QII->GetDotNewPredOp(MI, MBPI);
1265
441
  else
1266
 
    NewOpcode = GetDotNewOp(MI->getOpcode());
 
442
    NewOpcode = QII->GetDotNewOp(MI);
1267
443
  MI->setDesc(QII->get(NewOpcode));
1268
444
 
1269
445
  return true;
1270
446
}
1271
447
 
1272
 
// Returns the most basic instruction for the .new predicated instructions and
1273
 
// new-value stores.
1274
 
// For example, all of the following instructions will be converted back to the
1275
 
// same instruction:
1276
 
// 1) if (p0.new) memw(R0+#0) = R1.new  --->
1277
 
// 2) if (p0) memw(R0+#0)= R1.new      -------> if (p0) memw(R0+#0) = R1
1278
 
// 3) if (p0.new) memw(R0+#0) = R1      --->
1279
 
//
1280
 
// To understand the translation of instruction 1 to its original form, consider
1281
 
// a packet with 3 instructions.
1282
 
// { p0 = cmp.eq(R0,R1)
1283
 
//   if (p0.new) R2 = add(R3, R4)
1284
 
//   R5 = add (R3, R1)
1285
 
//   }
1286
 
// if (p0) memw(R5+#0) = R2 <--- trying to include it in the previous packet
1287
 
//
1288
 
// This instruction can be part of the previous packet only if both p0 and R2
1289
 
// are promoted to .new values. This promotion happens in steps, first
1290
 
// predicate register is promoted to .new and in the next iteration R2 is
1291
 
// promoted. Therefore, in case of dependence check failure (due to R5) during
1292
 
// next iteration, it should be converted back to its most basic form.
1293
 
 
1294
 
static int GetDotOldOp(const int opc) {
1295
 
  switch (opc) {
1296
 
  default: llvm_unreachable("Unknown .old type");
1297
 
  case Hexagon::TFR_cdnPt:
1298
 
    return Hexagon::TFR_cPt;
1299
 
 
1300
 
  case Hexagon::TFR_cdnNotPt:
1301
 
    return Hexagon::TFR_cNotPt;
1302
 
 
1303
 
  case Hexagon::TFRI_cdnPt:
1304
 
    return Hexagon::TFRI_cPt;
1305
 
 
1306
 
  case Hexagon::TFRI_cdnNotPt:
1307
 
    return Hexagon::TFRI_cNotPt;
1308
 
 
1309
 
  case Hexagon::JMP_cdnPt:
1310
 
    return Hexagon::JMP_c;
1311
 
 
1312
 
  case Hexagon::JMP_cdnNotPt:
1313
 
    return Hexagon::JMP_cNot;
1314
 
 
1315
 
  case Hexagon::JMPR_cdnPt_V3:
1316
 
    return Hexagon::JMPR_cPt;
1317
 
 
1318
 
  case Hexagon::JMPR_cdnNotPt_V3:
1319
 
    return Hexagon::JMPR_cNotPt;
1320
 
 
1321
 
  // Load double word
1322
 
 
1323
 
  case Hexagon::LDrid_cdnPt :
1324
 
    return Hexagon::LDrid_cPt;
1325
 
 
1326
 
  case Hexagon::LDrid_cdnNotPt :
1327
 
    return Hexagon::LDrid_cNotPt;
1328
 
 
1329
 
  case Hexagon::LDrid_indexed_cdnPt :
1330
 
    return Hexagon::LDrid_indexed_cPt;
1331
 
 
1332
 
  case Hexagon::LDrid_indexed_cdnNotPt :
1333
 
    return Hexagon::LDrid_indexed_cNotPt;
1334
 
 
1335
 
  case Hexagon::POST_LDrid_cdnPt_V4 :
1336
 
    return Hexagon::POST_LDrid_cPt;
1337
 
 
1338
 
  case Hexagon::POST_LDrid_cdnNotPt_V4 :
1339
 
    return Hexagon::POST_LDrid_cNotPt;
1340
 
 
1341
 
  // Load word
1342
 
 
1343
 
  case Hexagon::LDriw_cdnPt :
1344
 
    return Hexagon::LDriw_cPt;
1345
 
 
1346
 
  case Hexagon::LDriw_cdnNotPt :
1347
 
    return Hexagon::LDriw_cNotPt;
1348
 
 
1349
 
  case Hexagon::LDriw_indexed_cdnPt :
1350
 
    return Hexagon::LDriw_indexed_cPt;
1351
 
 
1352
 
  case Hexagon::LDriw_indexed_cdnNotPt :
1353
 
    return Hexagon::LDriw_indexed_cNotPt;
1354
 
 
1355
 
  case Hexagon::POST_LDriw_cdnPt_V4 :
1356
 
    return Hexagon::POST_LDriw_cPt;
1357
 
 
1358
 
  case Hexagon::POST_LDriw_cdnNotPt_V4 :
1359
 
    return Hexagon::POST_LDriw_cNotPt;
1360
 
 
1361
 
  // Load half
1362
 
 
1363
 
  case Hexagon::LDrih_cdnPt :
1364
 
    return Hexagon::LDrih_cPt;
1365
 
 
1366
 
  case Hexagon::LDrih_cdnNotPt :
1367
 
    return Hexagon::LDrih_cNotPt;
1368
 
 
1369
 
  case Hexagon::LDrih_indexed_cdnPt :
1370
 
    return Hexagon::LDrih_indexed_cPt;
1371
 
 
1372
 
  case Hexagon::LDrih_indexed_cdnNotPt :
1373
 
    return Hexagon::LDrih_indexed_cNotPt;
1374
 
 
1375
 
  case Hexagon::POST_LDrih_cdnPt_V4 :
1376
 
    return Hexagon::POST_LDrih_cPt;
1377
 
 
1378
 
  case Hexagon::POST_LDrih_cdnNotPt_V4 :
1379
 
    return Hexagon::POST_LDrih_cNotPt;
1380
 
 
1381
 
  // Load byte
1382
 
 
1383
 
  case Hexagon::LDrib_cdnPt :
1384
 
    return Hexagon::LDrib_cPt;
1385
 
 
1386
 
  case Hexagon::LDrib_cdnNotPt :
1387
 
    return Hexagon::LDrib_cNotPt;
1388
 
 
1389
 
  case Hexagon::LDrib_indexed_cdnPt :
1390
 
    return Hexagon::LDrib_indexed_cPt;
1391
 
 
1392
 
  case Hexagon::LDrib_indexed_cdnNotPt :
1393
 
    return Hexagon::LDrib_indexed_cNotPt;
1394
 
 
1395
 
  case Hexagon::POST_LDrib_cdnPt_V4 :
1396
 
    return Hexagon::POST_LDrib_cPt;
1397
 
 
1398
 
  case Hexagon::POST_LDrib_cdnNotPt_V4 :
1399
 
    return Hexagon::POST_LDrib_cNotPt;
1400
 
 
1401
 
  // Load unsigned half
1402
 
 
1403
 
  case Hexagon::LDriuh_cdnPt :
1404
 
    return Hexagon::LDriuh_cPt;
1405
 
 
1406
 
  case Hexagon::LDriuh_cdnNotPt :
1407
 
    return Hexagon::LDriuh_cNotPt;
1408
 
 
1409
 
  case Hexagon::LDriuh_indexed_cdnPt :
1410
 
    return Hexagon::LDriuh_indexed_cPt;
1411
 
 
1412
 
  case Hexagon::LDriuh_indexed_cdnNotPt :
1413
 
    return Hexagon::LDriuh_indexed_cNotPt;
1414
 
 
1415
 
  case Hexagon::POST_LDriuh_cdnPt_V4 :
1416
 
    return Hexagon::POST_LDriuh_cPt;
1417
 
 
1418
 
  case Hexagon::POST_LDriuh_cdnNotPt_V4 :
1419
 
    return Hexagon::POST_LDriuh_cNotPt;
1420
 
 
1421
 
  // Load unsigned byte
1422
 
  case Hexagon::LDriub_cdnPt :
1423
 
    return Hexagon::LDriub_cPt;
1424
 
 
1425
 
  case Hexagon::LDriub_cdnNotPt :
1426
 
    return Hexagon::LDriub_cNotPt;
1427
 
 
1428
 
  case Hexagon::LDriub_indexed_cdnPt :
1429
 
    return Hexagon::LDriub_indexed_cPt;
1430
 
 
1431
 
  case Hexagon::LDriub_indexed_cdnNotPt :
1432
 
    return Hexagon::LDriub_indexed_cNotPt;
1433
 
 
1434
 
  case Hexagon::POST_LDriub_cdnPt_V4 :
1435
 
    return Hexagon::POST_LDriub_cPt;
1436
 
 
1437
 
  case Hexagon::POST_LDriub_cdnNotPt_V4 :
1438
 
    return Hexagon::POST_LDriub_cNotPt;
1439
 
 
1440
 
  // V4 indexed+scaled Load
1441
 
 
1442
 
  case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
1443
 
    return Hexagon::LDrid_indexed_shl_cPt_V4;
1444
 
 
1445
 
  case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
1446
 
    return Hexagon::LDrid_indexed_shl_cNotPt_V4;
1447
 
 
1448
 
  case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
1449
 
    return Hexagon::LDrib_indexed_shl_cPt_V4;
1450
 
 
1451
 
  case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
1452
 
    return Hexagon::LDrib_indexed_shl_cNotPt_V4;
1453
 
 
1454
 
  case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
1455
 
    return Hexagon::LDriub_indexed_shl_cPt_V4;
1456
 
 
1457
 
  case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
1458
 
    return Hexagon::LDriub_indexed_shl_cNotPt_V4;
1459
 
 
1460
 
  case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
1461
 
    return Hexagon::LDrih_indexed_shl_cPt_V4;
1462
 
 
1463
 
  case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
1464
 
    return Hexagon::LDrih_indexed_shl_cNotPt_V4;
1465
 
 
1466
 
  case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
1467
 
    return Hexagon::LDriuh_indexed_shl_cPt_V4;
1468
 
 
1469
 
  case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
1470
 
    return Hexagon::LDriuh_indexed_shl_cNotPt_V4;
1471
 
 
1472
 
  case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
1473
 
    return Hexagon::LDriw_indexed_shl_cPt_V4;
1474
 
 
1475
 
  case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
1476
 
    return Hexagon::LDriw_indexed_shl_cNotPt_V4;
1477
 
 
1478
 
  // V4 global address load
1479
 
 
1480
 
  case Hexagon::LDd_GP_cdnPt_V4:
1481
 
    return Hexagon::LDd_GP_cPt_V4;
1482
 
 
1483
 
  case Hexagon::LDd_GP_cdnNotPt_V4:
1484
 
    return Hexagon::LDd_GP_cNotPt_V4;
1485
 
 
1486
 
  case Hexagon::LDb_GP_cdnPt_V4:
1487
 
    return Hexagon::LDb_GP_cPt_V4;
1488
 
 
1489
 
  case Hexagon::LDb_GP_cdnNotPt_V4:
1490
 
    return Hexagon::LDb_GP_cNotPt_V4;
1491
 
 
1492
 
  case Hexagon::LDub_GP_cdnPt_V4:
1493
 
    return Hexagon::LDub_GP_cPt_V4;
1494
 
 
1495
 
  case Hexagon::LDub_GP_cdnNotPt_V4:
1496
 
    return Hexagon::LDub_GP_cNotPt_V4;
1497
 
 
1498
 
  case Hexagon::LDh_GP_cdnPt_V4:
1499
 
    return Hexagon::LDh_GP_cPt_V4;
1500
 
 
1501
 
  case Hexagon::LDh_GP_cdnNotPt_V4:
1502
 
    return Hexagon::LDh_GP_cNotPt_V4;
1503
 
 
1504
 
  case Hexagon::LDuh_GP_cdnPt_V4:
1505
 
    return Hexagon::LDuh_GP_cPt_V4;
1506
 
 
1507
 
  case Hexagon::LDuh_GP_cdnNotPt_V4:
1508
 
    return Hexagon::LDuh_GP_cNotPt_V4;
1509
 
 
1510
 
  case Hexagon::LDw_GP_cdnPt_V4:
1511
 
    return Hexagon::LDw_GP_cPt_V4;
1512
 
 
1513
 
  case Hexagon::LDw_GP_cdnNotPt_V4:
1514
 
    return Hexagon::LDw_GP_cNotPt_V4;
1515
 
 
1516
 
  // Conditional add
1517
 
 
1518
 
  case Hexagon::ADD_ri_cdnPt :
1519
 
    return Hexagon::ADD_ri_cPt;
1520
 
  case Hexagon::ADD_ri_cdnNotPt :
1521
 
    return Hexagon::ADD_ri_cNotPt;
1522
 
 
1523
 
  case Hexagon::ADD_rr_cdnPt :
1524
 
    return Hexagon::ADD_rr_cPt;
1525
 
  case Hexagon::ADD_rr_cdnNotPt:
1526
 
    return Hexagon::ADD_rr_cNotPt;
1527
 
 
1528
 
  // Conditional logical Operations
1529
 
 
1530
 
  case Hexagon::XOR_rr_cdnPt :
1531
 
    return Hexagon::XOR_rr_cPt;
1532
 
  case Hexagon::XOR_rr_cdnNotPt :
1533
 
    return Hexagon::XOR_rr_cNotPt;
1534
 
 
1535
 
  case Hexagon::AND_rr_cdnPt :
1536
 
    return Hexagon::AND_rr_cPt;
1537
 
  case Hexagon::AND_rr_cdnNotPt :
1538
 
    return Hexagon::AND_rr_cNotPt;
1539
 
 
1540
 
  case Hexagon::OR_rr_cdnPt :
1541
 
    return Hexagon::OR_rr_cPt;
1542
 
  case Hexagon::OR_rr_cdnNotPt :
1543
 
    return Hexagon::OR_rr_cNotPt;
1544
 
 
1545
 
  // Conditional Subtract
1546
 
 
1547
 
  case Hexagon::SUB_rr_cdnPt :
1548
 
    return Hexagon::SUB_rr_cPt;
1549
 
  case Hexagon::SUB_rr_cdnNotPt :
1550
 
    return Hexagon::SUB_rr_cNotPt;
1551
 
 
1552
 
  // Conditional combine
1553
 
 
1554
 
  case Hexagon::COMBINE_rr_cdnPt :
1555
 
    return Hexagon::COMBINE_rr_cPt;
1556
 
  case Hexagon::COMBINE_rr_cdnNotPt :
1557
 
    return Hexagon::COMBINE_rr_cNotPt;
1558
 
 
1559
 
// Conditional shift operations
1560
 
 
1561
 
  case Hexagon::ASLH_cdnPt_V4 :
1562
 
    return Hexagon::ASLH_cPt_V4;
1563
 
  case Hexagon::ASLH_cdnNotPt_V4 :
1564
 
    return Hexagon::ASLH_cNotPt_V4;
1565
 
 
1566
 
  case Hexagon::ASRH_cdnPt_V4 :
1567
 
    return Hexagon::ASRH_cPt_V4;
1568
 
  case Hexagon::ASRH_cdnNotPt_V4 :
1569
 
    return Hexagon::ASRH_cNotPt_V4;
1570
 
 
1571
 
  case Hexagon::SXTB_cdnPt_V4 :
1572
 
    return Hexagon::SXTB_cPt_V4;
1573
 
  case Hexagon::SXTB_cdnNotPt_V4 :
1574
 
    return Hexagon::SXTB_cNotPt_V4;
1575
 
 
1576
 
  case Hexagon::SXTH_cdnPt_V4 :
1577
 
    return Hexagon::SXTH_cPt_V4;
1578
 
  case Hexagon::SXTH_cdnNotPt_V4 :
1579
 
    return Hexagon::SXTH_cNotPt_V4;
1580
 
 
1581
 
  case Hexagon::ZXTB_cdnPt_V4 :
1582
 
    return Hexagon::ZXTB_cPt_V4;
1583
 
  case Hexagon::ZXTB_cdnNotPt_V4 :
1584
 
    return Hexagon::ZXTB_cNotPt_V4;
1585
 
 
1586
 
  case Hexagon::ZXTH_cdnPt_V4 :
1587
 
    return Hexagon::ZXTH_cPt_V4;
1588
 
  case Hexagon::ZXTH_cdnNotPt_V4 :
1589
 
    return Hexagon::ZXTH_cNotPt_V4;
1590
 
 
1591
 
  // Store byte
1592
 
 
1593
 
  case Hexagon::STrib_imm_cdnPt_V4 :
1594
 
    return Hexagon::STrib_imm_cPt_V4;
1595
 
 
1596
 
  case Hexagon::STrib_imm_cdnNotPt_V4 :
1597
 
    return Hexagon::STrib_imm_cNotPt_V4;
1598
 
 
1599
 
  case Hexagon::STrib_cdnPt_nv_V4 :
1600
 
  case Hexagon::STrib_cPt_nv_V4 :
1601
 
  case Hexagon::STrib_cdnPt_V4 :
1602
 
    return Hexagon::STrib_cPt;
1603
 
 
1604
 
  case Hexagon::STrib_cdnNotPt_nv_V4 :
1605
 
  case Hexagon::STrib_cNotPt_nv_V4 :
1606
 
  case Hexagon::STrib_cdnNotPt_V4 :
1607
 
    return Hexagon::STrib_cNotPt;
1608
 
 
1609
 
  case Hexagon::STrib_indexed_cdnPt_V4 :
1610
 
  case Hexagon::STrib_indexed_cPt_nv_V4 :
1611
 
  case Hexagon::STrib_indexed_cdnPt_nv_V4 :
1612
 
    return Hexagon::STrib_indexed_cPt;
1613
 
 
1614
 
  case Hexagon::STrib_indexed_cdnNotPt_V4 :
1615
 
  case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1616
 
  case Hexagon::STrib_indexed_cdnNotPt_nv_V4 :
1617
 
    return Hexagon::STrib_indexed_cNotPt;
1618
 
 
1619
 
  case Hexagon::STrib_indexed_shl_cdnPt_nv_V4:
1620
 
  case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1621
 
  case Hexagon::STrib_indexed_shl_cdnPt_V4 :
1622
 
    return Hexagon::STrib_indexed_shl_cPt_V4;
1623
 
 
1624
 
  case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4:
1625
 
  case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1626
 
  case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
1627
 
    return Hexagon::STrib_indexed_shl_cNotPt_V4;
1628
 
 
1629
 
  case Hexagon::POST_STbri_cdnPt_nv_V4 :
1630
 
  case Hexagon::POST_STbri_cPt_nv_V4 :
1631
 
  case Hexagon::POST_STbri_cdnPt_V4 :
1632
 
    return Hexagon::POST_STbri_cPt;
1633
 
 
1634
 
  case Hexagon::POST_STbri_cdnNotPt_nv_V4 :
1635
 
  case Hexagon::POST_STbri_cNotPt_nv_V4:
1636
 
  case Hexagon::POST_STbri_cdnNotPt_V4 :
1637
 
    return Hexagon::POST_STbri_cNotPt;
1638
 
 
1639
 
  case Hexagon::STb_GP_cdnPt_nv_V4:
1640
 
  case Hexagon::STb_GP_cdnPt_V4:
1641
 
  case Hexagon::STb_GP_cPt_nv_V4:
1642
 
    return Hexagon::STb_GP_cPt_V4;
1643
 
 
1644
 
  case Hexagon::STb_GP_cdnNotPt_nv_V4:
1645
 
  case Hexagon::STb_GP_cdnNotPt_V4:
1646
 
  case Hexagon::STb_GP_cNotPt_nv_V4:
1647
 
    return Hexagon::STb_GP_cNotPt_V4;
1648
 
 
1649
 
  // Store new-value byte - unconditional
1650
 
  case Hexagon::STrib_nv_V4:
1651
 
    return Hexagon::STrib;
1652
 
 
1653
 
  case Hexagon::STrib_indexed_nv_V4:
1654
 
    return Hexagon::STrib_indexed;
1655
 
 
1656
 
  case Hexagon::STrib_indexed_shl_nv_V4:
1657
 
    return Hexagon::STrib_indexed_shl_V4;
1658
 
 
1659
 
  case Hexagon::STrib_shl_nv_V4:
1660
 
    return Hexagon::STrib_shl_V4;
1661
 
 
1662
 
  case Hexagon::STb_GP_nv_V4:
1663
 
    return Hexagon::STb_GP_V4;
1664
 
 
1665
 
  case Hexagon::POST_STbri_nv_V4:
1666
 
    return Hexagon::POST_STbri;
1667
 
 
1668
 
  // Store halfword
1669
 
  case Hexagon::STrih_imm_cdnPt_V4 :
1670
 
    return Hexagon::STrih_imm_cPt_V4;
1671
 
 
1672
 
  case Hexagon::STrih_imm_cdnNotPt_V4 :
1673
 
    return Hexagon::STrih_imm_cNotPt_V4;
1674
 
 
1675
 
  case Hexagon::STrih_cdnPt_nv_V4 :
1676
 
  case Hexagon::STrih_cPt_nv_V4 :
1677
 
  case Hexagon::STrih_cdnPt_V4 :
1678
 
    return Hexagon::STrih_cPt;
1679
 
 
1680
 
  case Hexagon::STrih_cdnNotPt_nv_V4 :
1681
 
  case Hexagon::STrih_cNotPt_nv_V4 :
1682
 
  case Hexagon::STrih_cdnNotPt_V4 :
1683
 
    return Hexagon::STrih_cNotPt;
1684
 
 
1685
 
  case Hexagon::STrih_indexed_cdnPt_nv_V4:
1686
 
  case Hexagon::STrih_indexed_cPt_nv_V4 :
1687
 
  case Hexagon::STrih_indexed_cdnPt_V4 :
1688
 
    return Hexagon::STrih_indexed_cPt;
1689
 
 
1690
 
  case Hexagon::STrih_indexed_cdnNotPt_nv_V4:
1691
 
  case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1692
 
  case Hexagon::STrih_indexed_cdnNotPt_V4 :
1693
 
    return Hexagon::STrih_indexed_cNotPt;
1694
 
 
1695
 
  case Hexagon::STrih_indexed_shl_cdnPt_nv_V4 :
1696
 
  case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1697
 
  case Hexagon::STrih_indexed_shl_cdnPt_V4 :
1698
 
    return Hexagon::STrih_indexed_shl_cPt_V4;
1699
 
 
1700
 
  case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4 :
1701
 
  case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1702
 
  case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
1703
 
    return Hexagon::STrih_indexed_shl_cNotPt_V4;
1704
 
 
1705
 
  case Hexagon::POST_SThri_cdnPt_nv_V4 :
1706
 
  case Hexagon::POST_SThri_cPt_nv_V4 :
1707
 
  case Hexagon::POST_SThri_cdnPt_V4 :
1708
 
    return Hexagon::POST_SThri_cPt;
1709
 
 
1710
 
  case Hexagon::POST_SThri_cdnNotPt_nv_V4 :
1711
 
  case Hexagon::POST_SThri_cNotPt_nv_V4 :
1712
 
  case Hexagon::POST_SThri_cdnNotPt_V4 :
1713
 
    return Hexagon::POST_SThri_cNotPt;
1714
 
 
1715
 
  case Hexagon::STh_GP_cdnPt_nv_V4:
1716
 
  case Hexagon::STh_GP_cdnPt_V4:
1717
 
  case Hexagon::STh_GP_cPt_nv_V4:
1718
 
    return Hexagon::STh_GP_cPt_V4;
1719
 
 
1720
 
  case Hexagon::STh_GP_cdnNotPt_nv_V4:
1721
 
  case Hexagon::STh_GP_cdnNotPt_V4:
1722
 
  case Hexagon::STh_GP_cNotPt_nv_V4:
1723
 
    return Hexagon::STh_GP_cNotPt_V4;
1724
 
 
1725
 
  // Store new-value halfword - unconditional
1726
 
 
1727
 
  case Hexagon::STrih_nv_V4:
1728
 
    return Hexagon::STrih;
1729
 
 
1730
 
  case Hexagon::STrih_indexed_nv_V4:
1731
 
    return Hexagon::STrih_indexed;
1732
 
 
1733
 
  case Hexagon::STrih_indexed_shl_nv_V4:
1734
 
    return Hexagon::STrih_indexed_shl_V4;
1735
 
 
1736
 
  case Hexagon::STrih_shl_nv_V4:
1737
 
    return Hexagon::STrih_shl_V4;
1738
 
 
1739
 
  case Hexagon::STh_GP_nv_V4:
1740
 
    return Hexagon::STh_GP_V4;
1741
 
 
1742
 
  case Hexagon::POST_SThri_nv_V4:
1743
 
    return Hexagon::POST_SThri;
1744
 
 
1745
 
   // Store word
1746
 
 
1747
 
   case Hexagon::STriw_imm_cdnPt_V4 :
1748
 
    return Hexagon::STriw_imm_cPt_V4;
1749
 
 
1750
 
  case Hexagon::STriw_imm_cdnNotPt_V4 :
1751
 
    return Hexagon::STriw_imm_cNotPt_V4;
1752
 
 
1753
 
  case Hexagon::STriw_cdnPt_nv_V4 :
1754
 
  case Hexagon::STriw_cPt_nv_V4 :
1755
 
  case Hexagon::STriw_cdnPt_V4 :
1756
 
    return Hexagon::STriw_cPt;
1757
 
 
1758
 
  case Hexagon::STriw_cdnNotPt_nv_V4 :
1759
 
  case Hexagon::STriw_cNotPt_nv_V4 :
1760
 
  case Hexagon::STriw_cdnNotPt_V4 :
1761
 
    return Hexagon::STriw_cNotPt;
1762
 
 
1763
 
  case Hexagon::STriw_indexed_cdnPt_nv_V4 :
1764
 
  case Hexagon::STriw_indexed_cPt_nv_V4 :
1765
 
  case Hexagon::STriw_indexed_cdnPt_V4 :
1766
 
    return Hexagon::STriw_indexed_cPt;
1767
 
 
1768
 
  case Hexagon::STriw_indexed_cdnNotPt_nv_V4 :
1769
 
  case Hexagon::STriw_indexed_cNotPt_nv_V4 :
1770
 
  case Hexagon::STriw_indexed_cdnNotPt_V4 :
1771
 
    return Hexagon::STriw_indexed_cNotPt;
1772
 
 
1773
 
  case Hexagon::STriw_indexed_shl_cdnPt_nv_V4 :
1774
 
  case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
1775
 
  case Hexagon::STriw_indexed_shl_cdnPt_V4 :
1776
 
    return Hexagon::STriw_indexed_shl_cPt_V4;
1777
 
 
1778
 
  case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4 :
1779
 
  case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
1780
 
  case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
1781
 
    return Hexagon::STriw_indexed_shl_cNotPt_V4;
1782
 
 
1783
 
  case Hexagon::POST_STwri_cdnPt_nv_V4 :
1784
 
  case Hexagon::POST_STwri_cPt_nv_V4 :
1785
 
  case Hexagon::POST_STwri_cdnPt_V4 :
1786
 
    return Hexagon::POST_STwri_cPt;
1787
 
 
1788
 
  case Hexagon::POST_STwri_cdnNotPt_nv_V4 :
1789
 
  case Hexagon::POST_STwri_cNotPt_nv_V4 :
1790
 
  case Hexagon::POST_STwri_cdnNotPt_V4 :
1791
 
    return Hexagon::POST_STwri_cNotPt;
1792
 
 
1793
 
  case Hexagon::STw_GP_cdnPt_nv_V4:
1794
 
  case Hexagon::STw_GP_cdnPt_V4:
1795
 
  case Hexagon::STw_GP_cPt_nv_V4:
1796
 
    return Hexagon::STw_GP_cPt_V4;
1797
 
 
1798
 
  case Hexagon::STw_GP_cdnNotPt_nv_V4:
1799
 
  case Hexagon::STw_GP_cdnNotPt_V4:
1800
 
  case Hexagon::STw_GP_cNotPt_nv_V4:
1801
 
    return Hexagon::STw_GP_cNotPt_V4;
1802
 
 
1803
 
  // Store new-value word - unconditional
1804
 
 
1805
 
  case Hexagon::STriw_nv_V4:
1806
 
    return Hexagon::STriw;
1807
 
 
1808
 
  case Hexagon::STriw_indexed_nv_V4:
1809
 
    return Hexagon::STriw_indexed;
1810
 
 
1811
 
  case Hexagon::STriw_indexed_shl_nv_V4:
1812
 
    return Hexagon::STriw_indexed_shl_V4;
1813
 
 
1814
 
  case Hexagon::STriw_shl_nv_V4:
1815
 
    return Hexagon::STriw_shl_V4;
1816
 
 
1817
 
  case Hexagon::STw_GP_nv_V4:
1818
 
    return Hexagon::STw_GP_V4;
1819
 
 
1820
 
  case Hexagon::POST_STwri_nv_V4:
1821
 
    return Hexagon::POST_STwri;
1822
 
 
1823
 
 // Store doubleword
1824
 
 
1825
 
  case Hexagon::STrid_cdnPt_V4 :
1826
 
    return Hexagon::STrid_cPt;
1827
 
 
1828
 
  case Hexagon::STrid_cdnNotPt_V4 :
1829
 
    return Hexagon::STrid_cNotPt;
1830
 
 
1831
 
  case Hexagon::STrid_indexed_cdnPt_V4 :
1832
 
    return Hexagon::STrid_indexed_cPt;
1833
 
 
1834
 
  case Hexagon::STrid_indexed_cdnNotPt_V4 :
1835
 
    return Hexagon::STrid_indexed_cNotPt;
1836
 
 
1837
 
  case Hexagon::STrid_indexed_shl_cdnPt_V4 :
1838
 
    return Hexagon::STrid_indexed_shl_cPt_V4;
1839
 
 
1840
 
  case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
1841
 
    return Hexagon::STrid_indexed_shl_cNotPt_V4;
1842
 
 
1843
 
  case Hexagon::POST_STdri_cdnPt_V4 :
1844
 
    return Hexagon::POST_STdri_cPt;
1845
 
 
1846
 
  case Hexagon::POST_STdri_cdnNotPt_V4 :
1847
 
    return Hexagon::POST_STdri_cNotPt;
1848
 
 
1849
 
  case Hexagon::STd_GP_cdnPt_V4 :
1850
 
    return Hexagon::STd_GP_cPt_V4;
1851
 
 
1852
 
  case Hexagon::STd_GP_cdnNotPt_V4 :
1853
 
    return Hexagon::STd_GP_cNotPt_V4;
1854
 
 
1855
 
  }
1856
 
}
1857
 
 
1858
448
bool HexagonPacketizerList::DemoteToDotOld(MachineInstr* MI) {
1859
449
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1860
 
  int NewOpcode = GetDotOldOp(MI->getOpcode());
 
450
  int NewOpcode = QII->GetDotOldOp(MI->getOpcode());
1861
451
  MI->setDesc(QII->get(NewOpcode));
1862
452
  return true;
1863
453
}
1864
454
 
1865
 
// Returns true if an instruction is predicated on p0 and false if it's
1866
 
// predicated on !p0.
1867
 
 
1868
 
static bool GetPredicateSense(MachineInstr* MI,
1869
 
                              const HexagonInstrInfo *QII) {
1870
 
 
1871
 
  switch (MI->getOpcode()) {
1872
 
  default: llvm_unreachable("Unknown predicate sense of the instruction");
1873
 
  case Hexagon::TFR_cPt:
1874
 
  case Hexagon::TFR_cdnPt:
1875
 
  case Hexagon::TFRI_cPt:
1876
 
  case Hexagon::TFRI_cdnPt:
1877
 
  case Hexagon::STrib_cPt :
1878
 
  case Hexagon::STrib_cdnPt_V4 :
1879
 
  case Hexagon::STrib_indexed_cPt :
1880
 
  case Hexagon::STrib_indexed_cdnPt_V4 :
1881
 
  case Hexagon::STrib_indexed_shl_cPt_V4 :
1882
 
  case Hexagon::STrib_indexed_shl_cdnPt_V4 :
1883
 
  case Hexagon::POST_STbri_cPt :
1884
 
  case Hexagon::POST_STbri_cdnPt_V4 :
1885
 
  case Hexagon::STrih_cPt :
1886
 
  case Hexagon::STrih_cdnPt_V4 :
1887
 
  case Hexagon::STrih_indexed_cPt :
1888
 
  case Hexagon::STrih_indexed_cdnPt_V4 :
1889
 
  case Hexagon::STrih_indexed_shl_cPt_V4 :
1890
 
  case Hexagon::STrih_indexed_shl_cdnPt_V4 :
1891
 
  case Hexagon::POST_SThri_cPt :
1892
 
  case Hexagon::POST_SThri_cdnPt_V4 :
1893
 
  case Hexagon::STriw_cPt :
1894
 
  case Hexagon::STriw_cdnPt_V4 :
1895
 
  case Hexagon::STriw_indexed_cPt :
1896
 
  case Hexagon::STriw_indexed_cdnPt_V4 :
1897
 
  case Hexagon::STriw_indexed_shl_cPt_V4 :
1898
 
  case Hexagon::STriw_indexed_shl_cdnPt_V4 :
1899
 
  case Hexagon::POST_STwri_cPt :
1900
 
  case Hexagon::POST_STwri_cdnPt_V4 :
1901
 
  case Hexagon::STrib_imm_cPt_V4 :
1902
 
  case Hexagon::STrib_imm_cdnPt_V4 :
1903
 
  case Hexagon::STrid_cPt :
1904
 
  case Hexagon::STrid_cdnPt_V4 :
1905
 
  case Hexagon::STrid_indexed_cPt :
1906
 
  case Hexagon::STrid_indexed_cdnPt_V4 :
1907
 
  case Hexagon::STrid_indexed_shl_cPt_V4 :
1908
 
  case Hexagon::STrid_indexed_shl_cdnPt_V4 :
1909
 
  case Hexagon::POST_STdri_cPt :
1910
 
  case Hexagon::POST_STdri_cdnPt_V4 :
1911
 
  case Hexagon::STrih_imm_cPt_V4 :
1912
 
  case Hexagon::STrih_imm_cdnPt_V4 :
1913
 
  case Hexagon::STriw_imm_cPt_V4 :
1914
 
  case Hexagon::STriw_imm_cdnPt_V4 :
1915
 
  case Hexagon::JMP_cdnPt :
1916
 
  case Hexagon::LDrid_cPt :
1917
 
  case Hexagon::LDrid_cdnPt :
1918
 
  case Hexagon::LDrid_indexed_cPt :
1919
 
  case Hexagon::LDrid_indexed_cdnPt :
1920
 
  case Hexagon::POST_LDrid_cPt :
1921
 
  case Hexagon::POST_LDrid_cdnPt_V4 :
1922
 
  case Hexagon::LDriw_cPt :
1923
 
  case Hexagon::LDriw_cdnPt :
1924
 
  case Hexagon::LDriw_indexed_cPt :
1925
 
  case Hexagon::LDriw_indexed_cdnPt :
1926
 
  case Hexagon::POST_LDriw_cPt :
1927
 
  case Hexagon::POST_LDriw_cdnPt_V4 :
1928
 
  case Hexagon::LDrih_cPt :
1929
 
  case Hexagon::LDrih_cdnPt :
1930
 
  case Hexagon::LDrih_indexed_cPt :
1931
 
  case Hexagon::LDrih_indexed_cdnPt :
1932
 
  case Hexagon::POST_LDrih_cPt :
1933
 
  case Hexagon::POST_LDrih_cdnPt_V4 :
1934
 
  case Hexagon::LDrib_cPt :
1935
 
  case Hexagon::LDrib_cdnPt :
1936
 
  case Hexagon::LDrib_indexed_cPt :
1937
 
  case Hexagon::LDrib_indexed_cdnPt :
1938
 
  case Hexagon::POST_LDrib_cPt :
1939
 
  case Hexagon::POST_LDrib_cdnPt_V4 :
1940
 
  case Hexagon::LDriuh_cPt :
1941
 
  case Hexagon::LDriuh_cdnPt :
1942
 
  case Hexagon::LDriuh_indexed_cPt :
1943
 
  case Hexagon::LDriuh_indexed_cdnPt :
1944
 
  case Hexagon::POST_LDriuh_cPt :
1945
 
  case Hexagon::POST_LDriuh_cdnPt_V4 :
1946
 
  case Hexagon::LDriub_cPt :
1947
 
  case Hexagon::LDriub_cdnPt :
1948
 
  case Hexagon::LDriub_indexed_cPt :
1949
 
  case Hexagon::LDriub_indexed_cdnPt :
1950
 
  case Hexagon::POST_LDriub_cPt :
1951
 
  case Hexagon::POST_LDriub_cdnPt_V4 :
1952
 
  case Hexagon::LDrid_indexed_shl_cPt_V4 :
1953
 
  case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
1954
 
  case Hexagon::LDrib_indexed_shl_cPt_V4 :
1955
 
  case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
1956
 
  case Hexagon::LDriub_indexed_shl_cPt_V4 :
1957
 
  case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
1958
 
  case Hexagon::LDrih_indexed_shl_cPt_V4 :
1959
 
  case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
1960
 
  case Hexagon::LDriuh_indexed_shl_cPt_V4 :
1961
 
  case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
1962
 
  case Hexagon::LDriw_indexed_shl_cPt_V4 :
1963
 
  case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
1964
 
  case Hexagon::ADD_ri_cPt :
1965
 
  case Hexagon::ADD_ri_cdnPt :
1966
 
  case Hexagon::ADD_rr_cPt :
1967
 
  case Hexagon::ADD_rr_cdnPt :
1968
 
  case Hexagon::XOR_rr_cPt :
1969
 
  case Hexagon::XOR_rr_cdnPt :
1970
 
  case Hexagon::AND_rr_cPt :
1971
 
  case Hexagon::AND_rr_cdnPt :
1972
 
  case Hexagon::OR_rr_cPt :
1973
 
  case Hexagon::OR_rr_cdnPt :
1974
 
  case Hexagon::SUB_rr_cPt :
1975
 
  case Hexagon::SUB_rr_cdnPt :
1976
 
  case Hexagon::COMBINE_rr_cPt :
1977
 
  case Hexagon::COMBINE_rr_cdnPt :
1978
 
  case Hexagon::ASLH_cPt_V4 :
1979
 
  case Hexagon::ASLH_cdnPt_V4 :
1980
 
  case Hexagon::ASRH_cPt_V4 :
1981
 
  case Hexagon::ASRH_cdnPt_V4 :
1982
 
  case Hexagon::SXTB_cPt_V4 :
1983
 
  case Hexagon::SXTB_cdnPt_V4 :
1984
 
  case Hexagon::SXTH_cPt_V4 :
1985
 
  case Hexagon::SXTH_cdnPt_V4 :
1986
 
  case Hexagon::ZXTB_cPt_V4 :
1987
 
  case Hexagon::ZXTB_cdnPt_V4 :
1988
 
  case Hexagon::ZXTH_cPt_V4 :
1989
 
  case Hexagon::ZXTH_cdnPt_V4 :
1990
 
  case Hexagon::LDd_GP_cPt_V4 :
1991
 
  case Hexagon::LDb_GP_cPt_V4 :
1992
 
  case Hexagon::LDub_GP_cPt_V4 :
1993
 
  case Hexagon::LDh_GP_cPt_V4 :
1994
 
  case Hexagon::LDuh_GP_cPt_V4 :
1995
 
  case Hexagon::LDw_GP_cPt_V4 :
1996
 
  case Hexagon::STd_GP_cPt_V4 :
1997
 
  case Hexagon::STb_GP_cPt_V4 :
1998
 
  case Hexagon::STh_GP_cPt_V4 :
1999
 
  case Hexagon::STw_GP_cPt_V4 :
2000
 
  case Hexagon::LDd_GP_cdnPt_V4 :
2001
 
  case Hexagon::LDb_GP_cdnPt_V4 :
2002
 
  case Hexagon::LDub_GP_cdnPt_V4 :
2003
 
  case Hexagon::LDh_GP_cdnPt_V4 :
2004
 
  case Hexagon::LDuh_GP_cdnPt_V4 :
2005
 
  case Hexagon::LDw_GP_cdnPt_V4 :
2006
 
  case Hexagon::STd_GP_cdnPt_V4 :
2007
 
  case Hexagon::STb_GP_cdnPt_V4 :
2008
 
  case Hexagon::STh_GP_cdnPt_V4 :
2009
 
  case Hexagon::STw_GP_cdnPt_V4 :
2010
 
    return true;
2011
 
 
2012
 
  case Hexagon::TFR_cNotPt:
2013
 
  case Hexagon::TFR_cdnNotPt:
2014
 
  case Hexagon::TFRI_cNotPt:
2015
 
  case Hexagon::TFRI_cdnNotPt:
2016
 
  case Hexagon::STrib_cNotPt :
2017
 
  case Hexagon::STrib_cdnNotPt_V4 :
2018
 
  case Hexagon::STrib_indexed_cNotPt :
2019
 
  case Hexagon::STrib_indexed_cdnNotPt_V4 :
2020
 
  case Hexagon::STrib_indexed_shl_cNotPt_V4 :
2021
 
  case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
2022
 
  case Hexagon::POST_STbri_cNotPt :
2023
 
  case Hexagon::POST_STbri_cdnNotPt_V4 :
2024
 
  case Hexagon::STrih_cNotPt :
2025
 
  case Hexagon::STrih_cdnNotPt_V4 :
2026
 
  case Hexagon::STrih_indexed_cNotPt :
2027
 
  case Hexagon::STrih_indexed_cdnNotPt_V4 :
2028
 
  case Hexagon::STrih_indexed_shl_cNotPt_V4 :
2029
 
  case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
2030
 
  case Hexagon::POST_SThri_cNotPt :
2031
 
  case Hexagon::POST_SThri_cdnNotPt_V4 :
2032
 
  case Hexagon::STriw_cNotPt :
2033
 
  case Hexagon::STriw_cdnNotPt_V4 :
2034
 
  case Hexagon::STriw_indexed_cNotPt :
2035
 
  case Hexagon::STriw_indexed_cdnNotPt_V4 :
2036
 
  case Hexagon::STriw_indexed_shl_cNotPt_V4 :
2037
 
  case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
2038
 
  case Hexagon::POST_STwri_cNotPt :
2039
 
  case Hexagon::POST_STwri_cdnNotPt_V4 :
2040
 
  case Hexagon::STrib_imm_cNotPt_V4 :
2041
 
  case Hexagon::STrib_imm_cdnNotPt_V4 :
2042
 
  case Hexagon::STrid_cNotPt :
2043
 
  case Hexagon::STrid_cdnNotPt_V4 :
2044
 
  case Hexagon::STrid_indexed_cdnNotPt_V4 :
2045
 
  case Hexagon::STrid_indexed_cNotPt :
2046
 
  case Hexagon::STrid_indexed_shl_cNotPt_V4 :
2047
 
  case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
2048
 
  case Hexagon::POST_STdri_cNotPt :
2049
 
  case Hexagon::POST_STdri_cdnNotPt_V4 :
2050
 
  case Hexagon::STrih_imm_cNotPt_V4 :
2051
 
  case Hexagon::STrih_imm_cdnNotPt_V4 :
2052
 
  case Hexagon::STriw_imm_cNotPt_V4 :
2053
 
  case Hexagon::STriw_imm_cdnNotPt_V4 :
2054
 
  case Hexagon::JMP_cdnNotPt :
2055
 
  case Hexagon::LDrid_cNotPt :
2056
 
  case Hexagon::LDrid_cdnNotPt :
2057
 
  case Hexagon::LDrid_indexed_cNotPt :
2058
 
  case Hexagon::LDrid_indexed_cdnNotPt :
2059
 
  case Hexagon::POST_LDrid_cNotPt :
2060
 
  case Hexagon::POST_LDrid_cdnNotPt_V4 :
2061
 
  case Hexagon::LDriw_cNotPt :
2062
 
  case Hexagon::LDriw_cdnNotPt :
2063
 
  case Hexagon::LDriw_indexed_cNotPt :
2064
 
  case Hexagon::LDriw_indexed_cdnNotPt :
2065
 
  case Hexagon::POST_LDriw_cNotPt :
2066
 
  case Hexagon::POST_LDriw_cdnNotPt_V4 :
2067
 
  case Hexagon::LDrih_cNotPt :
2068
 
  case Hexagon::LDrih_cdnNotPt :
2069
 
  case Hexagon::LDrih_indexed_cNotPt :
2070
 
  case Hexagon::LDrih_indexed_cdnNotPt :
2071
 
  case Hexagon::POST_LDrih_cNotPt :
2072
 
  case Hexagon::POST_LDrih_cdnNotPt_V4 :
2073
 
  case Hexagon::LDrib_cNotPt :
2074
 
  case Hexagon::LDrib_cdnNotPt :
2075
 
  case Hexagon::LDrib_indexed_cNotPt :
2076
 
  case Hexagon::LDrib_indexed_cdnNotPt :
2077
 
  case Hexagon::POST_LDrib_cNotPt :
2078
 
  case Hexagon::POST_LDrib_cdnNotPt_V4 :
2079
 
  case Hexagon::LDriuh_cNotPt :
2080
 
  case Hexagon::LDriuh_cdnNotPt :
2081
 
  case Hexagon::LDriuh_indexed_cNotPt :
2082
 
  case Hexagon::LDriuh_indexed_cdnNotPt :
2083
 
  case Hexagon::POST_LDriuh_cNotPt :
2084
 
  case Hexagon::POST_LDriuh_cdnNotPt_V4 :
2085
 
  case Hexagon::LDriub_cNotPt :
2086
 
  case Hexagon::LDriub_cdnNotPt :
2087
 
  case Hexagon::LDriub_indexed_cNotPt :
2088
 
  case Hexagon::LDriub_indexed_cdnNotPt :
2089
 
  case Hexagon::POST_LDriub_cNotPt :
2090
 
  case Hexagon::POST_LDriub_cdnNotPt_V4 :
2091
 
  case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
2092
 
  case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
2093
 
  case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
2094
 
  case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
2095
 
  case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
2096
 
  case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
2097
 
  case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
2098
 
  case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
2099
 
  case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
2100
 
  case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
2101
 
  case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
2102
 
  case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
2103
 
  case Hexagon::ADD_ri_cNotPt :
2104
 
  case Hexagon::ADD_ri_cdnNotPt :
2105
 
  case Hexagon::ADD_rr_cNotPt :
2106
 
  case Hexagon::ADD_rr_cdnNotPt :
2107
 
  case Hexagon::XOR_rr_cNotPt :
2108
 
  case Hexagon::XOR_rr_cdnNotPt :
2109
 
  case Hexagon::AND_rr_cNotPt :
2110
 
  case Hexagon::AND_rr_cdnNotPt :
2111
 
  case Hexagon::OR_rr_cNotPt :
2112
 
  case Hexagon::OR_rr_cdnNotPt :
2113
 
  case Hexagon::SUB_rr_cNotPt :
2114
 
  case Hexagon::SUB_rr_cdnNotPt :
2115
 
  case Hexagon::COMBINE_rr_cNotPt :
2116
 
  case Hexagon::COMBINE_rr_cdnNotPt :
2117
 
  case Hexagon::ASLH_cNotPt_V4 :
2118
 
  case Hexagon::ASLH_cdnNotPt_V4 :
2119
 
  case Hexagon::ASRH_cNotPt_V4 :
2120
 
  case Hexagon::ASRH_cdnNotPt_V4 :
2121
 
  case Hexagon::SXTB_cNotPt_V4 :
2122
 
  case Hexagon::SXTB_cdnNotPt_V4 :
2123
 
  case Hexagon::SXTH_cNotPt_V4 :
2124
 
  case Hexagon::SXTH_cdnNotPt_V4 :
2125
 
  case Hexagon::ZXTB_cNotPt_V4 :
2126
 
  case Hexagon::ZXTB_cdnNotPt_V4 :
2127
 
  case Hexagon::ZXTH_cNotPt_V4 :
2128
 
  case Hexagon::ZXTH_cdnNotPt_V4 :
2129
 
 
2130
 
  case Hexagon::LDd_GP_cNotPt_V4 :
2131
 
  case Hexagon::LDb_GP_cNotPt_V4 :
2132
 
  case Hexagon::LDub_GP_cNotPt_V4 :
2133
 
  case Hexagon::LDh_GP_cNotPt_V4 :
2134
 
  case Hexagon::LDuh_GP_cNotPt_V4 :
2135
 
  case Hexagon::LDw_GP_cNotPt_V4 :
2136
 
  case Hexagon::STd_GP_cNotPt_V4 :
2137
 
  case Hexagon::STb_GP_cNotPt_V4 :
2138
 
  case Hexagon::STh_GP_cNotPt_V4 :
2139
 
  case Hexagon::STw_GP_cNotPt_V4 :
2140
 
  case Hexagon::LDd_GP_cdnNotPt_V4 :
2141
 
  case Hexagon::LDb_GP_cdnNotPt_V4 :
2142
 
  case Hexagon::LDub_GP_cdnNotPt_V4 :
2143
 
  case Hexagon::LDh_GP_cdnNotPt_V4 :
2144
 
  case Hexagon::LDuh_GP_cdnNotPt_V4 :
2145
 
  case Hexagon::LDw_GP_cdnNotPt_V4 :
2146
 
  case Hexagon::STd_GP_cdnNotPt_V4 :
2147
 
  case Hexagon::STb_GP_cdnNotPt_V4 :
2148
 
  case Hexagon::STh_GP_cdnNotPt_V4 :
2149
 
  case Hexagon::STw_GP_cdnNotPt_V4 :
2150
 
    return false;
2151
 
  }
2152
 
  // return *some value* to avoid compiler warning
2153
 
  return false;
 
455
enum PredicateKind {
 
456
  PK_False,
 
457
  PK_True,
 
458
  PK_Unknown
 
459
};
 
460
 
 
461
/// Returns true if an instruction is predicated on p0 and false if it's
 
462
/// predicated on !p0.
 
463
static PredicateKind getPredicateSense(MachineInstr* MI,
 
464
                                       const HexagonInstrInfo *QII) {
 
465
  if (!QII->isPredicated(MI))
 
466
    return PK_Unknown;
 
467
 
 
468
  if (QII->isPredicatedTrue(MI))
 
469
    return PK_True;
 
470
 
 
471
  return PK_False;
2154
472
}
2155
473
 
2156
474
static MachineOperand& GetPostIncrementOperand(MachineInstr *MI,
2219
537
//    Arch Spec: 3.4.4.2
2220
538
bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
2221
539
                MachineInstr *PacketMI, unsigned DepReg,
2222
 
                std::map <MachineInstr*, SUnit*> MIToSUnit)
2223
 
{
2224
 
  // Make sure we are looking at the store
2225
 
  if (!IsNewifyStore(MI))
 
540
                std::map <MachineInstr*, SUnit*> MIToSUnit) {
 
541
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
 
542
  // Make sure we are looking at the store, that can be promoted.
 
543
  if (!QII->mayBeNewStore(MI))
2226
544
    return false;
2227
545
 
2228
546
  // Make sure there is dependency and can be new value'ed
2230
548
      GetStoreValueOperand(MI).getReg() != DepReg)
2231
549
    return false;
2232
550
 
2233
 
  const HexagonRegisterInfo* QRI = 
 
551
  const HexagonRegisterInfo* QRI =
2234
552
                            (const HexagonRegisterInfo *) TM.getRegisterInfo();
2235
553
  const MCInstrDesc& MCID = PacketMI->getDesc();
2236
554
  // first operand is always the result
2237
555
 
2238
 
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2239
556
  const TargetRegisterClass* PacketRC = QII->getRegClass(MCID, 0, QRI, MF);
2240
557
 
2241
558
  // if there is already an store in the packet, no can do new value store
2278
595
  }
2279
596
 
2280
597
  // If the source that feeds the store is predicated, new value store must
2281
 
  // also be also predicated.
 
598
  // also be predicated.
2282
599
  if (QII->isPredicated(PacketMI)) {
2283
600
    if (!QII->isPredicated(MI))
2284
601
      return false;
2324
641
 
2325
642
    if (( predRegNumDst != predRegNumSrc) ||
2326
643
          QII->isDotNewInst(PacketMI) != QII->isDotNewInst(MI)  ||
2327
 
          GetPredicateSense(MI, QII) != GetPredicateSense(PacketMI, QII)) {
 
644
          getPredicateSense(MI, QII) != getPredicateSense(PacketMI, QII)) {
2328
645
      return false;
2329
646
    }
2330
647
  }
2405
722
                MachineBasicBlock::iterator &MII)
2406
723
{
2407
724
 
 
725
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2408
726
  const HexagonRegisterInfo* QRI =
2409
727
                            (const HexagonRegisterInfo *) TM.getRegisterInfo();
2410
728
  if (!QRI->Subtarget.hasV4TOps() ||
2411
 
      !IsNewifyStore(MI))
 
729
      !QII->mayBeNewStore(MI))
2412
730
    return false;
2413
731
 
2414
732
  MachineInstr *PacketMI = PacketSU->getInstr();
2435
753
{
2436
754
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2437
755
  // Already a dot new instruction.
2438
 
  if (QII->isDotNewInst(MI) && !IsNewifyStore(MI))
 
756
  if (QII->isDotNewInst(MI) && !QII->mayBeNewStore(MI))
2439
757
    return false;
2440
758
 
2441
759
  if (!isNewifiable(MI))
2445
763
  if (RC == &Hexagon::PredRegsRegClass && isCondInst(MI))
2446
764
      return true;
2447
765
  else if (RC != &Hexagon::PredRegsRegClass &&
2448
 
      !IsNewifyStore(MI)) // MI is not a new-value store
 
766
      !QII->mayBeNewStore(MI)) // MI is not a new-value store
2449
767
    return false;
2450
768
  else {
2451
769
    // Create a dot new machine instruction to see if resources can be
2452
770
    // allocated. If not, bail out now.
2453
 
    int NewOpcode = GetDotNewOp(MI->getOpcode());
 
771
    int NewOpcode = QII->GetDotNewOp(MI);
2454
772
    const MCInstrDesc &desc = QII->get(NewOpcode);
2455
773
    DebugLoc dl;
2456
774
    MachineInstr *NewMI =
2519
837
}
2520
838
 
2521
839
 
 
840
/// Gets the predicate register of a predicated instruction.
 
841
static unsigned getPredicatedRegister(MachineInstr *MI,
 
842
                                      const HexagonInstrInfo *QII) {
 
843
  /// We use the following rule: The first predicate register that is a use is
 
844
  /// the predicate register of a predicated instruction.
 
845
 
 
846
  assert(QII->isPredicated(MI) && "Must be predicated instruction");
 
847
 
 
848
  for (MachineInstr::mop_iterator OI = MI->operands_begin(),
 
849
       OE = MI->operands_end(); OI != OE; ++OI) {
 
850
    MachineOperand &Op = *OI;
 
851
    if (Op.isReg() && Op.getReg() && Op.isUse() &&
 
852
        Hexagon::PredRegsRegClass.contains(Op.getReg()))
 
853
      return Op.getReg();
 
854
  }
 
855
 
 
856
  llvm_unreachable("Unknown instruction operand layout");
 
857
 
 
858
  return 0;
 
859
}
 
860
 
2522
861
// Given two predicated instructions, this function detects whether
2523
862
// the predicates are complements
2524
863
bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
2525
864
     MachineInstr* MI2, std::map <MachineInstr*, SUnit*> MIToSUnit) {
2526
865
 
2527
866
  const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2528
 
  // Currently can only reason about conditional transfers
2529
 
  if (!QII->isConditionalTransfer(MI1) || !QII->isConditionalTransfer(MI2)) {
 
867
 
 
868
  // If we don't know the predicate sense of the instructions bail out early, we
 
869
  // need it later.
 
870
  if (getPredicateSense(MI1, QII) == PK_Unknown ||
 
871
      getPredicateSense(MI2, QII) == PK_Unknown)
2530
872
    return false;
2531
 
  }
2532
873
 
2533
874
  // Scheduling unit for candidate
2534
875
  SUnit* SU = MIToSUnit[MI1];
2567
908
        // there already exist anti dep on the same pred in
2568
909
        // the packet.
2569
910
        if (PacketSU->Succs[i].getSUnit() == SU &&
 
911
            PacketSU->Succs[i].getKind() == SDep::Data &&
2570
912
            Hexagon::PredRegsRegClass.contains(
2571
913
              PacketSU->Succs[i].getReg()) &&
2572
 
            PacketSU->Succs[i].getKind() == SDep::Data &&
2573
914
            // Here I know that *VIN is predicate setting instruction
2574
915
            // with true data dep to candidate on the register
2575
916
            // we care about - c) in the above example.
2590
931
  // that the predicate sense is different
2591
932
  // We also need to differentiate .old vs. .new:
2592
933
  // !p0 is not complimentary to p0.new
2593
 
  return ((MI1->getOperand(1).getReg() == MI2->getOperand(1).getReg()) &&
2594
 
          (GetPredicateSense(MI1, QII) != GetPredicateSense(MI2, QII)) &&
 
934
  unsigned PReg1 = getPredicatedRegister(MI1, QII);
 
935
  unsigned PReg2 = getPredicatedRegister(MI2, QII);
 
936
  return ((PReg1 == PReg2) &&
 
937
          Hexagon::PredRegsRegClass.contains(PReg1) &&
 
938
          Hexagon::PredRegsRegClass.contains(PReg2) &&
 
939
          (getPredicateSense(MI1, QII) != getPredicateSense(MI2, QII)) &&
2595
940
          (QII->isDotNewInst(MI1) == QII->isDotNewInst(MI2)));
2596
941
}
2597
942
 
2689
1034
  }
2690
1035
 
2691
1036
  // A LoopN instruction cannot appear in the same packet as a jump or call.
2692
 
  if (IsLoopN(I) && (   IsDirectJump(J)
2693
 
                     || MCIDJ.isCall()
2694
 
                     || QII->isDeallocRet(J))) {
 
1037
  if (IsLoopN(I) &&
 
1038
     (IsDirectJump(J) || MCIDJ.isCall() || QII->isDeallocRet(J))) {
2695
1039
    Dependence = true;
2696
1040
    return false;
2697
1041
  }
2698
 
  if (IsLoopN(J) && (   IsDirectJump(I)
2699
 
                     || MCIDI.isCall()
2700
 
                     || QII->isDeallocRet(I))) {
 
1042
  if (IsLoopN(J) &&
 
1043
     (IsDirectJump(I) || MCIDI.isCall() || QII->isDeallocRet(I))) {
2701
1044
    Dependence = true;
2702
1045
    return false;
2703
1046
  }
2704
1047
 
2705
1048
  // dealloc_return cannot appear in the same packet as a conditional or
2706
1049
  // unconditional jump.
2707
 
  if (QII->isDeallocRet(I) && (   MCIDJ.isBranch()
2708
 
                               || MCIDJ.isCall()
2709
 
                               || MCIDJ.isBarrier())) {
 
1050
  if (QII->isDeallocRet(I) &&
 
1051
     (MCIDJ.isBranch() || MCIDJ.isCall() || MCIDJ.isBarrier())) {
2710
1052
    Dependence = true;
2711
1053
    return false;
2712
1054
  }
2731
1073
    }
2732
1074
 
2733
1075
    //if dealloc_return
2734
 
    if (MCIDJ.mayStore() && QII->isDeallocRet(I)){
 
1076
    if (MCIDJ.mayStore() && QII->isDeallocRet(I)) {
2735
1077
      Dependence = true;
2736
1078
      return false;
2737
1079
    }
2739
1081
    // If an instruction feeds new value jump, glue it.
2740
1082
    MachineBasicBlock::iterator NextMII = I;
2741
1083
    ++NextMII;
2742
 
    MachineInstr *NextMI = NextMII;
2743
 
 
2744
 
    if (QII->isNewValueJump(NextMI)) {
 
1084
    if (NextMII != I->getParent()->end() && QII->isNewValueJump(NextMII)) {
 
1085
      MachineInstr *NextMI = NextMII;
2745
1086
 
2746
1087
      bool secondRegMatch = false;
2747
1088
      bool maintainNewValueJump = false;