Updating sv_sraw_elwidth to use SV_ELWIDTH_TEST from sv_test_macros.h
authorDaniel Benusovich <flyingmonkeys1996@gmail.com>
Mon, 10 Dec 2018 07:17:59 +0000 (23:17 -0800)
committerDaniel Benusovich <flyingmonkeys1996@gmail.com>
Mon, 10 Dec 2018 07:17:59 +0000 (23:17 -0800)
isa/rv64ui/sv_sraw_elwidth.S

index 38dc3f344daaf73bf9ae81c1fd26d4ea18ea3476..095f6fba335d53e5d41106a0e5fa850fff7c1296 100644 (file)
@@ -3,44 +3,6 @@
 
 RVTEST_RV64U        # Define TVM used by program.
 
-// TODO: add extra "code" argument and "testdata" argument,
-// replace "sraw" with "code"
-// TODO: move SV_ELWIDTH_TEST to sv_test_macros.h
-// TODO: probably remove testing of x15 and x16 (or pass in as extra args?)
-
-#define SV_ELWIDTH_TEST( vl, wid1, wid2, wid3, isvec1, isvec2, isvec3, \
-                         expect1, expect2, expect3 ) \
-                                                        \
-        SV_LDD_DATA( x12, testdata   , 0);               \
-        SV_LDD_DATA( x13, testdata+8 , 0);               \
-        SV_LDD_DATA( x14, testdata+16, 0);               \
-        SV_LDD_DATA( x15, testdata+24, 0);               \
-        SV_LDD_DATA( x16, testdata+32, 0);               \
-        SV_LDD_DATA( x17, testdata+40, 0);               \
-                                                        \
-        li x28, 0xa5a5a5a5a5a5a5a5;                                      \
-        li x29, 0xa5a5a5a5a5a5a5a5;                                      \
-        li x30, 0xa5a5a5a5a5a5a5a5;                                      \
-                                                        \
-        SET_SV_MVL( vl );                                  \
-        SET_SV_3CSRS( SV_REG_CSR( 1, 15, wid1, 15, isvec1),       \
-                      SV_REG_CSR( 1, 12, wid2, 12, isvec2),        \
-                      SV_REG_CSR( 1, 28, wid3, 28, isvec3));       \
-        SET_SV_VL( vl );                                   \
-                                                        \
-        sraw   x28, x15, x12;                              \
-                                                        \
-        CLR_SV_CSRS();                                  \
-        SET_SV_VL( 1);                                   \
-        SET_SV_MVL( 1);                                  \
-                                                        \
-        TEST_SV_IMM( x28, expect1 );                         \
-        TEST_SV_IMM( x29, expect2 );                       \
-        TEST_SV_IMM( x30, expect3 );                       \
-        TEST_SV_IMM( x15, 0x0000005242322212);                       \
-        TEST_SV_IMM( x16, 0x0000005141312111);
-
-
 # SV test: vector-vector add
 #
 # sets up x3 and x4 with data, sets VL to 2, and carries out
@@ -49,19 +11,24 @@ RVTEST_RV64U        # Define TVM used by program.
 # Test code region.
 RVTEST_CODE_BEGIN   # Start of test code.
 
-        # TODO: add "sraw" argument, add testdata argument
-        SV_ELWIDTH_TEST(  3, 0, 0, 0, 1, 1, 1,
-                0x21,  0x82,  0x0000000000000000 )
-        SV_ELWIDTH_TEST(  3, 0, 0, 3, 1, 1, 1,
-                0x0000008200000021,  0xa5a5a5a500000000,  0xa5a5a5a5a5a5a5a5 )
-        SV_ELWIDTH_TEST(  3, 1, 1, 0, 1, 1, 1,
-                0x9,  0x11,  0x19 )
-        SV_ELWIDTH_TEST(  3, 1, 1, 3, 1, 1, 1,
-                0x0000001100000009,  0xa5a5a5a500000019,  0xa5a5a5a5a5a5a5a5 )
-        SV_ELWIDTH_TEST(  3, 1, 1, 2, 1, 1, 1,
-                0xa5a5001900110009,  0xa5a5a5a5a5a5a5a5,  0xa5a5a5a5a5a5a5a5 )
-        SV_ELWIDTH_TEST(  3, 1, 1, 1, 1, 1, 1,
-                0xa5a5a5a5a5191109,  0xa5a5a5a5a5a5a5a5,  0xa5a5a5a5a5a5a5a5 )
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_DFLT, SV_W_DFLT, SV_W_DFLT, 1, 1, 1,
+               0x21, 0x82, 0x0000000000000000)
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_DFLT, SV_W_DFLT, SV_W_32BIT, 1, 1, 1,
+               0x0000008200000021, 0xa5a5a5a500000000, 0xa5a5a5a5a5a5a5a5)
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_8BIT, SV_W_8BIT, SV_W_DFLT, 1, 1, 1,
+               0x9, 0x11, 0x19)
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_8BIT, SV_W_8BIT, SV_W_32BIT, 1, 1, 1,
+               0x0000001100000009, 0xa5a5a5a500000019, 0xa5a5a5a5a5a5a5a5)
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_8BIT, SV_W_8BIT, SV_W_16BIT, 1, 1, 1,
+               0xa5a5001900110009, 0xa5a5a5a5a5a5a5a5, 0xa5a5a5a5a5a5a5a5)
+       SV_ELWIDTH_TEST(sraw, SV_LDD_DATA, testdata, 8, 0,
+               3, SV_W_8BIT, SV_W_8BIT, SV_W_8BIT, 1, 1, 1,
+               0xa5a5a5a5a5191109, 0xa5a5a5a5a5a5a5a5, 0xa5a5a5a5a5a5a5a5)
 
         RVTEST_PASS           # Signal success.
 fail: