[flang] More tests; full build and test cycle.
authorpeter klausler <pklausler@nvidia.com>
Fri, 1 Jun 2018 00:00:04 +0000 (17:00 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 14 Jun 2018 20:52:30 +0000 (13:52 -0700)
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
flang/test/evaluate/fixed-point-test.cc

index e490762..4d9eddb 100644 (file)
@@ -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;
     }
index c710573..ad0717e 100644 (file)
@@ -75,7 +75,11 @@ template<int BITS, typename FP = FixedPoint<BITS>> 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};