aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/aarch64/test-2248.c
blob: aac2e178368ddc9df08424fdc34d226bec8b8228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* See https://gitlab.com/qemu-project/qemu/-/issues/2248 */

#include <assert.h>

__attribute__((noinline))
long test(long x, long y, long sh)
{
    long r;
    asm("cmp   %1, %2\n\t"
        "cset  x12, lt\n\t"
        "and   w11, w12, #0xff\n\t"
        "cmp   w11, #0\n\t"
        "csetm x14, ne\n\t"
        "lsr   x13, x14, %3\n\t"
        "sxtb  %0, w13"
        : "=r"(r)
        : "r"(x), "r"(y), "r"(sh)
        : "x11", "x12", "x13", "x14");
    return r;
}

int main()
{
    long r = test(0, 1, 2);
    assert(r == -1);
    return 0;
}