[PATCH] D116375: [X86] Use bit test instructions to optimize some logic atomic operations
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 8 22:18:06 PST 2022
craig.topper added a comment.
This test fails
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
@x = global %"struct.std::atomic" zeroinitializer, align 4
define i32 @_Z3fooii(i32 %0, i32 %1) {
%3 = atomicrmw or i32* getelementptr inbounds (%"struct.std::atomic", %"struct.std::atomic"* @x, i64 0, i32 0, i32 0), i32 8 seq_cst, align 4
%4 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 false)
%5 = and i32 %3, 8
%6 = icmp ne i32 %5, 0
%7 = icmp ne i32 %1, 0
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %10
9: ; preds = %2
tail call void @_Z3bazi(i32 %4)
br label %10
10: ; preds = %9, %2
ret i32 %4
}
declare i32 @llvm.ctlz.i32(i32, i1 immarg)
declare void @_Z3bazi(i32)
CodeGenPrepare splits the basic block to despeculate the ctlz.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116375/new/
https://reviews.llvm.org/D116375
More information about the llvm-commits
mailing list