f2076c8f54c2d71d6058c7502b0176f0c05607ec
[riscv-tests.git] / isa / rv64ui / fence_i.S
1 # See LICENSE for license details.
2
3 #*****************************************************************************
4 # fence_i.S
5 #-----------------------------------------------------------------------------
6 #
7 # Test self-modifying code and the fence.i instruction.
8 #
9
10 #include "riscv_test.h"
11 #include "test_macros.h"
12
13 RVTEST_RV64U
14 RVTEST_CODE_BEGIN
15
16 li a3, 111
17 la a0, 3f
18 la a1, 1f
19 la a2, 2f
20 lw a0, 0(a0)
21
22 # test I$ hit
23 .align 6
24 sw a0, 0(a1)
25 .align 2
26 fence.i
27
28 1: addi a3, a3, 222
29 TEST_CASE( 2, a3, 444, nop )
30
31 # test prefetcher hit
32 li a4, 100
33 1: addi a4, a4, -1
34 bnez a4, 1b
35
36 sw a0, 0(a2)
37 fence.i
38
39 .align 6
40 2: addi a3, a3, 555
41 TEST_CASE( 3, a3, 777, nop )
42
43 3: addi a3, a3, 333
44
45 TEST_PASSFAIL
46
47 RVTEST_CODE_END
48
49 .data
50 RVTEST_DATA_BEGIN
51
52 TEST_DATA
53
54 RVTEST_DATA_END