[llvm] [MCA][X86] Pretend To Have a Stack Engine (PR #153348)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 15:29:52 PDT 2025


================
@@ -0,0 +1,92 @@
+# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=skylake -timeline -iterations=2 < %s | FileCheck %s
+
+movq $0x80, %rsp
+popq %rax
+popq %rcx
+popq %rdx
+popq %rbx
+popq %r12
+
+# CHECK:      Iterations:        2
+# CHECK-NEXT: Instructions:      12
+# CHECK-NEXT: Total Cycles:      14
+# CHECK-NEXT: Total uOps:        22
+
+# CHECK:      Dispatch Width:    6
+# CHECK-NEXT: uOps Per Cycle:    1.57
+# CHECK-NEXT: IPC:               0.86
+# CHECK-NEXT: Block RThroughput: 2.5
+
+# CHECK:      Instruction Info:
+# CHECK-NEXT: [1]: #uOps
+# CHECK-NEXT: [2]: Latency
+# CHECK-NEXT: [3]: RThroughput
+# CHECK-NEXT: [4]: MayLoad
+# CHECK-NEXT: [5]: MayStore
+# CHECK-NEXT: [6]: HasSideEffects (U)
+
+# CHECK:      [1]    [2]    [3]    [4]    [5]    [6]    Instructions:
+# CHECK-NEXT:  1      1     0.25                        movq	$128, %rsp
+# CHECK-NEXT:  2      6     0.50    *                   popq	%rax
+# CHECK-NEXT:  2      6     0.50    *                   popq	%rcx
+# CHECK-NEXT:  2      6     0.50    *                   popq	%rdx
+# CHECK-NEXT:  2      6     0.50    *                   popq	%rbx
+# CHECK-NEXT:  2      6     0.50    *                   popq	%r12
+
+# CHECK:      Resources:
+# CHECK-NEXT: [0]   - SKLDivider
+# CHECK-NEXT: [1]   - SKLFPDivider
+# CHECK-NEXT: [2]   - SKLPort0
+# CHECK-NEXT: [3]   - SKLPort1
+# CHECK-NEXT: [4]   - SKLPort2
+# CHECK-NEXT: [5]   - SKLPort3
+# CHECK-NEXT: [6]   - SKLPort4
+# CHECK-NEXT: [7]   - SKLPort5
+# CHECK-NEXT: [8]   - SKLPort6
+# CHECK-NEXT: [9]   - SKLPort7
+
+# CHECK:      Resource pressure per iteration:
+# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]
+# CHECK-NEXT:  -      -     1.50   1.50   2.50   2.50    -     1.50   1.50    -
+
+# CHECK:      Resource pressure by instruction:
+# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]    Instructions:
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.50   0.50    -     movq	$128, %rsp
+# CHECK-NEXT:  -      -     0.50    -     0.50   0.50    -     0.50    -      -     popq	%rax
+# CHECK-NEXT:  -      -      -     0.50   0.50   0.50    -      -     0.50    -     popq	%rcx
+# CHECK-NEXT:  -      -     0.50    -     0.50   0.50    -     0.50    -      -     popq	%rdx
+# CHECK-NEXT:  -      -      -     0.50   0.50   0.50    -      -     0.50    -     popq	%rbx
+# CHECK-NEXT:  -      -     0.50   0.50   0.50   0.50    -      -      -      -     popq	%r12
+
+# CHECK:      Timeline view:
+# CHECK-NEXT:                     0123
+# CHECK-NEXT: Index     0123456789
+
+# CHECK:      [0,0]     DeER .    .  .   movq	$128, %rsp
+# CHECK-NEXT: [0,1]     D=eeeeeeER.  .   popq	%rax
+# CHECK-NEXT: [0,2]     D=eeeeeeER.  .   popq	%rcx
----------------
boomanaiden154 wrote:

Yeah, precisely. Each iteration of the snippet would take 30+ cycles.

```
Iterations:        1
Instructions:      6
Total Cycles:      34
Total uOps:        11

Timeline view:
                    0123456789          0123
Index     0123456789          0123456789

[0,0]     DeER .    .    .    .    .    .  .   movq	$128, %rsp
[0,1]     D=eeeeeeER.    .    .    .    .  .   popq	%rax
[0,2]     D=======eeeeeeER    .    .    .  .   popq	%rcx
[0,3]     .D============eeeeeeER   .    .  .   popq	%rdx
[0,4]     .D==================eeeeeeER  .  .   popq	%rbx
[0,5]     .D========================eeeeeeER   popq	%r12
```

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


More information about the llvm-commits mailing list