summary refs log tree commit diff stats
path: root/tests/tcg/hexagon/reg_mut.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/hexagon/reg_mut.c')
-rw-r--r--tests/tcg/hexagon/reg_mut.c54
1 files changed, 17 insertions, 37 deletions
diff --git a/tests/tcg/hexagon/reg_mut.c b/tests/tcg/hexagon/reg_mut.c
index 910e663ace..c5a39e5510 100644
--- a/tests/tcg/hexagon/reg_mut.c
+++ b/tests/tcg/hexagon/reg_mut.c
@@ -1,6 +1,6 @@
 
 /*
- *  Copyright(c) 2022 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *  Copyright(c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -21,27 +21,7 @@
 
 static int err;
 
-#define check(N, EXPECT) \
-    do { \
-        uint64_t value = N; \
-        uint64_t expect = EXPECT; \
-        if (value != EXPECT) { \
-            printf("ERROR: \"%s\" 0x%04llx != 0x%04llx at %s:%d\n", #N, value, \
-                   expect, __FILE__, __LINE__); \
-            err++; \
-        } \
-    } while (0)
-
-#define check_ne(N, EXPECT) \
-    do { \
-        uint64_t value = N; \
-        uint64_t expect = EXPECT; \
-        if (value == EXPECT) { \
-            printf("ERROR: \"%s\" 0x%04llx == 0x%04llx at %s:%d\n", #N, value, \
-                   expect, __FILE__, __LINE__); \
-            err++; \
-        } \
-    } while (0)
+#include "hex_test.h"
 
 #define WRITE_REG_NOCLOBBER(output, reg_name, input) \
     asm volatile(reg_name " = %1\n\t" \
@@ -85,35 +65,35 @@ static inline void write_control_registers(void)
     uint32_t result = 0;
 
     WRITE_REG_NOCLOBBER(result, "usr", 0xffffffff);
-    check(result, 0x3ecfff3f);
+    check32(result, 0x3ecfff3f);
 
     WRITE_REG_NOCLOBBER(result, "gp", 0xffffffff);
-    check(result, 0xffffffc0);
+    check32(result, 0xffffffc0);
 
     WRITE_REG_NOCLOBBER(result, "upcyclelo", 0xffffffff);
-    check(result, 0x00000000);
+    check32(result, 0x00000000);
 
     WRITE_REG_NOCLOBBER(result, "upcyclehi", 0xffffffff);
-    check(result, 0x00000000);
+    check32(result, 0x00000000);
 
     WRITE_REG_NOCLOBBER(result, "utimerlo", 0xffffffff);
-    check(result, 0x00000000);
+    check32(result, 0x00000000);
 
     WRITE_REG_NOCLOBBER(result, "utimerhi", 0xffffffff);
-    check(result, 0x00000000);
+    check32(result, 0x00000000);
 
     /*
      * PC is special.  Setting it to these values
      * should cause a catastrophic failure.
      */
     WRITE_REG_ENCODED(result, "pc", 0x00000000, PC_EQ_R0);
-    check_ne(result, 0x00000000);
+    check32_ne(result, 0x00000000);
 
     WRITE_REG_ENCODED(result, "pc", 0x00000001, PC_EQ_R0);
-    check_ne(result, 0x00000001);
+    check32_ne(result, 0x00000001);
 
     WRITE_REG_ENCODED(result, "pc", 0xffffffff, PC_EQ_R0);
-    check_ne(result, 0xffffffff);
+    check32_ne(result, 0xffffffff);
 }
 
 static inline void write_control_register_pairs(void)
@@ -121,23 +101,23 @@ static inline void write_control_register_pairs(void)
     uint64_t result = 0;
 
     WRITE_REG_NOCLOBBER(result, "c11:10", 0xffffffffffffffff);
-    check(result, 0xffffffc0ffffffff);
+    check64(result, 0xffffffc0ffffffff);
 
     WRITE_REG_NOCLOBBER(result, "c15:14", 0xffffffffffffffff);
-    check(result, 0x0000000000000000);
+    check64(result, 0x0000000000000000);
 
     WRITE_REG_NOCLOBBER(result, "c31:30", 0xffffffffffffffff);
-    check(result, 0x0000000000000000);
+    check64(result, 0x0000000000000000);
 
     WRITE_REG_PAIR_ENCODED(result, "c9:8", (uint64_t) 0x0000000000000000,
                            C9_8_EQ_R1_0);
-    check_ne(result, 0x000000000000000);
+    check64_ne(result, 0x000000000000000);
 
     WRITE_REG_PAIR_ENCODED(result, "c9:8", 0x0000000100000000, C9_8_EQ_R1_0);
-    check_ne(result, 0x0000000100000000);
+    check64_ne(result, 0x0000000100000000);
 
     WRITE_REG_PAIR_ENCODED(result, "c9:8", 0xffffffffffffffff, C9_8_EQ_R1_0);
-    check_ne(result, 0xffffffffffffffff);
+    check64_ne(result, 0xffffffffffffffff);
 }
 
 int main()