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