tests/tcg/xtensa: conditionalize windowed register tests

Make windowed register tests conditional on the presence of this option.
Fix tests to work correctly for both 32 and 64 physical registers.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2019-02-18 07:16:55 -08:00
parent 00988da486
commit c20e10eac8

View File

@ -2,10 +2,12 @@
test_suite windowed test_suite windowed
#if XCHAL_HAVE_WINDOWED
.altmacro .altmacro
.macro reset_window start .macro reset_window start
movi a2, 0xff movi a2, 0xffff
wsr a2, windowstart wsr a2, windowstart
rsync rsync
movi a2, 0 movi a2, 0
@ -105,7 +107,8 @@ test_end
movi a3, 0x4001f movi a3, 0x4001f
assert eq, a2, a3 assert eq, a2, a3
rsr a2, windowbase rsr a2, windowbase
assert eqi, a2, 8 - ((\window) / 4) movi a3, (XCHAL_NUM_AREGS - (\window)) / 4
assert eq, a2, a3
rsr a2, windowstart rsr a2, windowstart
assert eqi, a2, 1 assert eqi, a2, 1
rfwu rfwu
@ -116,8 +119,8 @@ test_end
rsr a2, windowbase rsr a2, windowbase
assert eqi, a2, 0 assert eqi, a2, 0
rsr a2, windowstart rsr a2, windowstart
assert bsi, a2, 0 assert bsi.l, a2, 0
assert bsi, a2, 8 - ((\window) / 4) assert bsi.l, a2, (XCHAL_NUM_AREGS - (\window)) / 4
.endm .endm
test underflow test underflow
@ -132,7 +135,7 @@ test_end
.macro retw_test window .macro retw_test window
reset_window %(1 | (1 << (8 - (\window) / 4))) reset_window %(1 | (1 << ((XCHAL_NUM_AREGS - \window) / 4)))
reset_ps reset_ps
ssai 2 ssai 2
@ -147,10 +150,11 @@ test_end
movi a3, 0x4000f movi a3, 0x4000f
assert eq, a2, a3 assert eq, a2, a3
rsr a2, windowbase rsr a2, windowbase
assert eqi, a2, 8 - ((\window) / 4) movi a3, (XCHAL_NUM_AREGS - (\window)) / 4
assert eq, a2, a3
rsr a2, windowstart rsr a2, windowstart
assert bci, a2, 0 assert bci.l, a2, 0
assert bsi, a2, 8 - ((\window) / 4) assert bsi.l, a2, (XCHAL_NUM_AREGS - (\window)) / 4
.endm .endm
test retw test retw
@ -180,7 +184,7 @@ test movsp
set_vector kernel, 0 set_vector kernel, 0
reset_window 0x81 reset_window %(0x1 | (1 << ((XCHAL_NUM_AREGS / 4) - 1)))
reset_ps reset_ps
movsp a2, a3 movsp a2, a3
@ -211,8 +215,16 @@ test rotw
movi a3, 0x16 movi a3, 0x16
movi a7, 0x17 movi a7, 0x17
#if XCHAL_NUM_AREGS == 32
movi a2, 0x44 movi a2, 0x44
wsr a2, windowstart wsr a2, windowstart
#elif XCHAL_NUM_AREGS == 64
movi a2, 0x4004
wsr a2, windowstart
rotw -8
#else
#error XCHAL_NUM_AREGS unsupported
#endif
rsync rsync
movi a2, 0x10 movi a2, 0x10
@ -350,4 +362,6 @@ test entry_overflow
all_entry_overflow_tests all_entry_overflow_tests
test_end test_end
#endif
test_suite_end test_suite_end