Cover more arithmetics for arbitrary bitwidth integers.

llvm-svn: 33355
This commit is contained in:
Zhou Sheng 2007-01-19 14:26:57 +00:00
parent a5007faaa6
commit a335d27e2b
17 changed files with 81 additions and 0 deletions

View File

@ -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)

View File

@ -12,5 +12,9 @@
%n = constant i1 true ; <i1*> [#uses=0]
%o = constant i1 true ; <i1*> [#uses=0]
%p = constant i1 true ; <i1*> [#uses=0]
%q = constant i1 true ; <i1*> [#uses=0]
%r = constant i1 true ; <i1*> [#uses=0]
%s = constant i1 false ; <i1*> [#uses=0]
%t = constant i1 false ; <i1*> [#uses=0]
implementation ; Functions:

View File

@ -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 )

View File

@ -12,6 +12,11 @@
%l = constant i15 -1 ; <i15*> [#uses=0]
%m = constant i15 -1 ; <i15*> [#uses=0]
%n = constant i15 -2 ; <i15*> [#uses=0]
%q = constant i15 16381 ; <i15*> [#uses=0]
%r = constant i15 0 ; <i15*> [#uses=0]
%s = constant i15 2 ; <i15*> [#uses=0]
%t = constant i15 1 ; <i15*> [#uses=0]
%u = constant i15 0 ; <i15*> [#uses=0]
%o = constant i15 0 ; <i15*> [#uses=0]
%p = constant i15 -1 ; <i15*> [#uses=0]

View File

@ -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 )

View File

@ -12,6 +12,10 @@
%l = constant i17 -1 ; <i17*> [#uses=0]
%m = constant i17 -1 ; <i17*> [#uses=0]
%n = constant i17 -2 ; <i17*> [#uses=0]
%q = constant i17 0 ; <i17*> [#uses=0]
%r = constant i17 2 ; <i17*> [#uses=0]
%s = constant i17 1 ; <i17*> [#uses=0]
%t = constant i17 0 ; <i17*> [#uses=0]
%o = constant i17 0 ; <i17*> [#uses=0]
%p = constant i17 -1 ; <i17*> [#uses=0]

View File

@ -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 )

View File

@ -12,6 +12,10 @@
%l = constant i31 -1 ; <i31*> [#uses=0]
%m = constant i31 -1 ; <i31*> [#uses=0]
%n = constant i31 -2 ; <i31*> [#uses=0]
%q = constant i31 0 ; <i31*> [#uses=0]
%r = constant i31 2 ; <i31*> [#uses=0]
%s = constant i31 1 ; <i31*> [#uses=0]
%t = constant i31 0 ; <i31*> [#uses=0]
%o = constant i31 0 ; <i31*> [#uses=0]
%p = constant i31 -1 ; <i31*> [#uses=0]

View File

@ -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 )

View File

@ -12,6 +12,10 @@
%l = constant i33 -1 ; <i33*> [#uses=0]
%m = constant i33 -1 ; <i33*> [#uses=0]
%n = constant i33 -2 ; <i33*> [#uses=0]
%q = constant i33 0 ; <i33*> [#uses=0]
%r = constant i33 2 ; <i33*> [#uses=0]
%s = constant i33 1 ; <i33*> [#uses=0]
%t = constant i33 0 ; <i33*> [#uses=0]
%o = constant i33 0 ; <i33*> [#uses=0]
%p = constant i33 -1 ; <i33*> [#uses=0]

View File

@ -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 )

View File

@ -12,6 +12,11 @@
%l = constant i63 -1 ; <i63*> [#uses=0]
%m = constant i63 -1 ; <i63*> [#uses=0]
%n = constant i63 -2 ; <i63*> [#uses=0]
%q = constant i63 0 ; <i63*> [#uses=0]
%u = constant i63 -1 ; <i63*> [#uses=0]
%r = constant i63 2 ; <i63*> [#uses=0]
%s = constant i63 1 ; <i63*> [#uses=0]
%t = constant i63 0 ; <i63*> [#uses=0]
%o = constant i63 0 ; <i63*> [#uses=0]
%p = constant i63 -1 ; <i63*> [#uses=0]

View File

@ -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 )

View File

@ -1,10 +1,13 @@
; ModuleID = '<stdin>'
%b = constant i7 0 ; <i7*> [#uses=0]
%q = constant i7 63 ; <i7*> [#uses=0]
%c = constant i7 -2 ; <i7*> [#uses=0]
%d = constant i7 0 ; <i7*> [#uses=0]
%e = constant i7 -1 ; <i7*> [#uses=0]
%f = constant i7 1 ; <i7*> [#uses=0]
%g = constant i7 3 ; <i7*> [#uses=0]
%r = constant i7 5 ; <i7*> [#uses=0]
%s = constant i7 5 ; <i7*> [#uses=0]
%h = constant i7 0 ; <i7*> [#uses=0]
%i = constant i7 -64 ; <i7*> [#uses=0]
%j = constant i7 1 ; <i7*> [#uses=0]
@ -12,6 +15,12 @@
%l = constant i7 -1 ; <i7*> [#uses=0]
%m = constant i7 -1 ; <i7*> [#uses=0]
%n = constant i7 -2 ; <i7*> [#uses=0]
%t = constant i7 -2 ; <i7*> [#uses=0]
%u = constant i7 -64 ; <i7*> [#uses=0]
%v = constant i7 0 ; <i7*> [#uses=0]
%w = constant i7 2 ; <i7*> [#uses=0]
%x = constant i7 1 ; <i7*> [#uses=0]
%y = constant i7 0 ; <i7*> [#uses=0]
%o = constant i7 0 ; <i7*> [#uses=0]
%p = constant i7 -1 ; <i7*> [#uses=0]

View File

@ -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 )

View File

@ -12,6 +12,10 @@
%l = constant i9 -1 ; <i9*> [#uses=0]
%m = constant i9 -1 ; <i9*> [#uses=0]
%n = constant i9 -2 ; <i9*> [#uses=0]
%q = constant i9 0 ; <i9*> [#uses=0]
%r = constant i9 255 ; <i9*> [#uses=0]
%s = constant i9 0 ; <i9*> [#uses=0]
%t = constant i9 1 ; <i9*> [#uses=0]
%o = constant i9 0 ; <i9*> [#uses=0]
%p = constant i9 -1 ; <i9*> [#uses=0]

View File

@ -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