[llvm-branch-commits] [llvm] 0cbceed - [TableGen][ARM][X86] Detect combining IntrReadMem and IntrWriteMem.

Craig Topper via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Dec 19 15:01:21 PST 2020


Author: Craig Topper
Date: 2020-12-19T14:56:17-08:00
New Revision: 0cbceed27c491ebd185e1f53bd0f43ce655efceb

URL: https://github.com/llvm/llvm-project/commit/0cbceed27c491ebd185e1f53bd0f43ce655efceb
DIFF: https://github.com/llvm/llvm-project/commit/0cbceed27c491ebd185e1f53bd0f43ce655efceb.diff

LOG: [TableGen][ARM][X86] Detect combining IntrReadMem and IntrWriteMem.

These properties aren't additive. They are closer to ReadOnly and
WriteOnly. The default is ReadWrite. ReadMem cancels the write property and
WriteMem cancels the read property. Combining them leaves neither.

This patch checks that when we process WriteMem, the Mod flag is
still set. And for ReadMem we check that the Ref flag set still set.

I've updated 2 target intrinsics that were combining these properties.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D93571

Added: 
    

Modified: 
    llvm/include/llvm/IR/IntrinsicsARM.td
    llvm/include/llvm/IR/IntrinsicsX86.td
    llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Barcelona/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/BdVer2/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/BdVer2/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Broadwell/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/Broadwell/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/BtVer2/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/BtVer2/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/BtVer2/stmxcsr-ldmxcsr.s
    llvm/test/tools/llvm-mca/X86/Generic/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/Generic/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Haswell/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/Haswell/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Haswell/stmxcsr-ldmxcsr.s
    llvm/test/tools/llvm-mca/X86/SLM/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/SandyBridge/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/SandyBridge/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Znver1/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
    llvm/test/tools/llvm-mca/X86/Znver2/resources-avx1.s
    llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
    llvm/utils/TableGen/CodeGenTarget.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IntrinsicsARM.td b/llvm/include/llvm/IR/IntrinsicsARM.td
index 052dd7c813bc..edc84a54ccc2 100644
--- a/llvm/include/llvm/IR/IntrinsicsARM.td
+++ b/llvm/include/llvm/IR/IntrinsicsARM.td
@@ -817,9 +817,7 @@ def int_arm_neon_vcadd_rot90  : Neon_2Arg_Intrinsic;
 def int_arm_neon_vcadd_rot270 : Neon_2Arg_Intrinsic;
 
 // GNU eabi mcount
-def int_arm_gnu_eabi_mcount : Intrinsic<[],
-                                    [],
-                                    [IntrReadMem, IntrWriteMem]>;
+def int_arm_gnu_eabi_mcount : Intrinsic<[], [], []>;
 
 def int_arm_mve_pred_i2v : Intrinsic<
   [llvm_anyvector_ty], [llvm_i32_ty], [IntrNoMem]>;

diff  --git a/llvm/include/llvm/IR/IntrinsicsX86.td b/llvm/include/llvm/IR/IntrinsicsX86.td
index d0503d15824a..ebd713098b35 100644
--- a/llvm/include/llvm/IR/IntrinsicsX86.td
+++ b/llvm/include/llvm/IR/IntrinsicsX86.td
@@ -283,11 +283,10 @@ let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
                          IntrHasSideEffects]>;
   def int_x86_sse_ldmxcsr :
               Intrinsic<[], [llvm_ptr_ty],
-                        [IntrReadMem, IntrArgMemOnly, IntrHasSideEffects,
                          // FIXME: LDMXCSR does not actually write to memory,
-                         // but Fast and DAG Isel both use writing to memory
-                         // as a proxy for having side effects.
-                         IntrWriteMem]>;
+                         // but intrinsic properties are generated incorrectly
+                         // for IntrReadMem+IntrHasSideEffects.
+                        [/*IntrReadMem,*/ IntrArgMemOnly, IntrHasSideEffects]>;
 }
 
 // Misc.

diff  --git a/llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
index cf07069aa61b..2579663c2d02 100644
--- a/llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Atom/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      70    35.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      34    17.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      34    17.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      5     2.50    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      5     2.50    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      5     5.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      5     5.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Barcelona/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Barcelona/resources-sse1.s
index 5fcb1979c74a..580b3608e8e7 100644
--- a/llvm/test/tools/llvm-mca/X86/Barcelona/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Barcelona/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      14    14.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  4      5     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  4      5     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      9     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/BdVer2/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/BdVer2/resources-avx1.s
index daa16fa7d939..c3ba739e4d12 100644
--- a/llvm/test/tools/llvm-mca/X86/BdVer2/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/BdVer2/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  1      7     1.50    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      5     1.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  2      5     1.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  1      5     0.50    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  1      5     0.50    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.50    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  1      6     2.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      6     2.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/BdVer2/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/BdVer2/resources-sse1.s
index 700a6d0d2012..daa097eb3a7c 100644
--- a/llvm/test/tools/llvm-mca/X86/BdVer2/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/BdVer2/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      14    4.50    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      9     4.50                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      14    4.50    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      5     0.50    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      5     0.50    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      2     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      2     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      7     1.50    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-avx1.s
index 748aa541010a..bc98992d516b 100644
--- a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      6     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      5     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  3      7     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  2      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  3      7     2.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  3      8     2.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-sse1.s
index 830ea95de232..317ec022c645 100644
--- a/llvm/test/tools/llvm-mca/X86/Broadwell/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Broadwell/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      16    5.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      11    3.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      16    5.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      8     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/BtVer2/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/BtVer2/resources-avx1.s
index 636d236678cf..c1a72df6a7c6 100644
--- a/llvm/test/tools/llvm-mca/X86/BtVer2/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/BtVer2/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  1      6     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      5     1.00    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  2      5     2.00    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  1      3     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  1      3     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  63     34    21.00   *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  1      6     1.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      6     2.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/BtVer2/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/BtVer2/resources-sse1.s
index 07efac54c5dd..f51bac6a5dbf 100644
--- a/llvm/test/tools/llvm-mca/X86/BtVer2/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/BtVer2/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      24    19.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      19    19.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      24    19.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      3     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      3     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     0.50    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      2     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      7     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/BtVer2/stmxcsr-ldmxcsr.s b/llvm/test/tools/llvm-mca/X86/BtVer2/stmxcsr-ldmxcsr.s
index 52bf97732d95..131bf50b77b5 100644
--- a/llvm/test/tools/llvm-mca/X86/BtVer2/stmxcsr-ldmxcsr.s
+++ b/llvm/test/tools/llvm-mca/X86/BtVer2/stmxcsr-ldmxcsr.s
@@ -33,7 +33,7 @@ retq
 # CHECK-NEXT:  1      1     0.50                        movl	$-24577, %eax
 # CHECK-NEXT:  1      4     1.00    *                   andl	-4(%rsp), %eax
 # CHECK-NEXT:  1      1     1.00           *            movl	%eax, -8(%rsp)
-# CHECK-NEXT:  1      3     1.00    *             U     ldmxcsr	-8(%rsp)
+# CHECK-NEXT:  1      3     1.00    *      *      U     ldmxcsr	-8(%rsp)
 # CHECK-NEXT:  1      4     1.00                  U     retq
 
 # CHECK:      Resources:
@@ -75,13 +75,13 @@ retq
 # CHECK-NEXT: [0,3]     .D====eER .    .    .   .   movl	%eax, -8(%rsp)
 # CHECK-NEXT: [0,4]     . D===eeeER    .    .   .   ldmxcsr	-8(%rsp)
 # CHECK-NEXT: [0,5]     . DeeeeE--R    .    .   .   retq
-# CHECK-NEXT: [1,0]     .  D===eE--R   .    .   .   stmxcsr	-4(%rsp)
+# CHECK-NEXT: [1,0]     .  D=====eER   .    .   .   stmxcsr	-4(%rsp)
 # CHECK-NEXT: [1,1]     .  DeE-----R   .    .   .   movl	$-24577, %eax
 # CHECK-NEXT: [1,2]     .   D====eeeeER.    .   .   andl	-4(%rsp), %eax
 # CHECK-NEXT: [1,3]     .   D========eER    .   .   movl	%eax, -8(%rsp)
 # CHECK-NEXT: [1,4]     .    D=======eeeER  .   .   ldmxcsr	-8(%rsp)
 # CHECK-NEXT: [1,5]     .    D=eeeeE-----R  .   .   retq
-# CHECK-NEXT: [2,0]     .    .D=======eE--R .   .   stmxcsr	-4(%rsp)
+# CHECK-NEXT: [2,0]     .    .D=========eER .   .   stmxcsr	-4(%rsp)
 # CHECK-NEXT: [2,1]     .    .DeE---------R .   .   movl	$-24577, %eax
 # CHECK-NEXT: [2,2]     .    . D========eeeeER  .   andl	-4(%rsp), %eax
 # CHECK-NEXT: [2,3]     .    . D============eER .   movl	%eax, -8(%rsp)
@@ -95,10 +95,10 @@ retq
 # CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
 
 # CHECK:            [0]    [1]    [2]    [3]
-# CHECK-NEXT: 0.     3     4.3    1.0    1.3       stmxcsr	-4(%rsp)
+# CHECK-NEXT: 0.     3     5.7    0.3    0.0       stmxcsr	-4(%rsp)
 # CHECK-NEXT: 1.     3     1.0    1.0    4.7       movl	$-24577, %eax
 # CHECK-NEXT: 2.     3     5.0    0.3    0.0       andl	-4(%rsp), %eax
 # CHECK-NEXT: 3.     3     9.0    0.0    0.0       movl	%eax, -8(%rsp)
 # CHECK-NEXT: 4.     3     8.0    0.0    0.0       ldmxcsr	-8(%rsp)
 # CHECK-NEXT: 5.     3     1.7    1.7    5.3       retq
-# CHECK-NEXT:        3     4.8    0.7    1.9       <total>
+# CHECK-NEXT:        3     5.1    0.6    1.7       <total>

diff  --git a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx1.s
index e2f8fe2d9f30..3cad666eee94 100644
--- a/llvm/test/tools/llvm-mca/X86/Generic/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/Generic/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      7     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      7     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  4      5     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  4      5     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  3      8     1.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  3      9     1.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Generic/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Generic/resources-sse1.s
index 5fcb1979c74a..580b3608e8e7 100644
--- a/llvm/test/tools/llvm-mca/X86/Generic/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Generic/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      14    14.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  4      5     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  4      5     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      9     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Haswell/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/Haswell/resources-avx1.s
index 8809fd894237..997ea6156a0a 100644
--- a/llvm/test/tools/llvm-mca/X86/Haswell/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/Haswell/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      7     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      7     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  3      7     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  2      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  3      8     2.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  3      9     2.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Haswell/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Haswell/resources-sse1.s
index c7ade6b9b25a..b64d23dd1ee6 100644
--- a/llvm/test/tools/llvm-mca/X86/Haswell/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Haswell/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      19    7.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      13    7.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      18    7.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      9     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Haswell/stmxcsr-ldmxcsr.s b/llvm/test/tools/llvm-mca/X86/Haswell/stmxcsr-ldmxcsr.s
index c976314f0fd2..383160d219f0 100644
--- a/llvm/test/tools/llvm-mca/X86/Haswell/stmxcsr-ldmxcsr.s
+++ b/llvm/test/tools/llvm-mca/X86/Haswell/stmxcsr-ldmxcsr.s
@@ -33,7 +33,7 @@ retq
 # CHECK-NEXT:  1      1     0.25                        movl	$-24577, %eax
 # CHECK-NEXT:  2      6     0.50    *                   andl	-4(%rsp), %eax
 # CHECK-NEXT:  1      1     1.00           *            movl	%eax, -8(%rsp)
-# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	-8(%rsp)
+# CHECK-NEXT:  3      7     1.00    *      *      U     ldmxcsr	-8(%rsp)
 # CHECK-NEXT:  3      7     1.00                  U     retq
 
 # CHECK:      Resources:
@@ -50,16 +50,16 @@ retq
 
 # CHECK:      Resource pressure per iteration:
 # CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]
-# CHECK-NEXT:  -      -     1.75   1.74   1.67   1.68   2.00   1.75   1.76   1.65
+# CHECK-NEXT:  -      -     1.74   1.74   1.67   1.68   2.00   1.74   1.78   1.65
 
 # CHECK:      Resource pressure by instruction:
 # CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]    Instructions:
 # CHECK-NEXT:  -      -      -      -     0.30    -     1.00   1.00    -     0.70   stmxcsr	-4(%rsp)
-# CHECK-NEXT:  -      -     0.08   0.67    -      -      -     0.04   0.21    -     movl	$-24577, %eax
-# CHECK-NEXT:  -      -     0.42   0.37   0.35   0.65    -     0.01   0.20    -     andl	-4(%rsp), %eax
+# CHECK-NEXT:  -      -     0.03   0.53    -      -      -     0.23   0.21    -     movl	$-24577, %eax
+# CHECK-NEXT:  -      -     0.22   0.58   0.35   0.65    -      -     0.20    -     andl	-4(%rsp), %eax
 # CHECK-NEXT:  -      -      -      -     0.05    -     1.00    -      -     0.95   movl	%eax, -8(%rsp)
-# CHECK-NEXT:  -      -     1.00   0.23   0.34   0.66    -     0.42   0.35    -     ldmxcsr	-8(%rsp)
-# CHECK-NEXT:  -      -     0.25   0.47   0.63   0.37    -     0.28   1.00    -     retq
+# CHECK-NEXT:  -      -     1.00   0.21   0.34   0.66    -     0.42   0.37    -     ldmxcsr	-8(%rsp)
+# CHECK-NEXT:  -      -     0.49   0.42   0.63   0.37    -     0.09   1.00    -     retq
 
 # CHECK:      Timeline view:
 # CHECK-NEXT:                     0123456789          0123456789
@@ -71,14 +71,14 @@ retq
 # CHECK-NEXT: [0,3]     .D======eER    .    .    .    .    .    . .   movl	%eax, -8(%rsp)
 # CHECK-NEXT: [0,4]     . D=====eeeeeeeER   .    .    .    .    . .   ldmxcsr	-8(%rsp)
 # CHECK-NEXT: [0,5]     .  DeeeeeeeE----R   .    .    .    .    . .   retq
-# CHECK-NEXT: [1,0]     .   D====eeE----R   .    .    .    .    . .   stmxcsr	-4(%rsp)
-# CHECK-NEXT: [1,1]     .   DeE---------R   .    .    .    .    . .   movl	$-24577, %eax
+# CHECK-NEXT: [1,0]     .   D==========eeER .    .    .    .    . .   stmxcsr	-4(%rsp)
+# CHECK-NEXT: [1,1]     .   DeE-----------R .    .    .    .    . .   movl	$-24577, %eax
 # CHECK-NEXT: [1,2]     .    D=========eeeeeeER  .    .    .    . .   andl	-4(%rsp), %eax
 # CHECK-NEXT: [1,3]     .    D===============eER .    .    .    . .   movl	%eax, -8(%rsp)
 # CHECK-NEXT: [1,4]     .    .D==============eeeeeeeER.    .    . .   ldmxcsr	-8(%rsp)
 # CHECK-NEXT: [1,5]     .    . DeeeeeeeE-------------R.    .    . .   retq
-# CHECK-NEXT: [2,0]     .    .  D=============eeE----R.    .    . .   stmxcsr	-4(%rsp)
-# CHECK-NEXT: [2,1]     .    .  DeE------------------R.    .    . .   movl	$-24577, %eax
+# CHECK-NEXT: [2,0]     .    .  D===================eeER   .    . .   stmxcsr	-4(%rsp)
+# CHECK-NEXT: [2,1]     .    .  DeE--------------------R   .    . .   movl	$-24577, %eax
 # CHECK-NEXT: [2,2]     .    .   D==================eeeeeeER    . .   andl	-4(%rsp), %eax
 # CHECK-NEXT: [2,3]     .    .   D========================eER   . .   movl	%eax, -8(%rsp)
 # CHECK-NEXT: [2,4]     .    .    D=======================eeeeeeeER   ldmxcsr	-8(%rsp)
@@ -91,10 +91,10 @@ retq
 # CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
 
 # CHECK:            [0]    [1]    [2]    [3]
-# CHECK-NEXT: 0.     3     6.7    1.0    2.7       stmxcsr	-4(%rsp)
-# CHECK-NEXT: 1.     3     1.0    1.0    9.3       movl	$-24577, %eax
+# CHECK-NEXT: 0.     3     10.7   0.3    0.0       stmxcsr	-4(%rsp)
+# CHECK-NEXT: 1.     3     1.0    1.0    10.7      movl	$-24577, %eax
 # CHECK-NEXT: 2.     3     10.0   0.3    0.0       andl	-4(%rsp), %eax
 # CHECK-NEXT: 3.     3     16.0   0.0    0.0       movl	%eax, -8(%rsp)
 # CHECK-NEXT: 4.     3     15.0   0.0    0.0       ldmxcsr	-8(%rsp)
 # CHECK-NEXT: 5.     3     1.0    1.0    13.0      retq
-# CHECK-NEXT:        3     8.3    0.6    4.2       <total>
+# CHECK-NEXT:        3     8.9    0.4    3.9       <total>

diff  --git a/llvm/test/tools/llvm-mca/X86/SLM/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/SLM/resources-sse1.s
index dd837ab4b53d..866ba7a538eb 100644
--- a/llvm/test/tools/llvm-mca/X86/SLM/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/SLM/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      42    39.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      19    17.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      22    17.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      3     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      3     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      6     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-avx1.s
index b8c64ce85219..d5d7f9b7fc73 100644
--- a/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      7     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      7     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  4      5     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  4      5     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  3      8     1.00    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  3      9     1.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-sse1.s
index 5cc3a7077f66..88217206ffaa 100644
--- a/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/SandyBridge/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      14    14.00                       divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      20    14.00   *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  4      5     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  4      5     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      9     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-avx1.s
index 996ffc7191fe..5c0fc8e74865 100644
--- a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      7     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      7     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  3      7     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  2      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  2      7     0.50    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      8     0.50    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-sse1.s
index 11557412ea51..d8e6f233d0ce 100644
--- a/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/SkylakeClient/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      17    5.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      11    3.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      16    3.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      4     0.50                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      10    0.50    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx1.s
index e1bd834bf444..005c2eecf8df 100644
--- a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  2      7     1.00    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      6     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      7     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  3      7     1.00    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  2      1     1.00    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  2      7     0.50    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      8     0.50    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-sse1.s
index 9754746949ef..b1d2c9640f12 100644
--- a/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/SkylakeServer/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  2      17    5.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      11    3.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  2      16    3.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  3      7     1.00    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      1     1.00    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      4     0.50                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  2      10    0.50    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-avx1.s
index 585e257b1840..f41b1d6942b2 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  1      8     0.50    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      8     0.50    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      8     0.50    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  1      100   0.25    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  1      100   0.25    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  1      100   0.25    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  1      8     0.50    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      8     1.00    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
index 8fd10cb08f7b..a0684cf20af8 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver1/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      22    1.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      15    1.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      22    1.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      100   0.25    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      100   0.25    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      100   0.25    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      3     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      10    1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-avx1.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-avx1.s
index 45b48e85f561..4b11dc74c8dd 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-avx1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-avx1.s
@@ -1218,7 +1218,7 @@ vzeroupper
 # CHECK-NEXT:  1      8     0.50    *                   vinsertps	$1, (%rax), %xmm1, %xmm2
 # CHECK-NEXT:  1      8     0.33    *                   vlddqu	(%rax), %xmm2
 # CHECK-NEXT:  1      8     0.33    *                   vlddqu	(%rax), %ymm2
-# CHECK-NEXT:  1      100   0.25    *             U     vldmxcsr	(%rax)
+# CHECK-NEXT:  1      100   0.25    *      *      U     vldmxcsr	(%rax)
 # CHECK-NEXT:  1      100   0.25    *      *      U     vmaskmovdqu	%xmm0, %xmm1
 # CHECK-NEXT:  1      8     0.50    *                   vmaskmovpd	(%rax), %xmm0, %xmm2
 # CHECK-NEXT:  2      8     0.50    *                   vmaskmovpd	(%rax), %ymm0, %ymm2

diff  --git a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
index d25b1a70a77e..74b3c87e1ab9 100644
--- a/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
+++ b/llvm/test/tools/llvm-mca/X86/Znver2/resources-sse1.s
@@ -230,7 +230,7 @@ xorps       (%rax), %xmm2
 # CHECK-NEXT:  1      22    1.00    *                   divps	(%rax), %xmm2
 # CHECK-NEXT:  1      15    1.00                        divss	%xmm0, %xmm2
 # CHECK-NEXT:  1      22    1.00    *                   divss	(%rax), %xmm2
-# CHECK-NEXT:  1      100   0.25    *             U     ldmxcsr	(%rax)
+# CHECK-NEXT:  1      100   0.25    *      *      U     ldmxcsr	(%rax)
 # CHECK-NEXT:  1      100   0.25    *      *      U     maskmovq	%mm0, %mm1
 # CHECK-NEXT:  1      1     1.00                        maxps	%xmm0, %xmm2
 # CHECK-NEXT:  1      8     1.00    *                   maxps	(%rax), %xmm2

diff  --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 61b9fa853198..0e93635427e7 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -821,11 +821,19 @@ void CodeGenIntrinsic::setDefaultProperties(
 void CodeGenIntrinsic::setProperty(Record *R) {
   if (R->getName() == "IntrNoMem")
     ModRef = NoMem;
-  else if (R->getName() == "IntrReadMem")
+  else if (R->getName() == "IntrReadMem") {
+    if (!(ModRef & MR_Ref))
+      PrintFatalError(TheDef->getLoc(),
+                      Twine("IntrReadMem cannot be used after IntrNoMem or "
+                            "IntrWriteMem. Default is ReadWrite"));
     ModRef = ModRefBehavior(ModRef & ~MR_Mod);
-  else if (R->getName() == "IntrWriteMem")
+  } else if (R->getName() == "IntrWriteMem") {
+    if (!(ModRef & MR_Mod))
+      PrintFatalError(TheDef->getLoc(),
+                      Twine("IntrWriteMem cannot be used after IntrNoMem or "
+                            "IntrReadMem. Default is ReadWrite"));
     ModRef = ModRefBehavior(ModRef & ~MR_Ref);
-  else if (R->getName() == "IntrArgMemOnly")
+  } else if (R->getName() == "IntrArgMemOnly")
     ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem);
   else if (R->getName() == "IntrInaccessibleMemOnly")
     ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_InaccessibleMem);


        


More information about the llvm-branch-commits mailing list