* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / dfp / operator-assignment.c
blobfaadf1e865094ad54287bea196cfb3bc3f3f08f8
1 /* C99 6.5.16 Assignment operators.
2 Verify the compound assignment operator for decimal float types,
3 using it with other decimal float types, integers, and other binary
4 float types cast to decimal float types. */
6 #include "dfp-dbg.h"
8 #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
9 if (( OPRD1 OPRT OPRD2 )!= RLT) \
10 FAILURE
12 #define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
13 { \
14 _Decimal##TYPE d = OPRD; \
15 OPERATE(d,+=,1,(OPRD + 1)); \
16 d = OPRD; \
17 OPERATE(d,+=,0,OPRD); \
18 d = OPRD; \
19 OPERATE(d,+=,(-1),(OPRD - 1)); \
20 d = OPRD; \
21 OPERATE(d,+=,d32a,(OPRD + d32a)); \
22 d = OPRD; \
23 OPERATE(d,+=,d64a,(OPRD + d64a)); \
24 d = OPRD; \
25 OPERATE(d,+=,d128a,(OPRD + d128a)); \
26 d = OPRD; \
27 OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \
28 d = OPRD; \
29 OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \
30 d = OPRD; \
31 OPERATE(d,-=,1,(OPRD - 1)); \
32 d = OPRD; \
33 OPERATE(d,-=,0,OPRD); \
34 d = OPRD; \
35 OPERATE(d,-=,(-1),(OPRD + 1)); \
36 d = OPRD; \
37 OPERATE(d,-=,d32a,OPRD-d32a); \
38 d = OPRD; \
39 OPERATE(d,-=,d64a,OPRD-d64a); \
40 d = OPRD; \
41 OPERATE(d,-=,d128a,OPRD-d128a); \
44 int
45 main ()
47 _Decimal32 d32 = 1.23456df, d32a = 1.2df;
48 _Decimal64 d64 = 23.456789dd, d64a = 2.8dd;
49 _Decimal128 d128 = 345.67890123456789dl, d128a = 4.7dl;
51 DECIMAL_COMPOUND_ASSIGNMENT(32, d32);
52 DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
53 DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
55 FINISH