This revision was automatically updated to reflect the committed changes.
Closed by commit rC339282: [Builtins] Implement __builtin_clrsb to be
compatible with gcc (authored by ctopper, committed by ).
Herald added a subscriber: kristina.
Repository:
rC Clang
https://reviews.llvm.org/D50168
F
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.
lg
https://reviews.llvm.org/D50168
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
craig.topper updated this revision to Diff 159753.
craig.topper added a comment.
Use ctlz(zero_undef=false) and sub
https://reviews.llvm.org/D50168
Files:
include/clang/Basic/Builtins.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtin_clrsb.c
Index: test/CodeGen/builtin_clrsb.c
spatel added a comment.
About the bit hacking: I don't think clang should be in the optimization
business. We should be able to take the most obvious/simple representation for
this builtin and reduce it as needed (either in instcombine or the backend). So
it would be better to use the version w
craig.topper updated this revision to Diff 159627.
craig.topper added a comment.
Add the test case that I failed to pick up in the original diff.
https://reviews.llvm.org/D50168
Files:
include/clang/Basic/Builtins.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtin_clrsb.c
Index: test/Co
bkramer added a comment.
Test case?
Comment at: lib/CodeGen/CGBuiltin.cpp:1563
+Value *Result = Builder.CreateCall(F, {Tmp, Builder.getTrue()});
+if (Result->getType() != ResultType)
+ Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
---
craig.topper added a comment.
Ping
https://reviews.llvm.org/D50168
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
craig.topper created this revision.
craig.topper added reviewers: bkramer, efriedma, spatel.
Herald added a reviewer: javed.absar.
Herald added a subscriber: kristof.beyls.
gcc defines an intrinsic called __builtin_clrsb which counts the number of
extra sign bits on a number. This is equivalent t