AMDGPU/SDAG: Custom SETCC (i.e. ballot) is always uniform
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 8 Apr 2022 15:52:13 +0000 (10:52 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 11 Apr 2022 19:04:21 +0000 (14:04 -0500)
commit4df4922da6cd9d4f58aa17bd3a54435d947570fd
treeada7534d398e10a1cd36fde62f2463a49be1d653
parent15a65594c1c0321671a827582fd66a22e0dbdc6e
AMDGPU/SDAG: Custom SETCC (i.e. ballot) is always uniform

The AMDGPUISD::SETCC node is like ISD::SETCC, but returns a lane mask
instead of a per-lane boolean. The lane mask is uniform.

This improves instruction selection for code patterns like
ctpop(ballot(x)), which can now use an S_BCNT1_* instruction instead
of V_BCNT_*.

GlobalISel already selects scalar instructions (an earlier commit
added a test case)..

Differential Revision: https://reviews.llvm.org/D123432
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i32.ll
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ballot.i64.ll