Add enums and functions for symbols Mips64 uses.
[oota-llvm.git] / lib / Target / X86 / README.txt
index 560947a4a04b79882b77d5994a0eab6842eed9c0..8d9eabad0be0a046ca1a00827bbc273ac96ef314 100644 (file)
@@ -2066,3 +2066,34 @@ The trick is to match "fetch_and_add(X, -C) == C".
 
 //===---------------------------------------------------------------------===//
 
+unsigned log2(unsigned x) {
+  return x > 1 ? 32-__builtin_clz(x-1) : 0;
+}
+
+generates (x86_64):
+       xorl    %eax, %eax
+       cmpl    $2, %edi
+       jb      LBB0_2
+## BB#1:
+       decl    %edi
+       movl    $63, %ecx
+       bsrl    %edi, %eax
+       cmovel  %ecx, %eax
+       xorl    $-32, %eax
+       addl    $33, %eax
+LBB0_2:
+       ret
+
+The cmov and the early test are redundant:
+       xorl    %eax, %eax
+       cmpl    $2, %edi
+       jb      LBB0_2
+## BB#1:
+       decl    %edi
+       bsrl    %edi, %eax
+       xorl    $-32, %eax
+       addl    $33, %eax
+LBB0_2:
+       ret
+
+//===---------------------------------------------------------------------===//