[PATCH] D47453: [X86] Emit BZHI when mask is ~(-1 << nbits))

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 14:22:35 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Target/X86/X86InstrInfo.td:2445
 
-  def : Pat<(and (loadi32 addr:$src), (add (shl 1, GR8:$lz), -1)),
-            (BZHI32rm addr:$src,
-              (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+  multiclass bmi_bzhi_patterns<RegisterClass RC, int bitwidth, Intrinsic Int,
+                               Intrinsic DstInt, X86MemOperand x86memop,
----------------
craig.topper wrote:
> I'm thorougly confused as to how this many arguments are "Intrinsic". I wouldn't have expected that to work unless Intrinsic is very loosely defined. DstMemInt and DstInt should be of type "Instruction".  And they should probably be DstMemInst and DstInst. I think "Int" should be of type ValueType and renamed to VT.
> I'm thorougly confused as to how this many arguments are "Intrinsic". 

I'm super confused by this too.
I'm not quite familiar with this, and there does not seem to be any documentation,
so i'm writing this via the copy-paste method :/
Naturally, the results are rather suboptimal.

But even then, this is still backwards. We want to define input patterns,
and then define the output pattern, as sub-class. But i guess that can be done later.


Repository:
  rL LLVM

https://reviews.llvm.org/D47453





More information about the llvm-commits mailing list