Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / tests / tcg / x86_64 / test-2413.c
blob456e5332fc2bd909d93b80cc82178ec0996d811a
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Copyright 2024 Linaro, Ltd. */
3 /* See https://gitlab.com/qemu-project/qemu/-/issues/2413 */
5 #include <assert.h>
7 void test(unsigned long *a, unsigned long *d, unsigned long c)
9 asm("xorl %%eax, %%eax\n\t"
10 "xorl %%edx, %%edx\n\t"
11 "testb $0x20, %%cl\n\t"
12 "sete %%al\n\t"
13 "setne %%dl\n\t"
14 "shll %%cl, %%eax\n\t"
15 "shll %%cl, %%edx\n\t"
16 : "=a"(*a), "=d"(*d)
17 : "c"(c));
20 int main(void)
22 unsigned long a, c, d;
24 for (c = 0; c < 64; c++) {
25 test(&a, &d, c);
26 assert(a == (c & 0x20 ? 0 : 1u << (c & 0x1f)));
27 assert(d == (c & 0x20 ? 1u << (c & 0x1f) : 0));
29 return 0;