diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c new file mode 100644 index 000000000..faadf1e86 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/dfp/operator-assignment.c @@ -0,0 +1,56 @@ +/* C99 6.5.16 Assignment operators. + Verify the compound assignment operator for decimal float types, + using it with other decimal float types, integers, and other binary + float types cast to decimal float types. */ + +#include "dfp-dbg.h" + +#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ + if (( OPRD1 OPRT OPRD2 )!= RLT) \ + FAILURE + +#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \ +{ \ + _Decimal##TYPE d = OPRD; \ + OPERATE(d,+=,1,(OPRD + 1)); \ + d = OPRD; \ + OPERATE(d,+=,0,OPRD); \ + d = OPRD; \ + OPERATE(d,+=,(-1),(OPRD - 1)); \ + d = OPRD; \ + OPERATE(d,+=,d32a,(OPRD + d32a)); \ + d = OPRD; \ + OPERATE(d,+=,d64a,(OPRD + d64a)); \ + d = OPRD; \ + OPERATE(d,+=,d128a,(OPRD + d128a)); \ + d = OPRD; \ + OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \ + d = OPRD; \ + OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \ + d = OPRD; \ + OPERATE(d,-=,1,(OPRD - 1)); \ + d = OPRD; \ + OPERATE(d,-=,0,OPRD); \ + d = OPRD; \ + OPERATE(d,-=,(-1),(OPRD + 1)); \ + d = OPRD; \ + OPERATE(d,-=,d32a,OPRD-d32a); \ + d = OPRD; \ + OPERATE(d,-=,d64a,OPRD-d64a); \ + d = OPRD; \ + OPERATE(d,-=,d128a,OPRD-d128a); \ +} + +int +main () +{ + _Decimal32 d32 = 1.23456df, d32a = 1.2df; + _Decimal64 d64 = 23.456789dd, d64a = 2.8dd; + _Decimal128 d128 = 345.67890123456789dl, d128a = 4.7dl; + + DECIMAL_COMPOUND_ASSIGNMENT(32, d32); + DECIMAL_COMPOUND_ASSIGNMENT(64, d64); + DECIMAL_COMPOUND_ASSIGNMENT(128, d128); + + FINISH +} |