aboutsummaryrefslogtreecommitdiff
path: root/isa/rv64uf/structural.S
diff options
context:
space:
mode:
authorYunsup Lee <yunsup@cs.berkeley.edu>2013-04-22 14:56:59 -0700
committerYunsup Lee <yunsup@cs.berkeley.edu>2013-04-22 14:56:59 -0700
commit81ad66f25ce4c15180e558696961bd8eaf967fea (patch)
treed70676fb1d11a4a66a268f7860d3ef7d469987fe /isa/rv64uf/structural.S
downloadriscv-tests-81ad66f25ce4c15180e558696961bd8eaf967fea.zip
riscv-tests-81ad66f25ce4c15180e558696961bd8eaf967fea.tar.gz
riscv-tests-81ad66f25ce4c15180e558696961bd8eaf967fea.tar.bz2
initial commit
Diffstat (limited to 'isa/rv64uf/structural.S')
-rw-r--r--isa/rv64uf/structural.S56
1 files changed, 56 insertions, 0 deletions
diff --git a/isa/rv64uf/structural.S b/isa/rv64uf/structural.S
new file mode 100644
index 0000000..0c74ab5
--- /dev/null
+++ b/isa/rv64uf/structural.S
@@ -0,0 +1,56 @@
+#*****************************************************************************
+# structural.S
+#-----------------------------------------------------------------------------
+#
+# This test verifies that the FPU correctly obviates structural hazards on its
+# writeback port (e.g. fadd followed by fsgnj)
+#
+
+#include "riscv_test.h"
+#include "test_macros.h"
+
+RVTEST_RV64U
+RVTEST_CODE_BEGIN
+
+li x25, 1
+
+li x2, 0x3FF0000000000000
+li x1, 0x3F800000
+
+#define TEST(nops, errcode) \
+ mxtf.d f4, x0 ;\
+ mxtf.s f3, x0 ;\
+ mxtf.d f2, x2 ;\
+ mxtf.s f1, x1 ;\
+ b 1f ;\
+ .align 5 ;\
+1:fmul.d f4, f2, f2 ;\
+ nops ;\
+ fsgnj.s f3, f1, f1 ;\
+ mftx.d x4, f4 ;\
+ mftx.s x3, f3 ;\
+ beq x1, x3, 2f ;\
+ RVTEST_FAIL ;\
+2:beq x2, x4, 2f ;\
+ RVTEST_FAIL; \
+2:mxtf.d f2, zero ;\
+ mxtf.s f1, zero ;\
+
+TEST(;,2)
+TEST(nop,4)
+TEST(nop;nop,6)
+TEST(nop;nop;nop,8)
+TEST(nop;nop;nop;nop,10)
+TEST(nop;nop;nop;nop;nop,12)
+TEST(nop;nop;nop;nop;nop;nop,14)
+
+RVTEST_PASS
+
+RVTEST_CODE_END
+
+ .data
+RVTEST_DATA_BEGIN
+
+ TEST_DATA
+
+RVTEST_DATA_END