FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / srnm.c
blobb2948f3277a2bcf04c29f81fb31303b93a95cde3
1 #include <assert.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include "opcodes.h"
6 #define srnm(b,d) \
7 ({ \
8 __asm__ volatile ( "lghi 8," #b "\n\t" \
9 "srnm " #d "(8)\n\t" ::: "8"); \
12 #define get_rounding_mode() \
13 ({ \
14 unsigned fpc; \
15 __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \
16 fpc & 0x7; \
19 int main(void)
21 printf("initial rounding mode = %u\n", get_rounding_mode());
23 /* Set basic rounding modes in various ways */
24 srnm(1,2); // 1 + 2 = 3
25 printf("rounding mode = %u\n", get_rounding_mode());
27 srnm(2,0);
28 printf("rounding mode = %u\n", get_rounding_mode());
30 srnm(0,1);
31 printf("rounding mode = %u\n", get_rounding_mode());
33 srnm(0,0);
34 printf("rounding mode = %u\n", get_rounding_mode());
36 /* Some rounding modes with bits to be ignored */
37 srnm(0xff,0); // -> 3
38 printf("rounding mode = %u\n", get_rounding_mode());
40 srnm(0,0xfe); // -> 2
41 printf("rounding mode = %u\n", get_rounding_mode());
43 srnm(0xf0,0x0f); // -> 3
44 printf("rounding mode = %u\n", get_rounding_mode());
46 return 0;