xref: /openbmc/qemu/tests/tcg/xtensa/test_clamps.S (revision 99d423e5)
1#include "macros.inc"
2
3test_suite clamps
4
5#if XCHAL_HAVE_CLAMPS
6
7test clamps
8    movi    a2, 0
9    movi    a3, 0
10    clamps  a4, a2, 7
11    assert  eq, a3, a4
12
13    movi    a2, 0x7f
14    movi    a3, 0x7f
15    clamps  a4, a2, 7
16    assert  eq, a3, a4
17
18    movi    a2, 0xffffff80
19    movi    a3, 0xffffff80
20    clamps  a4, a2, 7
21    assert  eq, a3, a4
22
23    movi    a2, 0x80
24    movi    a3, 0x7f
25    clamps  a2, a2, 7
26    assert  eq, a3, a2
27
28    movi    a2, 0xffffff7f
29    movi    a3, 0xffffff80
30    clamps  a2, a2, 7
31    assert  eq, a3, a2
32
33    movi    a2, 0x7fffffff
34    movi    a3, 0x7f
35    clamps  a2, a2, 7
36    assert  eq, a3, a2
37
38    movi    a2, 0x80000000
39    movi    a3, 0xffffff80
40    clamps  a2, a2, 7
41    assert  eq, a3, a2
42test_end
43
44#endif
45
46test_suite_end
47