Home | History | Annotate | Download | only in SimplifyLibCalls
      1 ; Test that the ToAsciiOptimizer works correctly
      2 ; RUN: opt < %s -simplify-libcalls -S | \
      3 ; RUN:   not grep {call.*@ffs}
      4 
      5 @non_const = external global i32		; <i32*> [#uses=1]
      6 
      7 declare i32 @ffs(i32)
      8 
      9 declare i32 @ffsl(i32)
     10 
     11 declare i32 @ffsll(i64)
     12 
     13 define i32 @main() {
     14 	%arg = load i32* @non_const		; <i32> [#uses=1]
     15 	%val0 = call i32 @ffs( i32 %arg )		; <i32> [#uses=1]
     16 	%val1 = call i32 @ffs( i32 1 )		; <i32> [#uses=1]
     17 	%val2 = call i32 @ffs( i32 2048 )		; <i32> [#uses=1]
     18 	%val3 = call i32 @ffsl( i32 65536 )		; <i32> [#uses=1]
     19 	%val4 = call i32 @ffsll( i64 1024 )		; <i32> [#uses=1]
     20 	%val5 = call i32 @ffsll( i64 17179869184 )		; <i32> [#uses=1]
     21 	%val6 = call i32 @ffsll( i64 1152921504606846976 )		; <i32> [#uses=1]
     22 	%rslt1 = add i32 %val1, %val2		; <i32> [#uses=1]
     23 	%rslt2 = add i32 %val3, %val4		; <i32> [#uses=1]
     24 	%rslt3 = add i32 %val5, %val6		; <i32> [#uses=1]
     25 	%rslt4 = add i32 %rslt1, %rslt2		; <i32> [#uses=1]
     26 	%rslt5 = add i32 %rslt4, %rslt3		; <i32> [#uses=2]
     27 	%rslt6 = add i32 %rslt5, %val0		; <i32> [#uses=0]
     28 	ret i32 %rslt5
     29 }
     30 
     31 
     32 ; PR4206
     33 define i32 @a(i64) nounwind {
     34         %2 = call i32 @ffsll(i64 %0)            ; <i32> [#uses=1]
     35         ret i32 %2
     36 }
     37