[llvm] r206885 - [X86] Require HasBMI2 for the new BZHI tablegen patterns.

Lang Hames lhames at gmail.com
Tue Apr 22 05:04:54 PDT 2014


Author: lhames
Date: Tue Apr 22 07:04:53 2014
New Revision: 206885

URL: http://llvm.org/viewvc/llvm-project?rev=206885&view=rev
Log:
[X86] Require HasBMI2 for the new BZHI tablegen patterns.

Evidently tablegen doesn't infer this from the HasBMI2 predicate on the BZHI
instructions. This should fix the recent bot failures.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.td

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=206885&r1=206884&r2=206885&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Apr 22 07:04:53 2014
@@ -2113,26 +2113,28 @@ def BZHIMask : ImmLeaf<i64, [{
   return isMask_64(Imm) && (CountTrailingOnes_64(Imm) > 32);
 }]>;
 
-def : Pat<(and GR64:$src, BZHIMask:$mask),
-          (BZHI64rr GR64:$src,
-            (INSERT_SUBREG (i64 (IMPLICIT_DEF)),
-                           (MOV8ri (CountTrailingOnes imm:$mask)), sub_8bit))>;
-
-def : Pat<(and GR32:$src, (add (shl 1, GR8:$lz), -1)),
-          (BZHI32rr GR32:$src,
-            (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
-
-def : Pat<(and (loadi32 addr:$src), (add (shl 1, GR8:$lz), -1)),
-          (BZHI32rm addr:$src,
-            (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
-
-def : Pat<(and GR64:$src, (add (shl 1, GR8:$lz), -1)),
-          (BZHI64rr GR64:$src,
-            (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
-
-def : Pat<(and (loadi64 addr:$src), (add (shl 1, GR8:$lz), -1)),
-          (BZHI64rm addr:$src,
-            (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+let Predicates = [HasBMI2] in {
+  def : Pat<(and GR64:$src, BZHIMask:$mask),
+            (BZHI64rr GR64:$src,
+              (INSERT_SUBREG (i64 (IMPLICIT_DEF)),
+                             (MOV8ri (CountTrailingOnes imm:$mask)), sub_8bit))>;
+
+  def : Pat<(and GR32:$src, (add (shl 1, GR8:$lz), -1)),
+            (BZHI32rr GR32:$src,
+              (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+
+  def : Pat<(and (loadi32 addr:$src), (add (shl 1, GR8:$lz), -1)),
+            (BZHI32rm addr:$src,
+              (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+
+  def : Pat<(and GR64:$src, (add (shl 1, GR8:$lz), -1)),
+            (BZHI64rr GR64:$src,
+              (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+
+  def : Pat<(and (loadi64 addr:$src), (add (shl 1, GR8:$lz), -1)),
+            (BZHI64rm addr:$src,
+              (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR8:$lz, sub_8bit))>;
+} // HasBMI2
 
 let Predicates = [HasBMI] in {
   def : Pat<(X86bextr GR32:$src1, GR32:$src2),





More information about the llvm-commits mailing list