[llvm] r334563 - [X86] Mark all instructions that have masked store semantics with NotMemoryFoldable. Remove dependency on SchedRW from memory table autogenerator.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 17:04:08 PDT 2018
Author: ctopper
Date: Tue Jun 12 17:04:08 2018
New Revision: 334563
URL: http://llvm.org/viewvc/llvm-project?rev=334563&view=rev
Log:
[X86] Mark all instructions that have masked store semantics with NotMemoryFoldable. Remove dependency on SchedRW from memory table autogenerator.
Previously we were whitelisting in instructions based on their SchedRW value. With the masked store instructions explicitly removed via NotMemoryFoldable, we don't seem to need this check anymore.
Modified:
llvm/trunk/lib/Target/X86/X86InstrAVX512.td
llvm/trunk/utils/TableGen/X86FoldTablesEmitter.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstrAVX512.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrAVX512.td?rev=334563&r1=334562&r2=334563&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrAVX512.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrAVX512.td Tue Jun 12 17:04:08 2018
@@ -835,7 +835,7 @@ multiclass vextract_for_size_split<int O
"vextract" # To.EltTypeName # "x" # To.NumElts #
"\t{$idx, $src1, $dst {${mask}}|"
"$dst {${mask}}, $src1, $idx}", []>,
- EVEX_K, EVEX, Sched<[SchedMR]>;
+ EVEX_K, EVEX, Sched<[SchedMR]>, NotMemoryFoldable;
}
}
@@ -3385,7 +3385,8 @@ multiclass avx512_store<bits<8> opc, str
def mrk : AVX512PI<opc, MRMDestMem, (outs),
(ins _.MemOp:$dst, _.KRCWM:$mask, _.RC:$src),
OpcodeStr # "\t{$src, ${dst} {${mask}}|${dst} {${mask}}, $src}",
- [], _.ExeDomain>, EVEX, EVEX_K, Sched<[Sched.MR]>;
+ [], _.ExeDomain>, EVEX, EVEX_K, Sched<[Sched.MR]>,
+ NotMemoryFoldable;
def: Pat<(mstore addr:$ptr, _.KRCWM:$mask, (_.VT _.RC:$src)),
(!cast<Instruction>(BaseName#_.ZSuffix##mrk) addr:$ptr,
@@ -3889,7 +3890,8 @@ multiclass avx512_move_scalar<string asm
def mrk: AVX512PI<0x11, MRMDestMem, (outs),
(ins _.ScalarMemOp:$dst, VK1WM:$mask, _.FRC:$src),
!strconcat(asm, "\t{$src, $dst {${mask}}|$dst {${mask}}, $src}"),
- [], _.ExeDomain>, EVEX, EVEX_K, Sched<[WriteFStore]>;
+ [], _.ExeDomain>, EVEX, EVEX_K, Sched<[WriteFStore]>,
+ NotMemoryFoldable;
}
defm VMOVSSZ : avx512_move_scalar<"vmovss", X86Movss, f32x_info>,
@@ -8052,7 +8054,7 @@ multiclass avx512_cvtps2ph<X86VectorVTIn
def mrk : AVX512AIi8<0x1D, MRMDestMem, (outs),
(ins x86memop:$dst, _dest.KRCWM:$mask, _src.RC:$src1, i32u8imm:$src2),
"vcvtps2ph\t{$src2, $src1, $dst {${mask}}|$dst {${mask}}, $src1, $src2}", []>,
- EVEX_K, Sched<[MR]>;
+ EVEX_K, Sched<[MR]>, NotMemoryFoldable;
}
}
@@ -8644,8 +8646,8 @@ multiclass avx512_trunc_common<bits<8> o
def mrk : AVX512XS8I<opc, MRMDestMem, (outs),
(ins x86memop:$dst, SrcInfo.KRCWM:$mask, SrcInfo.RC:$src),
OpcodeStr # "\t{$src, $dst {${mask}}|$dst {${mask}}, $src}", []>,
- EVEX, EVEX_K, Sched<[sched.Folded]>;
- }//mayStore = 1, mayLoad = 1, hasSideEffects = 0
+ EVEX, EVEX_K, Sched<[sched.Folded]>, NotMemoryFoldable;
+ }//mayStore = 1, hasSideEffects = 0
}
multiclass avx512_trunc_mr_lowering<X86VectorVTInfo SrcInfo,
Modified: llvm/trunk/utils/TableGen/X86FoldTablesEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86FoldTablesEmitter.cpp?rev=334563&r1=334562&r2=334563&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/X86FoldTablesEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/X86FoldTablesEmitter.cpp Tue Jun 12 17:04:08 2018
@@ -251,16 +251,6 @@ getMemOperandSize(const Record *MemRec,
llvm_unreachable("Memory operand's size not known!");
}
-// Returns true if the record's list of defs includes the given def.
-static inline bool hasDefInList(const Record *Rec, const StringRef List,
- const StringRef Def) {
- if (!Rec->isValueUnset(List)) {
- return any_of(*(Rec->getValueAsListInit(List)),
- [Def](const Init *I) { return I->getAsString() == Def; });
- }
- return false;
-}
-
// Return true if the instruction defined as a register flavor.
static inline bool hasRegisterFormat(const Record *Inst) {
const BitsInit *FormBits = Inst->getValueAsBitsInit("FormBits");
@@ -515,12 +505,8 @@ void X86FoldTablesEmitter::updateTables(
unsigned MemInSize = MemRec->getValueAsDag("InOperandList")->getNumArgs();
unsigned RegInSize = RegRec->getValueAsDag("InOperandList")->getNumArgs();
- // Instructions which have the WriteRMW value (Read-Modify-Write) should be
- // added to Table2Addr.
- if ((hasDefInList(MemRec, "SchedRW", "WriteRMW") ||
- hasDefInList(MemRec, "SchedRW", "WriteADCRMW") ||
- hasDefInList(MemRec, "SchedRW", "WriteALURMW")) &&
- MemOutSize != RegOutSize && MemInSize == RegInSize) {
+ // Instructions which Read-Modify-Write should be added to Table2Addr.
+ if (MemOutSize != RegOutSize && MemInSize == RegInSize) {
addEntryWithFlags(Table2Addr, RegInstr, MemInstr, S, 0);
return;
}
More information about the llvm-commits
mailing list