[cfe-dev] patch: more builtin support

Chris Lattner clattner at apple.com
Sat Jul 19 17:23:26 PDT 2008


On Jul 18, 2008, at 4:34 PM, Daniel Dunbar wrote:

> This patch adds support for __builtin_{ffs[l][l], parity[l][l],  
> popcount[l][l], huge_valf, huge_vall}.
> + test case

Looks great to me with one minor change: we don't want the clang  
testsuite to actually execute code.  Please make the test just be  
something like this:

void test(int M, long long N) {
   printf("%d %lld: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d  
%d\n",
          M, N,
          __builtin_ffs(M), __builtin_ffsl(M), __builtin_ffsll(M),
          __builtin_parity(M), __builtin_parityl(M),  
__builtin_parityll(M),
          __builtin_popcount(M), __builtin_popcountl(M),  
__builtin_popcountll(M),
          __builtin_ffs(N), __builtin_ffsl(N), __builtin_ffsll(N),
          __builtin_parity(N), __builtin_parityl(N),  
__builtin_parityll(N),
          __builtin_popcount(N), __builtin_popcountl(N),  
__builtin_popcountll(N));
}

with: clang -emit-llvm %s | not grep __builtin

or something like that.  The llvm-test suite can be used to verify  
that we don't miscompile them.

Thanks Daniel!

-Chris



More information about the cfe-dev mailing list