From a335d27e2b3a7c1e2da1304b4439605c11efceb2 Mon Sep 17 00:00:00 2001 From: Zhou Sheng Date: Fri, 19 Jan 2007 14:26:57 +0000 Subject: [PATCH] Cover more arithmetics for arbitrary bitwidth integers. llvm-svn: 33355 --- llvm/test/Integer/a1.ll | 4 ++++ llvm/test/Integer/a1.ll.out | 4 ++++ llvm/test/Integer/a15.ll | 5 +++++ llvm/test/Integer/a15.ll.out | 5 +++++ llvm/test/Integer/a17.ll | 4 ++++ llvm/test/Integer/a17.ll.out | 4 ++++ llvm/test/Integer/a31.ll | 4 ++++ llvm/test/Integer/a31.ll.out | 4 ++++ llvm/test/Integer/a33.ll | 4 ++++ llvm/test/Integer/a33.ll.out | 4 ++++ llvm/test/Integer/a63.ll | 5 +++++ llvm/test/Integer/a63.ll.out | 5 +++++ llvm/test/Integer/a7.ll | 9 +++++++++ llvm/test/Integer/a7.ll.out | 9 +++++++++ llvm/test/Integer/a9.ll | 4 ++++ llvm/test/Integer/a9.ll.out | 4 ++++ llvm/test/Integer/testarith_bt.ll | 3 +++ 17 files changed, 81 insertions(+) diff --git a/llvm/test/Integer/a1.ll b/llvm/test/Integer/a1.ll index 5b9ad374ca1c..1df494445d27 100644 --- a/llvm/test/Integer/a1.ll +++ b/llvm/test/Integer/a1.ll @@ -18,3 +18,7 @@ %n = constant i1 mul(i1 -1, i1 1) %o = constant i1 sdiv(i1 -1, i1 1) %p = constant i1 sdiv(i1 1 , i1 -1) +%q = constant i1 udiv(i1 -1, i1 1) +%r = constant i1 udiv(i1 1, i1 -1) +%s = constant i1 srem(i1 -1, i1 1) +%t = constant i1 urem(i1 -1, i1 1) diff --git a/llvm/test/Integer/a1.ll.out b/llvm/test/Integer/a1.ll.out index 829839284c12..762dcd8e371a 100644 --- a/llvm/test/Integer/a1.ll.out +++ b/llvm/test/Integer/a1.ll.out @@ -12,5 +12,9 @@ %n = constant i1 true ; [#uses=0] %o = constant i1 true ; [#uses=0] %p = constant i1 true ; [#uses=0] +%q = constant i1 true ; [#uses=0] +%r = constant i1 true ; [#uses=0] +%s = constant i1 false ; [#uses=0] +%t = constant i1 false ; [#uses=0] implementation ; Functions: diff --git a/llvm/test/Integer/a15.ll b/llvm/test/Integer/a15.ll index 6c8e9d1dc3e8..fc4688b692a4 100644 --- a/llvm/test/Integer/a15.ll +++ b/llvm/test/Integer/a15.ll @@ -18,6 +18,11 @@ %m = constant i15 ashr(i15 32767 , i8 15) %n = constant i15 mul(i15 32767, i15 2) +%q = constant i15 mul(i15 -16383,i15 -3) +%r = constant i15 sdiv(i15 -1, i15 16383) +%s = constant i15 udiv(i15 -1, i15 16383) +%t = constant i15 srem(i15 1, i15 32766) +%u = constant i15 urem(i15 32767,i15 -1) %o = constant i15 trunc( i16 32768 to i15 ) %p = constant i15 trunc( i16 32767 to i15 ) diff --git a/llvm/test/Integer/a15.ll.out b/llvm/test/Integer/a15.ll.out index ee0f12c3ac34..c180a49f793c 100644 --- a/llvm/test/Integer/a15.ll.out +++ b/llvm/test/Integer/a15.ll.out @@ -12,6 +12,11 @@ %l = constant i15 -1 ; [#uses=0] %m = constant i15 -1 ; [#uses=0] %n = constant i15 -2 ; [#uses=0] +%q = constant i15 16381 ; [#uses=0] +%r = constant i15 0 ; [#uses=0] +%s = constant i15 2 ; [#uses=0] +%t = constant i15 1 ; [#uses=0] +%u = constant i15 0 ; [#uses=0] %o = constant i15 0 ; [#uses=0] %p = constant i15 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a17.ll b/llvm/test/Integer/a17.ll index 207f85e1c99b..5770c7c0cffa 100644 --- a/llvm/test/Integer/a17.ll +++ b/llvm/test/Integer/a17.ll @@ -18,5 +18,9 @@ %m = constant i17 ashr(i17 131071 , i8 17) %n = constant i17 mul(i17 131071, i17 2) +%q = constant i17 sdiv(i17 -1, i17 65535) +%r = constant i17 udiv(i17 -1, i17 65535) +%s = constant i17 srem(i17 1, i17 131070) +%t = constant i17 urem(i17 131071,i17 -1) %o = constant i17 trunc( i18 131072 to i17 ) %p = constant i17 trunc( i18 131071 to i17 ) diff --git a/llvm/test/Integer/a17.ll.out b/llvm/test/Integer/a17.ll.out index bb6093858c53..f0cb13a4fe55 100644 --- a/llvm/test/Integer/a17.ll.out +++ b/llvm/test/Integer/a17.ll.out @@ -12,6 +12,10 @@ %l = constant i17 -1 ; [#uses=0] %m = constant i17 -1 ; [#uses=0] %n = constant i17 -2 ; [#uses=0] +%q = constant i17 0 ; [#uses=0] +%r = constant i17 2 ; [#uses=0] +%s = constant i17 1 ; [#uses=0] +%t = constant i17 0 ; [#uses=0] %o = constant i17 0 ; [#uses=0] %p = constant i17 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a31.ll b/llvm/test/Integer/a31.ll index 6db33f6aa76d..50e229dee58a 100644 --- a/llvm/test/Integer/a31.ll +++ b/llvm/test/Integer/a31.ll @@ -18,5 +18,9 @@ %m = constant i31 ashr(i31 2147483647 , i8 31) %n = constant i31 mul(i31 2147483647, i31 2) +%q = constant i31 sdiv(i31 -1, i31 1073741823) +%r = constant i31 udiv(i31 -1, i31 1073741823) +%s = constant i31 srem(i31 3, i31 2147483646) +%t = constant i31 urem(i31 2147483647,i31 -1) %o = constant i31 trunc( i32 2147483648 to i31 ) %p = constant i31 trunc( i32 2147483647 to i31 ) diff --git a/llvm/test/Integer/a31.ll.out b/llvm/test/Integer/a31.ll.out index 1dcdc08f7e6b..b86d64558c77 100644 --- a/llvm/test/Integer/a31.ll.out +++ b/llvm/test/Integer/a31.ll.out @@ -12,6 +12,10 @@ %l = constant i31 -1 ; [#uses=0] %m = constant i31 -1 ; [#uses=0] %n = constant i31 -2 ; [#uses=0] +%q = constant i31 0 ; [#uses=0] +%r = constant i31 2 ; [#uses=0] +%s = constant i31 1 ; [#uses=0] +%t = constant i31 0 ; [#uses=0] %o = constant i31 0 ; [#uses=0] %p = constant i31 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a33.ll b/llvm/test/Integer/a33.ll index 90f31b3f075d..17c6f952fafb 100644 --- a/llvm/test/Integer/a33.ll +++ b/llvm/test/Integer/a33.ll @@ -18,6 +18,10 @@ %m = constant i33 ashr(i33 8589934591 , i8 33) %n = constant i33 mul(i33 8589934591, i33 2) +%q = constant i33 sdiv(i33 -1, i33 4294967295) +%r = constant i33 udiv(i33 -1, i33 4294967295) +%s = constant i33 srem(i33 3, i33 8589934590) +%t = constant i33 urem(i33 8589934591,i33 -1) %o = constant i33 trunc( i34 8589934592 to i33 ) %p = constant i33 trunc( i34 8589934591 to i33 ) diff --git a/llvm/test/Integer/a33.ll.out b/llvm/test/Integer/a33.ll.out index 3fc306c508bd..11dc54d3703b 100644 --- a/llvm/test/Integer/a33.ll.out +++ b/llvm/test/Integer/a33.ll.out @@ -12,6 +12,10 @@ %l = constant i33 -1 ; [#uses=0] %m = constant i33 -1 ; [#uses=0] %n = constant i33 -2 ; [#uses=0] +%q = constant i33 0 ; [#uses=0] +%r = constant i33 2 ; [#uses=0] +%s = constant i33 1 ; [#uses=0] +%t = constant i33 0 ; [#uses=0] %o = constant i33 0 ; [#uses=0] %p = constant i33 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a63.ll b/llvm/test/Integer/a63.ll index 9f039ed35c5e..29730018c045 100644 --- a/llvm/test/Integer/a63.ll +++ b/llvm/test/Integer/a63.ll @@ -18,5 +18,10 @@ %m = constant i63 ashr(i63 9223372036854775807 , i8 63) %n = constant i63 mul(i63 9223372036854775807, i63 2) +%q = constant i63 sdiv(i63 -1, i63 4611686018427387903) +%u = constant i63 sdiv(i63 -1, i63 1) +%r = constant i63 udiv(i63 -1, i63 4611686018427387903) +%s = constant i63 srem(i63 3, i63 9223372036854775806) +%t = constant i63 urem(i63 9223372036854775807,i63 -1) %o = constant i63 trunc( i64 9223372036854775808 to i63 ) %p = constant i63 trunc( i64 9223372036854775807 to i63 ) diff --git a/llvm/test/Integer/a63.ll.out b/llvm/test/Integer/a63.ll.out index d2d0ce8f46b0..03bba1c5e548 100644 --- a/llvm/test/Integer/a63.ll.out +++ b/llvm/test/Integer/a63.ll.out @@ -12,6 +12,11 @@ %l = constant i63 -1 ; [#uses=0] %m = constant i63 -1 ; [#uses=0] %n = constant i63 -2 ; [#uses=0] +%q = constant i63 0 ; [#uses=0] +%u = constant i63 -1 ; [#uses=0] +%r = constant i63 2 ; [#uses=0] +%s = constant i63 1 ; [#uses=0] +%t = constant i63 0 ; [#uses=0] %o = constant i63 0 ; [#uses=0] %p = constant i63 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a7.ll b/llvm/test/Integer/a7.ll index e055c61e2e3f..aedf55a8d547 100644 --- a/llvm/test/Integer/a7.ll +++ b/llvm/test/Integer/a7.ll @@ -4,11 +4,14 @@ ; test 7 bits ; %b = constant i7 add(i7 127, i7 1) +%q = constant i7 add(i7 -64, i7 -1) %c = constant i7 add(i7 127, i7 127) %d = constant i7 add(i7 120, i7 8) %e = constant i7 sub(i7 0 , i7 1) %f = constant i7 sub(i7 0 , i7 127) %g = constant i7 sub(i7 2 , i7 127) +%r = constant i7 sub(i7 -3, i7 120) +%s = constant i7 sub(i7 -3, i7 -8) %h = constant i7 shl(i7 1 , i8 7) %i = constant i7 shl(i7 1 , i8 6) @@ -18,6 +21,12 @@ %m = constant i7 ashr(i7 127 , i8 7) %n = constant i7 mul(i7 127, i7 2) +%t = constant i7 mul(i7 -63, i7 -2) +%u = constant i7 mul(i7 -32, i7 2) +%v = constant i7 sdiv(i7 -1, i7 63) +%w = constant i7 udiv(i7 -1, i7 63) +%x = constant i7 srem(i7 1 , i7 126) +%y = constant i7 urem(i7 127, i7 -1) %o = constant i7 trunc( i8 128 to i7 ) %p = constant i7 trunc( i8 255 to i7 ) diff --git a/llvm/test/Integer/a7.ll.out b/llvm/test/Integer/a7.ll.out index 3f71ea7ead4a..ea242a61c3d4 100644 --- a/llvm/test/Integer/a7.ll.out +++ b/llvm/test/Integer/a7.ll.out @@ -1,10 +1,13 @@ ; ModuleID = '' %b = constant i7 0 ; [#uses=0] +%q = constant i7 63 ; [#uses=0] %c = constant i7 -2 ; [#uses=0] %d = constant i7 0 ; [#uses=0] %e = constant i7 -1 ; [#uses=0] %f = constant i7 1 ; [#uses=0] %g = constant i7 3 ; [#uses=0] +%r = constant i7 5 ; [#uses=0] +%s = constant i7 5 ; [#uses=0] %h = constant i7 0 ; [#uses=0] %i = constant i7 -64 ; [#uses=0] %j = constant i7 1 ; [#uses=0] @@ -12,6 +15,12 @@ %l = constant i7 -1 ; [#uses=0] %m = constant i7 -1 ; [#uses=0] %n = constant i7 -2 ; [#uses=0] +%t = constant i7 -2 ; [#uses=0] +%u = constant i7 -64 ; [#uses=0] +%v = constant i7 0 ; [#uses=0] +%w = constant i7 2 ; [#uses=0] +%x = constant i7 1 ; [#uses=0] +%y = constant i7 0 ; [#uses=0] %o = constant i7 0 ; [#uses=0] %p = constant i7 -1 ; [#uses=0] diff --git a/llvm/test/Integer/a9.ll b/llvm/test/Integer/a9.ll index 907ac2b7a044..cb10350cc130 100644 --- a/llvm/test/Integer/a9.ll +++ b/llvm/test/Integer/a9.ll @@ -18,6 +18,10 @@ %m = constant i9 ashr(i9 511 , i8 9) %n = constant i9 mul(i9 511, i9 2) +%q = constant i9 sdiv(i9 511, i9 2) +%r = constant i9 udiv(i9 511, i9 2) +%s = constant i9 urem(i9 511, i9 -1) +%t = constant i9 srem(i9 1, i9 510) %o = constant i9 trunc( i10 512 to i9 ) %p = constant i9 trunc( i10 511 to i9 ) diff --git a/llvm/test/Integer/a9.ll.out b/llvm/test/Integer/a9.ll.out index 4968167bea12..31f1ef3b48be 100644 --- a/llvm/test/Integer/a9.ll.out +++ b/llvm/test/Integer/a9.ll.out @@ -12,6 +12,10 @@ %l = constant i9 -1 ; [#uses=0] %m = constant i9 -1 ; [#uses=0] %n = constant i9 -2 ; [#uses=0] +%q = constant i9 0 ; [#uses=0] +%r = constant i9 255 ; [#uses=0] +%s = constant i9 0 ; [#uses=0] +%t = constant i9 1 ; [#uses=0] %o = constant i9 0 ; [#uses=0] %p = constant i9 -1 ; [#uses=0] diff --git a/llvm/test/Integer/testarith_bt.ll b/llvm/test/Integer/testarith_bt.ll index 0dce41fb5137..d4b643d340e4 100644 --- a/llvm/test/Integer/testarith_bt.ll +++ b/llvm/test/Integer/testarith_bt.ll @@ -13,6 +13,9 @@ begin %t5 = sdiv i31 %t1, %t2 %t6 = urem i31 %t1, %t2 %t7 = srem i31 %t1, %t2 + %t8 = shl i31 %t1, i8 9 + %t9 = lshr i31 %t1, i8 9 + %t10= ashr i31 %t1, i8 9 %f1 = sitofp i31 %t1 to float %f2 = fdiv float 4.0, %f1 ret i31 %t3