Issue 238003
Summary `@llvm.experimental.cttz.elts(v) < lanes(v)` should fold to `any(v != splat(0))`
Labels new issue
Assignees
Reporter Sp00ph
    See the following example: <https://llvm.godbolt.org/z/a3Eeon9Y1>. Both functions should be semantically identical, returning `all(a == b)`. But the second function, implemented using `@llvm.experimental.cttz.elts` still computes the full trailing zero index, just to compare it to the lane count afterward. I believe the a `cttz.elts` whose output gets compared to the vector lane count should simply be replaced by a check for the presence of any nonzero element in the vector.

This came up looking at rustc output: <https://rust.godbolt.org/z/GPEcd47qr>. Here, `a == b` just gets lowered to a memcmp, which vectorizes just fine, but the autovectorized output from the second function lowers to a `cttz.elts < lanes`, which produces very poor asm.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to