structural.S revision 12771:75508af5d8dc
14019SN/A# See LICENSE for license details.
23187SN/A
33187SN/A#*****************************************************************************
43187SN/A# structural.S
53187SN/A#-----------------------------------------------------------------------------
63187SN/A#
73187SN/A# This test verifies that the FPU correctly obviates structural hazards on its
83187SN/A# writeback port (e.g. fadd followed by fsgnj)
93187SN/A#
103187SN/A
113187SN/A#include "riscv_test.h"
123187SN/A#include "test_macros.h"
133187SN/A
143187SN/ARVTEST_RV64UF
153187SN/ARVTEST_CODE_BEGIN
163187SN/A
173187SN/Ali x25, 1
183187SN/A
193187SN/Ali x2, 0x3FF0000000000000
203187SN/Ali x1, 0x3F800000
213187SN/A
223187SN/A#define TEST(nops, errcode)     \
233187SN/A  fmv.d.x  f4, x0    ;\
243187SN/A  fmv.s.x  f3, x0    ;\
253187SN/A  fmv.d.x  f2, x2    ;\
263187SN/A  fmv.s.x  f1, x1    ;\
273187SN/A  j 1f ;\
283187SN/A  .align 5        ;\
294019SN/A1:fmul.d  f4, f2, f2  ;\
304019SN/A  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