[PATCH] D33391: [DAGCombine] fold (add/uaddo (xor a, -1), 1) -> (sub 0, a)
Amaury SECHET via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 06:03:26 PDT 2017
deadalnix added a comment.
I have no idea what clang is doing there. It seems like the intrinsic do not map directly to the uaddo/usubo. See for yourself the generated IR (in clang 3.8 that's what I have available ATM):
; Function Attrs: noinline norecurse nounwind uwtable
define i32 @f(i32 %a, i32* nocapture %ovf) #0 {
%1 = zext i32 %a to i33
%2 = sub nsw i33 0, %1
%3 = trunc i33 %2 to i32
%4 = and i33 %2, 4294967295
%5 = icmp ne i33 %4, %2
store i32 %3, i32* %ovf, align 4
%6 = zext i1 %5 to i32
ret i32 %6
}
I'm not working from C to begin with, so I'm not super familiar with these intrinsic and what they are supposed to do. i definitively want to get to the bottom of this and make sure this is correct, but we can't conclude from the result of the intrinsic that it is the case. Sadly, I'm not on my work computer right now, so I can't check out what DAG is generated and how it is combined ATM in this specific case.
https://reviews.llvm.org/D33391
More information about the llvm-commits
mailing list