summary refs log tree commit diff stats
path: root/tests/tcg/hexagon/mem_noshuf_exception.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-05-26 09:25:42 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-05-26 09:25:42 -0700
commit9c9fff18c45b54fd9adf2282323aab1b6f0ec866 (patch)
tree9e2a0fef7a8ed9e22c6de6b112fc8655e64b1804 /tests/tcg/hexagon/mem_noshuf_exception.c
parentf9bdb3818faae00b950f6a09eda1fa40193ef1f5 (diff)
parent7d196e2196d50e0dda0f87f396d4f4a7ad9aafbe (diff)
downloadfocaccia-qemu-9c9fff18c45b54fd9adf2282323aab1b6f0ec866.tar.gz
focaccia-qemu-9c9fff18c45b54fd9adf2282323aab1b6f0ec866.zip
Merge tag 'pull-hex-20230526' of https://github.com/quic/qemu into staging
Hexagon update

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEENjXHiM5iuR/UxZq0ewJE+xLeRCIFAmRwv6QACgkQewJE+xLe
# RCLRvQf/e0utA8/KAYwmay4dYiiVlrtJ4UVpwogQ8JC7je5H2+Gv633P4BF8uGAF
# HmhdUk031jvG/BvKGH+493ESKgtIX3caLxJInPtYu3elqKxZhqKpke2VPF3srrwI
# Mli8IqdwE2scSilG591xTjhU8vBGSm+hiQptSg9OaSotVcH8Qc/32+vudnr2JZtK
# ko3MqISMW/KvfD+x47UcX4IX4bmQfDyysQITQs9lfwYgzv/4drl6/7CUFQZ3b8Go
# Rz4ClbYhKT8YybJjX+yaKuTaHSrL9r0+90ORzYisEYcPiOOChmy9vv4HbZ1zTCbY
# MVJM69IPdZDi1quE00jULYEEPrHRoA==
# =vczK
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 26 May 2023 07:18:12 AM PDT
# gpg:                using RSA key 3635C788CE62B91FD4C59AB47B0244FB12DE4422
# gpg: Good signature from "Taylor Simpson (Rock on) <tsimpson@quicinc.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 3635 C788 CE62 B91F D4C5  9AB4 7B02 44FB 12DE 4422

* tag 'pull-hex-20230526' of https://github.com/quic/qemu:
  Hexagon (target/hexagon) Change Hexagon maintainer
  Hexagon: fix outdated `hex_new_*` comments
  target/hexagon/*.py: clean up used 'toss' and 'numregs' vars
  Hexagon (target/hexagon) Fix assignment to tmp registers
  Hexagon (tests/tcg/hexagon) Clean up Hexagon check-tcg tests

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/tcg/hexagon/mem_noshuf_exception.c')
-rw-r--r--tests/tcg/hexagon/mem_noshuf_exception.c52
1 files changed, 18 insertions, 34 deletions
diff --git a/tests/tcg/hexagon/mem_noshuf_exception.c b/tests/tcg/hexagon/mem_noshuf_exception.c
index 08660ea3e1..61108a99be 100644
--- a/tests/tcg/hexagon/mem_noshuf_exception.c
+++ b/tests/tcg/hexagon/mem_noshuf_exception.c
@@ -1,5 +1,5 @@
 /*
- *  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
@@ -34,6 +34,8 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <fcntl.h>
@@ -41,49 +43,31 @@
 #include <signal.h>
 
 int err;
-int segv_caught;
 
-#define SHOULD_NOT_CHANGE_VAL        5
-int should_not_change = SHOULD_NOT_CHANGE_VAL;
-
-#define OK_TO_CHANGE_VAL        13
-int ok_to_change = OK_TO_CHANGE_VAL;
-
-static void __check(const char *filename, int line, int x, int expect)
-{
-    if (x != expect) {
-        printf("ERROR %s:%d - %d != %d\n",
-               filename, line, x, expect);
-        err++;
-    }
-}
+#include "hex_test.h"
 
-#define check(x, expect) __check(__FILE__, __LINE__, (x), (expect))
+bool segv_caught;
 
-static void __chk_error(const char *filename, int line, int ret)
-{
-    if (ret < 0) {
-        printf("ERROR %s:%d - %d\n", filename, line, ret);
-        err++;
-    }
-}
+#define SHOULD_NOT_CHANGE_VAL        5
+int32_t should_not_change = SHOULD_NOT_CHANGE_VAL;
 
-#define chk_error(ret) __chk_error(__FILE__, __LINE__, (ret))
+#define OK_TO_CHANGE_VAL        13
+int32_t ok_to_change = OK_TO_CHANGE_VAL;
 
 jmp_buf jmp_env;
 
 static void sig_segv(int sig, siginfo_t *info, void *puc)
 {
-    check(sig, SIGSEGV);
-    segv_caught = 1;
+    check32(sig, SIGSEGV);
+    segv_caught = true;
     longjmp(jmp_env, 1);
 }
 
 int main()
 {
     struct sigaction act;
-    int dummy32;
-    long long dummy64;
+    int32_t dummy32;
+    int64_t dummy64;
     void *p;
 
     /* SIGSEGV test */
@@ -106,8 +90,8 @@ int main()
     act.sa_flags = 0;
     chk_error(sigaction(SIGSEGV, &act, NULL));
 
-    check(segv_caught, 1);
-    check(should_not_change, SHOULD_NOT_CHANGE_VAL);
+    check32(segv_caught, true);
+    check32(should_not_change, SHOULD_NOT_CHANGE_VAL);
 
     /*
      * Check that a predicated load where the predicate is false doesn't
@@ -122,7 +106,7 @@ int main()
                  "}:mem_noshuf\n\t"
                   : "=r"(dummy32) : : "r18", "r19", "p0", "memory");
 
-    check(ok_to_change, 7);
+    check32(ok_to_change, 7);
 
     /*
      * Also check that the post-increment doesn't happen when the
@@ -138,8 +122,8 @@ int main()
                  "}:mem_noshuf\n\t"
                   : "+r"(p), "=r"(dummy64) : : "r18", "p0", "memory");
 
-    check(ok_to_change, 9);
-    check((int)p, (int)NULL);
+    check32(ok_to_change, 9);
+    check32((int)p, (int)NULL);
 
     puts(err ? "FAIL" : "PASS");
     return err ? EXIT_FAILURE : EXIT_SUCCESS;