xref: /openbmc/qemu/tests/tcg/aarch64/test-2248.c (revision 2e1cacfb)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* See https://gitlab.com/qemu-project/qemu/-/issues/2248 */
3 
4 #include <assert.h>
5 
6 __attribute__((noinline))
7 long test(long x, long y, long sh)
8 {
9     long r;
10     asm("cmp   %1, %2\n\t"
11         "cset  x12, lt\n\t"
12         "and   w11, w12, #0xff\n\t"
13         "cmp   w11, #0\n\t"
14         "csetm x14, ne\n\t"
15         "lsr   x13, x14, %3\n\t"
16         "sxtb  %0, w13"
17         : "=r"(r)
18         : "r"(x), "r"(y), "r"(sh)
19         : "x11", "x12", "x13", "x14");
20     return r;
21 }
22 
23 int main()
24 {
25     long r = test(0, 1, 2);
26     assert(r == -1);
27     return 0;
28 }
29