1# See LICENSE for license details.
2
3#*****************************************************************************
4# structural.S
5#-----------------------------------------------------------------------------
6#
7# This test verifies that the FPU correctly obviates structural hazards on its
8# writeback port (e.g. fadd followed by fsgnj)
9#
10
11#include "riscv_test.h"
12#include "test_macros.h"
13
14RVTEST_RV64UF
15RVTEST_CODE_BEGIN
16
17li x25, 1
18
19li x2, 0x3FF0000000000000
20li x1, 0x3F800000
21
22#define TEST(nops, errcode)     \
23  fmv.d.x  f4, x0    ;\
24  fmv.s.x  f3, x0    ;\
25  fmv.d.x  f2, x2    ;\
26  fmv.s.x  f1, x1    ;\
27  j 1f ;\
28  .align 5        ;\
291:fmul.d  f4, f2, f2  ;\
30  nops          ;\
31  fsgnj.s f3, f1, f1 ;\
32  fmv.x.d  x4, f4    ;\
33  fmv.x.s  x5, f3    ;\
34  beq     x1, x5, 2f  ;\
35  RVTEST_FAIL ;\
362:beq     x2, x4, 2f  ;\
37  RVTEST_FAIL; \
382:fmv.d.x  f2, zero    ;\
39  fmv.s.x  f1, zero    ;\
40
41TEST(;,2)
42TEST(nop,4)
43TEST(nop;nop,6)
44TEST(nop;nop;nop,8)
45TEST(nop;nop;nop;nop,10)
46TEST(nop;nop;nop;nop;nop,12)
47TEST(nop;nop;nop;nop;nop;nop,14)
48
49RVTEST_PASS
50
51RVTEST_CODE_END
52
53  .data
54RVTEST_DATA_BEGIN
55
56  TEST_DATA
57
58RVTEST_DATA_END
59