2005-05-04 17:34:55 +00:00
|
|
|
; Test that the IsDigitOptimizer works correctly
|
2008-03-10 07:21:50 +00:00
|
|
|
; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | \
|
2007-04-15 05:16:38 +00:00
|
|
|
; RUN: not grep call
|
2005-05-04 17:34:55 +00:00
|
|
|
|
2008-03-10 07:21:50 +00:00
|
|
|
declare i32 @isdigit(i32)
|
2005-05-04 17:34:55 +00:00
|
|
|
|
2008-03-10 07:21:50 +00:00
|
|
|
declare i32 @isascii(i32)
|
2005-05-04 17:34:55 +00:00
|
|
|
|
2008-03-10 07:21:50 +00:00
|
|
|
define i32 @main() {
|
|
|
|
%val1 = call i32 @isdigit( i32 47 ) ; <i32> [#uses=1]
|
|
|
|
%val2 = call i32 @isdigit( i32 48 ) ; <i32> [#uses=1]
|
|
|
|
%val3 = call i32 @isdigit( i32 57 ) ; <i32> [#uses=1]
|
|
|
|
%val4 = call i32 @isdigit( i32 58 ) ; <i32> [#uses=1]
|
|
|
|
%rslt1 = add i32 %val1, %val2 ; <i32> [#uses=1]
|
|
|
|
%rslt2 = add i32 %val3, %val4 ; <i32> [#uses=1]
|
|
|
|
%sum = add i32 %rslt1, %rslt2 ; <i32> [#uses=1]
|
|
|
|
%rslt = call i32 @isdigit( i32 %sum ) ; <i32> [#uses=1]
|
|
|
|
%tmp = call i32 @isascii( i32 %rslt ) ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp
|
2005-05-04 17:34:55 +00:00
|
|
|
}
|
2008-03-10 07:21:50 +00:00
|
|
|
|