Skip to contentSkip to conversation

Hexagon tests: fix test_load_tmp2 and non-portable format

PATCH New Matheus Tavares Bernardino 1 participant 3 messages May 30, 2023

lore
Share & tools
lore
#0 lore raw

cover Hexagon tests: fix test_load_tmp2 and non-portable format

This series includes two fixes on hexagon test files: one for a non-porable printf specifier, and the other for the use of an uninitialized register.

Marco Liebel (1):
Hexagon (hvx_misc test): fix uninitialized regs at test_load_tmp2

Matheus Tavares Bernardino (1):
Hexagon (tests/.../hex_test.h): use portable printf formats

 tests/tcg/hexagon/hex_test.h | 14 ++++++++++----
 tests/tcg/hexagon/hvx_misc.c |  7 ++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)
Signature · 1 line
2.37.2
#1 lore raw

PATCH 1/2 Hexagon (hvx_misc test): fix uninitialized regs at test_load_tmp2

From: Marco Liebel <[email protected]>

This test case was using some vector registers which were not properly initialized.

---
 tests/tcg/hexagon/hvx_misc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/tcg/hexagon/hvx_misc.c +6 -1
index b45170acd1..b56b8f9cc5 100644
@@ -66,6 +66,11 @@ static void test_load_tmp2(void)
     void *pout1 = &output[1];
 
     asm volatile(
+        "r0 = #0x0\n\t"
+        "v14 = vsplat(r0)\n\t"
+        "v15 = vsplat(r0)\n\t"
+        "v24 = vsplat(r0)\n\t"
+        "v25 = vsplat(r0)\n\t"
         "r0 = #0x03030303\n\t"
         "v16 = vsplat(r0)\n\t"
         "r0 = #0x04040404\n\t"
@@ -79,7 +84,7 @@ static void test_load_tmp2(void)
         "vmem(%0 + #0) = v24\n\t"
         "vmem(%1 + #0) = v25\n\t"
         : : "r"(pout0), "r"(pout1)
-        : "r0", "v16", "v18", "v21", "v24", "v25", "memory"
+        : "r0", "v14", "v15", "v16", "v18", "v21", "v24", "v25", "memory"
     );
 
     for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; ++i) {
Signature · 1 line
2.37.2
#2 lore raw

PATCH 2/2 Hexagon (tests/.../hex_test.h): use portable printf formats

In reply to Matheus Tavares Bernardino

This fixes compiler messages like "warning: format specifies type 'unsigned int' but the argument has type 'uint32_t' (aka 'unsigned long') [-Wformat]".

---
 tests/tcg/hexagon/hex_test.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
tests/tcg/hexagon/hex_test.h +10 -4
index cfed06a58b..fe253b56e5 100644
@@ -19,10 +19,13 @@
 #ifndef HEX_TEST_H
 #define HEX_TEST_H
 
+#include <inttypes.h>
+
 static inline void __check32(int line, uint32_t val, uint32_t expect)
 {
     if (val != expect) {
-        printf("ERROR at line %d: 0x%08x != 0x%08x\n", line, val, expect);
+        printf("ERROR at line %d: 0x%08"PRIx32" != 0x%08"PRIx32"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -32,7 +35,8 @@ static inline void __check32(int line, uint32_t val, uint32_t expect)
 static inline void __check64(int line, uint64_t val, uint64_t expect)
 {
     if (val != expect) {
-        printf("ERROR at line %d: 0x%016llx != 0x%016llx\n", line, val, expect);
+        printf("ERROR at line %d: 0x%016"PRIx64" != 0x%016"PRIx64"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -62,7 +66,8 @@ static inline void __checkp(int line, void *p, void *expect)
 static inline void __check32_ne(int line, uint32_t val, uint32_t expect)
 {
     if (val == expect) {
-        printf("ERROR at line %d: 0x%08x == 0x%08x\n", line, val, expect);
+        printf("ERROR at line %d: 0x%08"PRIx32" == 0x%08"PRIx32"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -72,7 +77,8 @@ static inline void __check32_ne(int line, uint32_t val, uint32_t expect)
 static inline void __check64_ne(int line, uint64_t val, uint64_t expect)
 {
     if (val == expect) {
-        printf("ERROR at line %d: 0x%016llx == 0x%016llx\n", line, val, expect);
+        printf("ERROR at line %d: 0x%016"PRIx64" == 0x%016"PRIx64"\n",
+               line, val, expect);
         err++;
     }
 }
Signature · 1 line
2.37.2