aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/xtensa/test_sar.S
blob: 40c649ffb8390e6f9f9feb251415758bc935a4c8 (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
.include "macros.inc"

test_suite sar

.macro test_sar prefix, imm
    \prefix\()_set \imm
    \prefix\()_ver \imm
.endm

.macro tests_sar prefix
    test_sar \prefix, 0
    test_sar \prefix, 1
    test_sar \prefix, 2
    test_sar \prefix, 3
    test_sar \prefix, 0x1f
    test_sar \prefix, 0x20
    test_sar \prefix, 0x3f
    test_sar \prefix, 0x40
    test_sar \prefix, 0xfffffffe
.endm

.macro sar_set imm
    movi    a2, \imm
    wsr     a2, sar
.endm

.macro sar_ver imm
    rsr     a3, sar
    movi    a2, \imm & 0x3f
    assert  eq, a2, a3
.endm

test sar
    tests_sar sar
test_end

.macro ssr_set imm
    movi    a2, \imm
    ssr     a2
.endm

.macro ssr_ver imm
    rsr     a3, sar
    movi    a2, \imm & 0x1f
    assert  eq, a2, a3
.endm

test ssr
    tests_sar ssr
test_end

.macro ssl_set imm
    movi    a2, \imm
    ssl     a2
.endm

.macro ssl_ver imm
    rsr     a3, sar
    movi    a2, 32 - (\imm & 0x1f)
    assert  eq, a2, a3
.endm

test ssl
    tests_sar ssl
test_end

.macro ssa8l_set imm
    movi    a2, \imm
    ssa8l   a2
.endm

.macro ssa8l_ver imm
    rsr     a3, sar
    movi    a2, (\imm & 0x3) << 3
    assert  eq, a2, a3
.endm

test ssa8l
    tests_sar ssa8l
test_end

.macro ssa8b_set imm
    movi    a2, \imm
    ssa8b   a2
.endm

.macro ssa8b_ver imm
    rsr     a3, sar
    movi    a2, 32 - ((\imm & 0x3) << 3)
    assert  eq, a2, a3
.endm

test ssa8b
    tests_sar ssa8b
test_end

.macro ssai_set imm
    ssai    \imm & 0x1f
.endm

.macro ssai_ver imm
    rsr     a3, sar
    movi    a2, \imm & 0x1f
    assert  eq, a2, a3
.endm

test ssai
    tests_sar ssai
test_end

test_suite_end