Illumos regtest: updates in none/tests/amd64-solaris
[valgrind.git] / none / tests / s390x / srnmt.c
blob0af5eac04e7e67657dd0f6b88314b9ce14c115be
1 #include <assert.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include "opcodes.h"
6 #define srnmt(b,d) \
7 ({ \
8 __asm__ volatile ( "lghi 8," #b "\n\t" \
9 SRNMT(8,d) \
10 ::: "8"); \
14 /* Like srnmt above, except it uses r0 as a base register */
15 #define srnmt0(d) \
16 ({ \
17 __asm__ volatile ( SRNMT(0,d) \
18 ::: "0"); \
21 #define get_dfp_rounding_mode() \
22 ({ \
23 unsigned fpc; \
24 __asm__ volatile ("stfpc %0" : "=Q"(fpc)); \
25 (fpc & 0x70) >> 4; \
29 int main(void)
31 printf("initial rounding mode = %u\n", get_dfp_rounding_mode());
33 /* Set basic rounding modes in various ways */
34 srnmt(1,002); // 1 + 2 = 3
35 printf("rounding mode = %u\n", get_dfp_rounding_mode());
37 srnmt(2,000);
38 printf("rounding mode = %u\n", get_dfp_rounding_mode());
40 srnmt(0,001);
41 printf("rounding mode = %u\n", get_dfp_rounding_mode());
43 srnmt(0,000);
44 printf("rounding mode = %u\n", get_dfp_rounding_mode());
46 srnmt(7,000);
47 printf("rounding mode = %u\n", get_dfp_rounding_mode());
49 srnmt(0,006);
50 printf("rounding mode = %u\n", get_dfp_rounding_mode());
52 srnmt0(005);
53 printf("rounding mode = %u\n", get_dfp_rounding_mode());
55 srnmt0(004);
56 printf("rounding mode = %u\n", get_dfp_rounding_mode());
58 return 0;