[PATCH] D27901: [X86][[AVX512] Code size reduction in X86 by replacing EVEX with VEX encoding
Gadi Haber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 01:03:35 PST 2016
gadi.haber marked 2 inline comments as done.
gadi.haber added inline comments.
================
Comment at: lib/Target/X86/X86EvexToVex.cpp:105
+ TII = MF.getSubtarget<X86Subtarget>().getInstrInfo();
+ MachineBasicBlock &FirstMBB = MF.front();
+ bool rc = false;
----------------
zvi wrote:
> What if MF is empty?
Added a check:
if (!MF)
return false;
================
Comment at: lib/Target/X86/X86EvexToVex.cpp:206
+
+ if (X86::VR256RegClass.contains(Reg) ||
+ X86::VR128RegClass.contains(Reg))
----------------
craig.topper wrote:
> delena wrote:
> > craig.topper wrote:
> > > gadi.haber wrote:
> > > > craig.topper wrote:
> > > > > Can we use TargetRegisterInfo::getRegEncoding() to simplify this?
> > > > I can simplify the code by defining a lambda function called isAVX512RegOnly(unsigned Reg) and use it to check on the Reg operand to be between X86::ZMM0 and X86::ZMM31 or between X86::YMM16 and X86::YMM31 or between X86:XMM16 and X86::XMM31 as follows:
> > > >
> > > > auto isAVX512RegOnly = [](unsigned Reg) {
> > > > if (Reg >= X86::ZMM0 && Reg <= X86::ZMM31)
> > > > return true;
> > > >
> > > > if (Reg >= X86::XMM16 && Reg <= X86::XMM31)
> > > > return true;
> > > >
> > > > if (Reg >= X86::YMM16 && Reg <= X86::YMM31)
> > > > return true;
> > > >
> > > > return false;
> > > > };
> > > >
> > > >
> > > >
> > > Is it even possible to get a VR512 on any of the instructions in the table? The register class is tightly bound to the instruction.
> > >
> > > For XMM/YMM, getRegEncoding would return 0-31 and you can just check that.
> > I can't find any getRegEncoding() method, do you mean to write a new one?
> Sorry, it's getEncodingValue().
True. There shouldn't be any VR512 registers in the EVEX to VEX tables.
This is an additional safety check.
Repository:
rL LLVM
https://reviews.llvm.org/D27901
More information about the llvm-commits
mailing list