[Hexagon] Recognize and handle :endloop01

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328870 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Krzysztof Parzyszek 2018-03-30 15:29:47 +00:00
parent ce765af4ed
commit 208f6d8a9a
4 changed files with 34 additions and 16 deletions

View File

@ -506,16 +506,19 @@ bool HexagonAsmParser::matchBundleOptions() {
"supported with this architecture";
StringRef Option = Parser.getTok().getString();
auto IDLoc = Parser.getTok().getLoc();
if (Option.compare_lower("endloop0") == 0)
if (Option.compare_lower("endloop01") == 0) {
HexagonMCInstrInfo::setInnerLoop(MCB);
else if (Option.compare_lower("endloop1") == 0)
HexagonMCInstrInfo::setOuterLoop(MCB);
else if (Option.compare_lower("mem_noshuf") == 0)
} else if (Option.compare_lower("endloop0") == 0) {
HexagonMCInstrInfo::setInnerLoop(MCB);
} else if (Option.compare_lower("endloop1") == 0) {
HexagonMCInstrInfo::setOuterLoop(MCB);
} else if (Option.compare_lower("mem_noshuf") == 0) {
if (getSTI().getFeatureBits()[Hexagon::FeatureMemNoShuf])
HexagonMCInstrInfo::setMemReorderDisabled(MCB);
else
return getParser().Error(IDLoc, MemNoShuffMsg);
else
} else
return getParser().Error(IDLoc, llvm::Twine("'") + Option +
"' is not a valid bundle option");
Lex();

View File

@ -102,6 +102,13 @@ def ENDLOOP1 : Endloop<(outs), (ins b30_2Imm:$offset),
[]>;
}
let isBranch = 1, isTerminator = 1, hasSideEffects = 0,
Defs = [PC, LC0, LC1], Uses = [SA0, SA1, LC0, LC1] in {
def ENDLOOP01 : Endloop<(outs), (ins b30_2Imm:$offset),
":endloop01",
[]>;
}
let isExtendable = 1, isExtentSigned = 1, opExtentBits = 9, opExtentAlign = 2,
opExtendable = 0, hasSideEffects = 0 in
class LOOP_iBase<string mnemonic, InstHexagon rootInst>

View File

@ -69,16 +69,17 @@ void HexagonInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
OS << "\n";
}
auto Separator = "";
if (HexagonMCInstrInfo::isInnerLoop(*MI)) {
OS << Separator;
Separator = " ";
MCInst ME;
ME.setOpcode(Hexagon::ENDLOOP0);
printInstruction(&ME, OS);
}
if (HexagonMCInstrInfo::isOuterLoop(*MI)) {
OS << Separator;
if (HexagonMCInstrInfo::isOuterLoop(*MI)) {
MCInst ME;
ME.setOpcode(Hexagon::ENDLOOP01);
printInstruction(&ME, OS);
} else {
MCInst ME;
ME.setOpcode(Hexagon::ENDLOOP0);
printInstruction(&ME, OS);
}
} else if (HexagonMCInstrInfo::isOuterLoop(*MI)) {
MCInst ME;
ME.setOpcode(Hexagon::ENDLOOP1);
printInstruction(&ME, OS);

View File

@ -11,6 +11,10 @@
{ R0 = mpyi(R0,R0) } : ENDLOOP1
{ R0 = mpyi(R0,R0) }:endloop1
{ R0 = mpyi(R0,R0) } : endloop01
{ R0 = mpyi(R0,R0) } : ENDLOOP01
{ R0 = mpyi(R0,R0) }:endloop01
{ R0 = mpyi(R0,R0) } : endloop0 : endloop1
{ R0 = mpyi(R0,R0) } : ENDLOOP0 : ENDLOOP1
{ R0 = mpyi(R0,R0) }:endloop0:endloop1
@ -22,8 +26,11 @@
# CHECK: :endloop1
# CHECK: :endloop1
# CHECK: :endloop1
# CHECK: :endloop0 :endloop1
# CHECK: :endloop0 :endloop1
# CHECK: :endloop0 :endloop1
# CHECK: :endloop01
# CHECK: :endloop01
# CHECK: :endloop01
# CHECK: :endloop01
# CHECK: :endloop01
# CHECK: :endloop01