xref: /openbmc/qemu/tests/tcg/s390x/epsw.c (revision 05caa062)
1 /*
2  * Test the EPSW instruction.
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 #include <assert.h>
7 #include <stdlib.h>
8 
9 int main(void)
10 {
11     unsigned long r1 = 0x1234567887654321UL, r2 = 0x8765432112345678UL;
12 
13     asm("cr %[r1],%[r2]\n"  /* cc = 1 */
14         "epsw %[r1],%[r2]"
15         : [r1] "+r" (r1), [r2] "+r" (r2) : : "cc");
16 
17     /* Do not check the R and RI bits. */
18     r1 &= ~0x40000008UL;
19     assert(r1 == 0x1234567807051001UL);
20     assert(r2 == 0x8765432180000000UL);
21 
22     return EXIT_SUCCESS;
23 }
24