1# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
2# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -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:      704
16# CHECK-NEXT: Total uOps:        600
17
18# CHECK:      Dispatch Width:    2
19# CHECK-NEXT: uOps Per Cycle:    0.85
20# CHECK-NEXT: IPC:               0.85
21# CHECK-NEXT: Block RThroughput: 3.0
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:  1      1     1.00           *      U     stmxcsr	-4(%rsp)
33# CHECK-NEXT:  1      1     0.50                        movl	$-24577, %eax
34# CHECK-NEXT:  1      4     1.00    *                   andl	-4(%rsp), %eax
35# CHECK-NEXT:  1      1     1.00           *            movl	%eax, -8(%rsp)
36# CHECK-NEXT:  1      3     1.00    *             U     ldmxcsr	-8(%rsp)
37# CHECK-NEXT:  1      4     1.00                  U     retq
38
39# CHECK:      Resources:
40# CHECK-NEXT: [0]   - JALU0
41# CHECK-NEXT: [1]   - JALU1
42# CHECK-NEXT: [2]   - JDiv
43# CHECK-NEXT: [3]   - JFPA
44# CHECK-NEXT: [4]   - JFPM
45# CHECK-NEXT: [5]   - JFPU0
46# CHECK-NEXT: [6]   - JFPU1
47# CHECK-NEXT: [7]   - JLAGU
48# CHECK-NEXT: [8]   - JMul
49# CHECK-NEXT: [9]   - JSAGU
50# CHECK-NEXT: [10]  - JSTC
51# CHECK-NEXT: [11]  - JVALU0
52# CHECK-NEXT: [12]  - JVALU1
53# CHECK-NEXT: [13]  - JVIMUL
54
55# CHECK:      Resource pressure per iteration:
56# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]
57# CHECK-NEXT: 1.50   1.50    -      -      -      -      -     3.00    -     2.00    -      -      -      -
58
59# CHECK:      Resource pressure by instruction:
60# CHECK-NEXT: [0]    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]   Instructions:
61# CHECK-NEXT:  -      -      -      -      -      -      -      -      -     1.00    -      -      -      -     stmxcsr	-4(%rsp)
62# CHECK-NEXT: 0.50   0.50    -      -      -      -      -      -      -      -      -      -      -      -     movl	$-24577, %eax
63# CHECK-NEXT: 0.50   0.50    -      -      -      -      -     1.00    -      -      -      -      -      -     andl	-4(%rsp), %eax
64# CHECK-NEXT:  -      -      -      -      -      -      -      -      -     1.00    -      -      -      -     movl	%eax, -8(%rsp)
65# CHECK-NEXT:  -      -      -      -      -      -      -     1.00    -      -      -      -      -      -     ldmxcsr	-8(%rsp)
66# CHECK-NEXT: 0.50   0.50    -      -      -      -      -     1.00    -      -      -      -      -      -     retq
67
68# CHECK:      Timeline view:
69# CHECK-NEXT:                     0123456789
70# CHECK-NEXT: Index     0123456789          01234
71
72# CHECK:      [0,0]     DeER .    .    .    .   .   stmxcsr	-4(%rsp)
73# CHECK-NEXT: [0,1]     DeER .    .    .    .   .   movl	$-24577, %eax
74# CHECK-NEXT: [0,2]     .DeeeeER  .    .    .   .   andl	-4(%rsp), %eax
75# CHECK-NEXT: [0,3]     .D====eER .    .    .   .   movl	%eax, -8(%rsp)
76# CHECK-NEXT: [0,4]     . D===eeeER    .    .   .   ldmxcsr	-8(%rsp)
77# CHECK-NEXT: [0,5]     . DeeeeE--R    .    .   .   retq
78# CHECK-NEXT: [1,0]     .  D===eE--R   .    .   .   stmxcsr	-4(%rsp)
79# CHECK-NEXT: [1,1]     .  DeE-----R   .    .   .   movl	$-24577, %eax
80# CHECK-NEXT: [1,2]     .   D====eeeeER.    .   .   andl	-4(%rsp), %eax
81# CHECK-NEXT: [1,3]     .   D========eER    .   .   movl	%eax, -8(%rsp)
82# CHECK-NEXT: [1,4]     .    D=======eeeER  .   .   ldmxcsr	-8(%rsp)
83# CHECK-NEXT: [1,5]     .    D=eeeeE-----R  .   .   retq
84# CHECK-NEXT: [2,0]     .    .D=======eE--R .   .   stmxcsr	-4(%rsp)
85# CHECK-NEXT: [2,1]     .    .DeE---------R .   .   movl	$-24577, %eax
86# CHECK-NEXT: [2,2]     .    . D========eeeeER  .   andl	-4(%rsp), %eax
87# CHECK-NEXT: [2,3]     .    . D============eER .   movl	%eax, -8(%rsp)
88# CHECK-NEXT: [2,4]     .    .  D===========eeeER   ldmxcsr	-8(%rsp)
89# CHECK-NEXT: [2,5]     .    .  D=eeeeE---------R   retq
90
91# CHECK:      Average Wait times (based on the timeline view):
92# CHECK-NEXT: [0]: Executions
93# CHECK-NEXT: [1]: Average time spent waiting in a scheduler's queue
94# CHECK-NEXT: [2]: Average time spent waiting in a scheduler's queue while ready
95# CHECK-NEXT: [3]: Average time elapsed from WB until retire stage
96
97# CHECK:            [0]    [1]    [2]    [3]
98# CHECK-NEXT: 0.     3     4.3    1.0    1.3       stmxcsr	-4(%rsp)
99# CHECK-NEXT: 1.     3     1.0    1.0    4.7       movl	$-24577, %eax
100# CHECK-NEXT: 2.     3     5.0    0.3    0.0       andl	-4(%rsp), %eax
101# CHECK-NEXT: 3.     3     9.0    0.0    0.0       movl	%eax, -8(%rsp)
102# CHECK-NEXT: 4.     3     8.0    0.0    0.0       ldmxcsr	-8(%rsp)
103# CHECK-NEXT: 5.     3     1.7    1.7    5.3       retq
104# CHECK-NEXT:        3     4.8    0.7    1.9       <total>
105