Add a case with non-constant argument for testing the transform:

ffs(x) -> (x == 0 ? 0 : llvm.cttz(0)+1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2005-05-15 21:26:59 +00:00
parent f74eb3fa2a
commit 9b1749b1f4

View File

@ -4,12 +4,17 @@
declare int %ffs(int) declare int %ffs(int)
declare int %ffsl(int) declare int %ffsl(int)
declare int %ffsll(long) declare int %ffsll(long)
declare int %__builtin_ffs(int)
%non_const = external global int
implementation ; Functions: implementation ; Functions:
int %main () { int %main () {
%arg = load int* %non_const
%val0 = call int %ffs(int %arg)
%val1 = call int %ffs(int 1) %val1 = call int %ffs(int 1)
%val2 = call int %ffs(int 2048) %val2 = call int %__builtin_ffs(int 2048)
%val3 = call int %ffsl(int 65536) %val3 = call int %ffsl(int 65536)
%val4 = call int %ffsll(long 1024) %val4 = call int %ffsll(long 1024)
%val5 = call int %ffsll(long 17179869184) %val5 = call int %ffsll(long 17179869184)
@ -19,5 +24,6 @@ int %main () {
%rslt3 = add int %val5, %val6 %rslt3 = add int %val5, %val6
%rslt4 = add int %rslt1, %rslt2 %rslt4 = add int %rslt1, %rslt2
%rslt5 = add int %rslt4, %rslt3 %rslt5 = add int %rslt4, %rslt3
%rslt6 = add int %rslt5, %val0
ret int %rslt5 ret int %rslt5
} }