1# See LICENSE for license details.
2
3#*****************************************************************************
4# amoadd_d.S
5#-----------------------------------------------------------------------------
6#
7# Test amoadd.d instruction.
8#
9
10#include "riscv_test.h"
11#include "test_macros.h"
12
13RVTEST_RV64U
14RVTEST_CODE_BEGIN
15
16  TEST_CASE(2, a4, 0xffffffff80000000, \
17    li a0, 0xffffffff80000000; \
18    li a1, 0xfffffffffffff800; \
19    la a3, amo_operand; \
20    sd a0, 0(a3); \
21    amoadd.d	a4, a1, 0(a3); \
22  )
23
24  TEST_CASE(3, a5, 0xffffffff7ffff800, ld a5, 0(a3))
25
26  # try again after a cache miss
27  TEST_CASE(4, a4, 0xffffffff7ffff800, \
28    amoadd.d a4, a1, 0(a3); \
29  )
30
31  TEST_CASE(5, a5, 0xffffffff7ffff000, ld a5, 0(a3))
32
33  TEST_PASSFAIL
34
35RVTEST_CODE_END
36
37  .data
38RVTEST_DATA_BEGIN
39
40  TEST_DATA
41
42RVTEST_DATA_END
43
44  .bss
45  .align 3
46amo_operand:
47  .dword 0
48