1# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
2# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=haswell -timeline -timeline-max-iterations=3 < %s | FileCheck %s
3
4# Code snippet taken from PR48024.
5
6stmxcsr -4(%rsp)
7movl    $-24577, %eax    # imm = 0x9FFF
8andl    -4(%rsp), %eax
9movl    %eax, -8(%rsp)
10ldmxcsr -8(%rsp)
11retq
12
13# CHECK:      Iterations:        100
14# CHECK-NEXT: Instructions:      600
15# CHECK-NEXT: Total Cycles:      1304
16# CHECK-NEXT: Total uOps:        1300
17
18# CHECK:      Dispatch Width:    4
19# CHECK-NEXT: uOps Per Cycle:    1.00
20# CHECK-NEXT: IPC:               0.46
21# CHECK-NEXT: Block RThroughput: 3.3
22
23# CHECK:      Instruction Info:
24# CHECK-NEXT: [1]: #uOps
25# CHECK-NEXT: [2]: Latency
26# CHECK-NEXT: [3]: RThroughput
27# CHECK-NEXT: [4]: MayLoad
28# CHECK-NEXT: [5]: MayStore
29# CHECK-NEXT: [6]: HasSideEffects (U)
30
31# CHECK:      [1]    [2]    [3]    [4]    [5]    [6]    Instructions:
32# CHECK-NEXT:  3      2     1.00           *      U     stmxcsr	-4(%rsp)
33# CHECK-NEXT:  1      1     0.25                        movl	$-24577, %eax
34# CHECK-NEXT:  2      6     0.50    *                   andl	-4(%rsp), %eax
35# CHECK-NEXT:  1      1     1.00           *            movl	%eax, -8(%rsp)
36# CHECK-NEXT:  3      7     1.00    *             U     ldmxcsr	-8(%rsp)
37# CHECK-NEXT:  3      7     1.00                  U     retq
38
39# CHECK:      Resources:
40# CHECK-NEXT: [0]   - HWDivider
41# CHECK-NEXT: [1]   - HWFPDivider
42# CHECK-NEXT: [2]   - HWPort0
43# CHECK-NEXT: [3]   - HWPort1
44# CHECK-NEXT: [4]   - HWPort2
45# CHECK-NEXT: [5]   - HWPort3
46# CHECK-NEXT: [6]   - HWPort4
47# CHECK-NEXT: [7]   - HWPort5
48# CHECK-NEXT: [8]   - HWPort6
49# CHECK-NEXT: [9]   - HWPort7
50
51# CHECK:      Resource pressure per iteration:
52# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]
53# CHECK-NEXT:  -      -     1.75   1.74   1.67   1.68   2.00   1.75   1.76   1.65
54
55# CHECK:      Resource pressure by instruction:
56# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]    Instructions:
57# CHECK-NEXT:  -      -      -      -     0.30    -     1.00   1.00    -     0.70   stmxcsr	-4(%rsp)
58# CHECK-NEXT:  -      -     0.08   0.67    -      -      -     0.04   0.21    -     movl	$-24577, %eax
59# CHECK-NEXT:  -      -     0.42   0.37   0.35   0.65    -     0.01   0.20    -     andl	-4(%rsp), %eax
60# CHECK-NEXT:  -      -      -      -     0.05    -     1.00    -      -     0.95   movl	%eax, -8(%rsp)
61# CHECK-NEXT:  -      -     1.00   0.23   0.34   0.66    -     0.42   0.35    -     ldmxcsr	-8(%rsp)
62# CHECK-NEXT:  -      -     0.25   0.47   0.63   0.37    -     0.28   1.00    -     retq
63
64# CHECK:      Timeline view:
65# CHECK-NEXT:                     0123456789          0123456789
66# CHECK-NEXT: Index     0123456789          0123456789          012
67
68# CHECK:      [0,0]     DeeER.    .    .    .    .    .    .    . .   stmxcsr	-4(%rsp)
69# CHECK-NEXT: [0,1]     DeE-R.    .    .    .    .    .    .    . .   movl	$-24577, %eax
70# CHECK-NEXT: [0,2]     .DeeeeeeER.    .    .    .    .    .    . .   andl	-4(%rsp), %eax
71# CHECK-NEXT: [0,3]     .D======eER    .    .    .    .    .    . .   movl	%eax, -8(%rsp)
72# CHECK-NEXT: [0,4]     . D=====eeeeeeeER   .    .    .    .    . .   ldmxcsr	-8(%rsp)
73# CHECK-NEXT: [0,5]     .  DeeeeeeeE----R   .    .    .    .    . .   retq
74# CHECK-NEXT: [1,0]     .   D====eeE----R   .    .    .    .    . .   stmxcsr	-4(%rsp)
75# CHECK-NEXT: [1,1]     .   DeE---------R   .    .    .    .    . .   movl	$-24577, %eax
76# CHECK-NEXT: [1,2]     .    D=========eeeeeeER  .    .    .    . .   andl	-4(%rsp), %eax
77# CHECK-NEXT: [1,3]     .    D===============eER .    .    .    . .   movl	%eax, -8(%rsp)
78# CHECK-NEXT: [1,4]     .    .D==============eeeeeeeER.    .    . .   ldmxcsr	-8(%rsp)
79# CHECK-NEXT: [1,5]     .    . DeeeeeeeE-------------R.    .    . .   retq
80# CHECK-NEXT: [2,0]     .    .  D=============eeE----R.    .    . .   stmxcsr	-4(%rsp)
81# CHECK-NEXT: [2,1]     .    .  DeE------------------R.    .    . .   movl	$-24577, %eax
82# CHECK-NEXT: [2,2]     .    .   D==================eeeeeeER    . .   andl	-4(%rsp), %eax
83# CHECK-NEXT: [2,3]     .    .   D========================eER   . .   movl	%eax, -8(%rsp)
84# CHECK-NEXT: [2,4]     .    .    D=======================eeeeeeeER   ldmxcsr	-8(%rsp)
85# CHECK-NEXT: [2,5]     .    .    .DeeeeeeeE----------------------R   retq
86
87# CHECK:      Average Wait times (based on the timeline view):
88# CHECK-NEXT: [0]: Executions
89# CHECK-NEXT: [1]: Average time spent waiting in a scheduler's queue
90# CHECK-NEXT: [2]: Average time spent waiting in a scheduler's queue while ready
91# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
92
93# CHECK:            [0]    [1]    [2]    [3]
94# CHECK-NEXT: 0.     3     6.7    1.0    2.7       stmxcsr	-4(%rsp)
95# CHECK-NEXT: 1.     3     1.0    1.0    9.3       movl	$-24577, %eax
96# CHECK-NEXT: 2.     3     10.0   0.3    0.0       andl	-4(%rsp), %eax
97# CHECK-NEXT: 3.     3     16.0   0.0    0.0       movl	%eax, -8(%rsp)
98# CHECK-NEXT: 4.     3     15.0   0.0    0.0       ldmxcsr	-8(%rsp)
99# CHECK-NEXT: 5.     3     1.0    1.0    13.0      retq
100# CHECK-NEXT:        3     8.3    0.6    4.2       <total>
101