[PATCH] D16291: AArch64: Implement missed conditional compare sequences.

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 10:53:28 PST 2016


> On Jan 20, 2016, at 6:29 AM, Balaram Makam via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> bmakam added a comment.
> 
> Thanks for the feedback Matthias and Geoff,
> 
> The approach here is to catch the cases where LowerSELECT failed to construct ccmp sequences, so had to be done at LowerOR/LowerAND. The current patch fails to catch the cases mentioned by Geoff because of the restriction to Return inputs. We should be able to handle other than returns and I was saving this for a follow on patch because it breaks the select_noccmp1 test case in arm64-ccmp.ll:
> 
>  define i64 @select_noccmp1(i64 %v1, i64 %v2, i64 %v3, i64 %r) {
>    %c0 = icmp slt i64 %v1, 0
>    %c1 = icmp sgt i64 %v1, 13
>    %c2 = icmp slt i64 %v3, 2
>    %c4 = icmp sgt i64 %v3, 4
>    %and0 = and i1 %c0, %c1
>    %and1 = and i1 %c2, %c4
>    %or = or i1 %and0, %and1
>    %sel = select i1 %or, i64 0, i64 %r
>    ret i64 %sel
>  }
> 
> Matthias, can you please let know why you added this test case? I think we fail to construct ccmp sequence here because the tree at or i1 is not a conjunctiondisjunction tree as we cannot push negate operation through the tree not (or (and x y) (and x z)). However, with the current approach of doing the transformation at LowerOR/LowerAND we can look at the sub-trees (and x y), (and x z) respectively and they can be transformed into ccmp sequences thus breaking this testcase. Is it reasonable to modify the test case if we agree on extending this to catch the cases Geoff mentioned?

Yes the test is supposed to test that we do not construct a sequence of 1cmp + 3ccmps and  a single csel as that is impossible in this case. But indeed it is possible to transform some subtrees here so by all means change the CHECK: lines of the testcase to the output you get.

- Matthias


More information about the llvm-commits mailing list