master
c 24 lines 500 Bytes
Raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* See https://gitlab.com/qemu-project/qemu/-/issues/2185 */
3
4 #include <assert.h>
5
6 int test_setc(unsigned int x, unsigned int y)
7 {
8 asm("blsi %1, %0; setc %b0" : "+r"(x) : "r"(y));
9 return (unsigned char)x;
10 }
11
12 int test_pushf(unsigned int x, unsigned int y)
13 {
14 asm("blsi %1, %0; pushf; pop %q0" : "+r"(x) : "r"(y));
15 return x & 1;
16 }
17
18 int main()
19 {
20 assert(test_setc(1, 0xedbf530a));
21 assert(test_pushf(1, 0xedbf530a));
22 return 0;
23 }
24