initial commit
[riscv-tests.git] / isa / rv64uf / structural.S
1 #*****************************************************************************
2 # structural.S
3 #-----------------------------------------------------------------------------
4 #
5 # This test verifies that the FPU correctly obviates structural hazards on its
6 # writeback port (e.g. fadd followed by fsgnj)
7 #
8
9 #include "riscv_test.h"
10 #include "test_macros.h"
11
12 RVTEST_RV64U
13 RVTEST_CODE_BEGIN
14
15 li x25, 1
16
17 li x2, 0x3FF0000000000000
18 li x1, 0x3F800000
19
20 #define TEST(nops, errcode) \
21 mxtf.d f4, x0 ;\
22 mxtf.s f3, x0 ;\
23 mxtf.d f2, x2 ;\
24 mxtf.s f1, x1 ;\
25 b 1f ;\
26 .align 5 ;\
27 1:fmul.d f4, f2, f2 ;\
28 nops ;\
29 fsgnj.s f3, f1, f1 ;\
30 mftx.d x4, f4 ;\
31 mftx.s x3, f3 ;\
32 beq x1, x3, 2f ;\
33 RVTEST_FAIL ;\
34 2:beq x2, x4, 2f ;\
35 RVTEST_FAIL; \
36 2:mxtf.d f2, zero ;\
37 mxtf.s f1, zero ;\
38
39 TEST(;,2)
40 TEST(nop,4)
41 TEST(nop;nop,6)
42 TEST(nop;nop;nop,8)
43 TEST(nop;nop;nop;nop,10)
44 TEST(nop;nop;nop;nop;nop,12)
45 TEST(nop;nop;nop;nop;nop;nop,14)
46
47 RVTEST_PASS
48
49 RVTEST_CODE_END
50
51 .data
52 RVTEST_DATA_BEGIN
53
54 TEST_DATA
55
56 RVTEST_DATA_END