From e1ff93a4d94a0178f54d28ec99fed40f259d9995 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 31 May 2018 17:00:04 -0700 Subject: [PATCH] [flang] More tests; full build and test cycle. Original-commit: flang-compiler/f18@ac363643042cbb3c39234196f2a8c815af359199 Reviewed-on: https://github.com/flang-compiler/f18/pull/101 Tree-same-pre-rewrite: false --- flang/lib/evaluate/fixed-point.h | 9 +++------ flang/test/evaluate/fixed-point-test.cc | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/flang/lib/evaluate/fixed-point.h b/flang/lib/evaluate/fixed-point.h index e490762..4d9eddb 100644 --- a/flang/lib/evaluate/fixed-point.h +++ b/flang/lib/evaluate/fixed-point.h @@ -360,7 +360,7 @@ public: // "size" bits are shifted circularly in place by "count" positions; // the shift is leftward if count is nonnegative, rightward otherwise. // Higher-order bits are unchanged. - constexpr FixedPoint ISHFTC(int count, int size) const { + constexpr FixedPoint ISHFTC(int count, int size = bits) const { if (count == 0 || size <= 0) { return *this; } @@ -370,11 +370,8 @@ public: if ((count %= size) == 0) { return *this; } - int middleBits, leastBits; - if (count > 0) { - middleBits = size - count; - leastBits = count; - } else { + int middleBits{size - count}, leastBits{count}; + if (count < 0) { middleBits = -count; leastBits = size + count; } diff --git a/flang/test/evaluate/fixed-point-test.cc b/flang/test/evaluate/fixed-point-test.cc index c710573..ad0717e 100644 --- a/flang/test/evaluate/fixed-point-test.cc +++ b/flang/test/evaluate/fixed-point-test.cc @@ -75,7 +75,11 @@ template> void exhaustiveTesting() { } } MATCH(trailcheck, a.TRAILZ())("%s, x=0x%llx", desc, x); - // TODO test BTEST, DIM, MODULO, ISHFTC, DSHIFTL/R + for (int j{0}; j < BITS; ++j) { + MATCH((x >> j) & 1, a.BTEST(j)) + ("%s, x=0x%llx, bit %d", desc, x, j); + } + // TODO test DIM, MODULO, ISHFTC, DSHIFTL/R // TODO test IBCLR, IBSET, IBITS, MAX, MIN, MERGE_BITS, RANGE, SIGN Ordering ord{Ordering::Equal}; -- 2.7.4