D130163 added support for folding setcc (iN (bitcast (vNi1 X))), 0, (eq|ne) to setcc (iN (zext (i1 (vecreduce_or (vNi1 X))))), 0, (eq|ne). There is a conjugate fold for comparison with -1 which uses vecreduce_and and sext instead. Proof: https://alive2.llvm.org/ce/z/Zz--xy
Details
Diff Detail
Event Timeline
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
20438 | I found the formulation here is a bit roundabout -- is there a reason why we can't directly return the vecreduce result (together with a NOT, depending on predicate)? |
Sorry, I've not had much review time this week but I'll take a proper look tomorrow or Friday.
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
20438 | It was just a case of not radically changing the DAG and meant not having to worry about getBooleanContents(). Simplifying setcc(ext(i1)) seems like a DAG combine independent of how the i1 is produced, which looking at the test output presumably already exists? |
I found the formulation here is a bit roundabout -- is there a reason why we can't directly return the vecreduce result (together with a NOT, depending on predicate)?