1# See LICENSE for license details.
2
3#*****************************************************************************
4# bgeu.S
5#-----------------------------------------------------------------------------
6#
7# Test bgeu instruction.
8#
9
10#include "riscv_test.h"
11#include "test_macros.h"
12
13RVTEST_RV64U
14RVTEST_CODE_BEGIN
15
16  #-------------------------------------------------------------
17  # Branch tests
18  #-------------------------------------------------------------
19
20  # Each test checks both forward and backward branches
21
22  TEST_BR2_OP_TAKEN( 2, bgeu, 0x00000000, 0x00000000 );
23  TEST_BR2_OP_TAKEN( 3, bgeu, 0x00000001, 0x00000001 );
24  TEST_BR2_OP_TAKEN( 4, bgeu, 0xffffffff, 0xffffffff );
25  TEST_BR2_OP_TAKEN( 5, bgeu, 0x00000001, 0x00000000 );
26  TEST_BR2_OP_TAKEN( 6, bgeu, 0xffffffff, 0xfffffffe );
27  TEST_BR2_OP_TAKEN( 7, bgeu, 0xffffffff, 0x00000000 );
28
29  TEST_BR2_OP_NOTTAKEN(  8, bgeu, 0x00000000, 0x00000001 );
30  TEST_BR2_OP_NOTTAKEN(  9, bgeu, 0xfffffffe, 0xffffffff );
31  TEST_BR2_OP_NOTTAKEN( 10, bgeu, 0x00000000, 0xffffffff );
32  TEST_BR2_OP_NOTTAKEN( 11, bgeu, 0x7fffffff, 0x80000000 );
33
34  #-------------------------------------------------------------
35  # Bypassing tests
36  #-------------------------------------------------------------
37
38  TEST_BR2_SRC12_BYPASS( 12, 0, 0, bgeu, 0xefffffff, 0xf0000000 );
39  TEST_BR2_SRC12_BYPASS( 13, 0, 1, bgeu, 0xefffffff, 0xf0000000 );
40  TEST_BR2_SRC12_BYPASS( 14, 0, 2, bgeu, 0xefffffff, 0xf0000000 );
41  TEST_BR2_SRC12_BYPASS( 15, 1, 0, bgeu, 0xefffffff, 0xf0000000 );
42  TEST_BR2_SRC12_BYPASS( 16, 1, 1, bgeu, 0xefffffff, 0xf0000000 );
43  TEST_BR2_SRC12_BYPASS( 17, 2, 0, bgeu, 0xefffffff, 0xf0000000 );
44
45  TEST_BR2_SRC12_BYPASS( 18, 0, 0, bgeu, 0xefffffff, 0xf0000000 );
46  TEST_BR2_SRC12_BYPASS( 19, 0, 1, bgeu, 0xefffffff, 0xf0000000 );
47  TEST_BR2_SRC12_BYPASS( 20, 0, 2, bgeu, 0xefffffff, 0xf0000000 );
48  TEST_BR2_SRC12_BYPASS( 21, 1, 0, bgeu, 0xefffffff, 0xf0000000 );
49  TEST_BR2_SRC12_BYPASS( 22, 1, 1, bgeu, 0xefffffff, 0xf0000000 );
50  TEST_BR2_SRC12_BYPASS( 23, 2, 0, bgeu, 0xefffffff, 0xf0000000 );
51
52  #-------------------------------------------------------------
53  # Test delay slot instructions not executed nor bypassed
54  #-------------------------------------------------------------
55
56  TEST_CASE( 24, x1, 3, \
57    li  x1, 1; \
58    bgeu x1, x0, 1f; \
59    addi x1, x1, 1; \
60    addi x1, x1, 1; \
61    addi x1, x1, 1; \
62    addi x1, x1, 1; \
631:  addi x1, x1, 1; \
64    addi x1, x1, 1; \
65  )
66
67  TEST_PASSFAIL
68
69RVTEST_CODE_END
70
71  .data
72RVTEST_DATA_BEGIN
73
74  TEST_DATA
75
76RVTEST_DATA_END
77