diff options
Diffstat (limited to 'tests/tcg/hexagon/mem_noshuf_exception.c')
| -rw-r--r-- | tests/tcg/hexagon/mem_noshuf_exception.c | 52 |
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; |