Skip to content

Commit

Permalink
[ARM] Add MVE vector load/store instructions.
Browse files Browse the repository at this point in the history
This adds the rest of the vector memory access instructions. It
includes contiguous loads/stores, with an ordinary addressing mode
such as [r0,#offset] (plus writeback variants); gather loads and
scatter stores with a scalar base address register and a vector of
offsets from it (written [r0,q1] or similar); and gather/scatters with
a vector of base addresses (written [q0,#offset], again with
writeback). Additionally, some of the loads can widen each loaded
value into a larger vector lane, and the corresponding stores narrow
them again.

To implement these, we also have to add the addressing modes they
need. Also, in AsmParser, the `isMem` query function now has
subqueries `isGPRMem` and `isMVEMem`, according to which kind of base
register is used by a given memory access operand.

I've also had to add an extra check in `checkTargetMatchPredicate` in
the AsmParser, without which our last-minute check of `rGPR` register
operands against SP and PC was failing an assertion because Tablegen
had inserted an immediate 0 in place of one of a pair of tied register
operands. (This matches the way the corresponding check for `MCK_rGPR`
in `validateTargetOperandClass` is guarded.) Apparently the MVE load
instructions were the first to have ever triggered this assertion, but
I think only because they were the first to have a combination of the
usual Arm pre/post writeback system and the `rGPR` class in particular.

Reviewers: dmgreen, samparker, SjoerdMeijer, t.p.northover

Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62680

llvm-svn: 364291
  • Loading branch information
statham-arm committed Jun 25, 2019
1 parent 49b3778 commit e682416
Show file tree
Hide file tree
Showing 15 changed files with 4,371 additions and 60 deletions.
5 changes: 4 additions & 1 deletion llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Expand Up @@ -2477,11 +2477,14 @@ bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
NumBits = 8;
Scale = 2;
break;
case ARMII::AddrModeT2_i7:
case ARMII::AddrModeT2_i7s2:
case ARMII::AddrModeT2_i7s4:
ImmIdx = FrameRegIdx+1;
InstrOffs = MI.getOperand(ImmIdx).getImm();
NumBits = 7;
Scale = 4;
Scale = (AddrMode == ARMII::AddrModeT2_i7s2 ? 2 :
AddrMode == ARMII::AddrModeT2_i7s4 ? 4 : 1);
break;
default:
llvm_unreachable("Unsupported addressing mode!");
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/ARM/ARMInstrFormats.td
Expand Up @@ -110,6 +110,8 @@ def AddrMode_i12 : AddrMode<16>;
def AddrMode5FP16 : AddrMode<17>;
def AddrModeT2_ldrex : AddrMode<18>;
def AddrModeT2_i7s4 : AddrMode<19>;
def AddrModeT2_i7s2 : AddrMode<20>;
def AddrModeT2_i7 : AddrMode<21>;

// Load / store index mode.
class IndexMode<bits<2> val> {
Expand Down
9 changes: 9 additions & 0 deletions llvm/lib/Target/ARM/ARMInstrInfo.td
Expand Up @@ -1234,6 +1234,15 @@ def addr_offset_none : MemOperand,
let MIOperandInfo = (ops GPR:$base);
}

// t_addr_offset_none := reg [r0-r7]
def MemNoOffsetTAsmOperand : AsmOperandClass { let Name = "MemNoOffsetT"; }
def t_addr_offset_none : MemOperand {
let PrintMethod = "printAddrMode7Operand";
let DecoderMethod = "DecodetGPRRegisterClass";
let ParserMatchClass = MemNoOffsetTAsmOperand;
let MIOperandInfo = (ops tGPR:$base);
}

def nohash_imm : Operand<i32> {
let PrintMethod = "printNoHashImmediate";
}
Expand Down

0 comments on commit e682416

Please sign in to comment.