Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / tests / tcg / sh4 / test-addv.c
blobca87fe746ad845a01d6e71e4fccd6177b124fb74
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <limits.h>
4 #include <stdio.h>
5 #include <stdlib.h>
7 static void addv(const int a, const int b, const int res, const int carry)
9 int o = a, c;
11 asm volatile("addv %2,%0\n"
12 "movt %1\n"
13 : "+r"(o), "=r"(c) : "r"(b) : );
15 if (c != carry || o != res) {
16 printf("ADDV %d, %d = %d/%d [T = %d/%d]\n", a, b, o, res, c, carry);
17 abort();
21 int main(void)
23 addv(INT_MAX, 1, INT_MIN, 1);
24 addv(INT_MAX - 1, 1, INT_MAX, 0);
26 return 0;