summaryrefslogtreecommitdiff
path: root/tests/test-progs/asmtest/src/riscv/isa/rv64uf/move.S
blob: 60f7cf376c70fca07d998f995482afec43af53f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# See LICENSE for license details.

#*****************************************************************************
# move.S
#-----------------------------------------------------------------------------
#
# This test verifies that the fmv.s.x, fmv.x.s, and fsgnj[x|n].d instructions
# and the fcsr work properly.
#

#include "riscv_test.h"
#include "test_macros.h"

RVTEST_RV64UF
RVTEST_CODE_BEGIN

  TEST_CASE(2, a1, 1, csrwi fcsr, 1; li a0, 0x1234; fssr a1, a0)
  TEST_CASE(3, a0, 0x34, frsr a0)
  TEST_CASE(4, a0, 0x14, frflags a0)
  TEST_CASE(5, a0, 0x01, csrrwi a0, frm, 2)
  TEST_CASE(6, a0, 0x54, frsr a0)
  TEST_CASE(7, a0, 0x14, csrrci a0, fflags, 4)
  TEST_CASE(8, a0, 0x50, frsr a0)

#define TEST_FSGNJS(n, insn, new_sign, rs1_sign, rs2_sign) \
  TEST_CASE(n, a0, 0x12345678 | (-(new_sign) << 31), \
    li a1, ((rs1_sign) << 31) | 0x12345678; \
    li a2, -(rs2_sign); \
    fmv.s.x f1, a1; \
    fmv.s.x f2, a2; \
    insn f0, f1, f2; \
    fmv.x.s a0, f0)

  TEST_FSGNJS(10, fsgnj.s, 0, 0, 0)
  TEST_FSGNJS(11, fsgnj.s, 1, 0, 1)
  TEST_FSGNJS(12, fsgnj.s, 0, 1, 0)
  TEST_FSGNJS(13, fsgnj.s, 1, 1, 1)

  TEST_FSGNJS(20, fsgnjn.s, 1, 0, 0)
  TEST_FSGNJS(21, fsgnjn.s, 0, 0, 1)
  TEST_FSGNJS(22, fsgnjn.s, 1, 1, 0)
  TEST_FSGNJS(23, fsgnjn.s, 0, 1, 1)

  TEST_FSGNJS(30, fsgnjx.s, 0, 0, 0)
  TEST_FSGNJS(31, fsgnjx.s, 1, 0, 1)
  TEST_FSGNJS(32, fsgnjx.s, 1, 1, 0)
  TEST_FSGNJS(33, fsgnjx.s, 0, 1, 1)

  TEST_PASSFAIL

RVTEST_CODE_END

  .data
RVTEST_DATA_BEGIN

  TEST_DATA

RVTEST_DATA_END