[llvm] [X86] Support lowering for APX promoted BMI instructions. (PR #77433)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 05:12:37 PST 2024


================
@@ -955,32 +913,53 @@ let Predicates = [HasBMI2] in {
   //  shlx %al, (%ecx), %esi
   //
   // This priority is enforced by IsProfitableToFoldLoad.
-  def : Pat<(sra (loadi32 addr:$src1), GR8:$src2),
-            (SARX32rm addr:$src1,
+  def : Pat<(op (loadi32 addr:$src1), GR8:$src2),
+            (!cast<Instruction>(NAME#"32rm"#suffix) addr:$src1,
                       (INSERT_SUBREG
                         (i32 (IMPLICIT_DEF)), GR8:$src2, sub_8bit))>;
-  def : Pat<(sra (loadi64 addr:$src1), GR8:$src2),
-            (SARX64rm addr:$src1,
+  def : Pat<(op (loadi64 addr:$src1), GR8:$src2),
+            (!cast<Instruction>(NAME#"64rm"#suffix) addr:$src1,
                       (INSERT_SUBREG
                         (i64 (IMPLICIT_DEF)), GR8:$src2, sub_8bit))>;
+}
 
-  def : Pat<(srl (loadi32 addr:$src1), GR8:$src2),
-            (SHRX32rm addr:$src1,
-                      (INSERT_SUBREG
-                        (i32 (IMPLICIT_DEF)), GR8:$src2, sub_8bit))>;
-  def : Pat<(srl (loadi64 addr:$src1), GR8:$src2),
-            (SHRX64rm addr:$src1,
-                      (INSERT_SUBREG
-                        (i64 (IMPLICIT_DEF)), GR8:$src2, sub_8bit))>;
+multiclass RORX_Pats<string suffix> {
----------------
RKSimon wrote:

`rorx_pats`

https://github.com/llvm/llvm-project/pull/77433


More information about the llvm-commits mailing list