Correctly convert APInt to gmp values

Previously this happend to work for integers up to i64, but we got it wrong
for larger numbers. Fix this and add test cases to verify this keeps working.

Reported by: Sven Verdoolaege <skimo at kotnet dot org>

llvm-svn: 183986
diff --git a/polly/lib/Support/GICHelper.cpp b/polly/lib/Support/GICHelper.cpp
index 876e132..f1fe15a 100644
--- a/polly/lib/Support/GICHelper.cpp
+++ b/polly/lib/Support/GICHelper.cpp
@@ -33,8 +33,7 @@
   const uint64_t *rawdata = abs.getRawData();
   unsigned numWords = abs.getNumWords();
 
-  // TODO: Check if this is true for all platforms.
-  mpz_import(v, numWords, 1, sizeof(uint64_t), 0, 0, rawdata);
+  mpz_import(v, numWords, -1, sizeof(uint64_t), 0, 0, rawdata);
 
   if (is_signed && apint.isNegative())
     mpz_neg(v, v);
@@ -44,7 +43,7 @@
   uint64_t *p = NULL;
   size_t sz;
 
-  p = (uint64_t *)mpz_export(p, &sz, 1, sizeof(uint64_t), 0, 0, mpz);
+  p = (uint64_t *)mpz_export(p, &sz, -1, sizeof(uint64_t), 0, 0, mpz);
 
   if (p) {
     APInt A((unsigned) mpz_sizeinbase(mpz, 2), (unsigned) sz, p);