aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/xtensa/test_pipeline.S
blob: 6be6085fc354b83745beeb1ed418e8b1a1e76d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.include "macros.inc"

.purgem test
.macro test name
    movi    a2, 1f
    movi    a3, 99f
0:
    ipf     a2, 0
    ipf     a2, 4
    ipf     a2, 8
    ipf     a2, 12
    addi    a2, a2, 16
    blt     a2, a3, 0b
    j       1f
    .align 4
1:
.endm

test_suite pipeline

test register_no_stall
    rsr     a3, ccount
    add     a5, a6, a6
    add     a6, a5, a5
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 3
test_end

test register_stall
    l32i    a5, a1, 0   /* data cache preload */
    nop
    rsr     a3, ccount
    l32i    a5, a1, 0
    add     a6, a5, a5  /* M-to-E interlock */
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

test j0_stall
    rsr     a3, ccount
    j       1f          /* E + 2-cycle penalty */
1:
    rsr     a4, ccount  /* E */
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

test j1_stall
    rsr     a3, ccount
    j       1f
    nop
1:
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

test j5_stall
    rsr     a3, ccount
    j       1f
    nop
    nop
    nop
    nop
    nop
1:
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

test b_no_stall
    movi    a5, 1
    rsr     a3, ccount
    beqi    a5, 2, 1f
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 2
1:
test_end

test b1_stall
    movi    a5, 1
    rsr     a3, ccount
    beqi    a5, 1, 1f
    nop
1:
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

test b5_stall
    movi    a5, 1
    rsr     a3, ccount
    beqi    a5, 1, 1f
    nop
    nop
    nop
    nop
    nop
1:
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 4
test_end

/* PS *SYNC */

test ps_dsync
    rsr     a5, ps
    isync
    rsr     a3, ccount
    wsr     a5, ps
    dsync
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 5
test_end

test ps_esync
    rsr     a5, ps
    isync
    rsr     a3, ccount
    wsr     a5, ps
    esync
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 5
test_end

test ps_rsync
    rsr     a5, ps
    isync
    rsr     a3, ccount
    wsr     a5, ps
    rsync
    rsr     a4, ccount
    sub     a3, a4, a3
    assert  eqi, a3, 5
test_end

test ps_isync
    rsr     a5, ps
    isync
    rsr     a3, ccount
    wsr     a5, ps
    isync
    rsr     a4, ccount
    sub     a3, a4, a3
    movi    a4, 9
    assert  eq, a3, a4
test_end

test_suite_end