diff options
author | David Sherwood <david.sherwood@arm.com> | 2024-11-25 09:25:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 09:25:01 +0000 |
commit | 22ec44f509ff266b581dbb490d7b040473b7c31a (patch) | |
tree | 7a9214acef8ebee59b47e3b4a5fd09d360904cf6 /clang/lib | |
parent | e5faeb69fbb87722ee315884eeef2089b10b0cee (diff) | |
download | llvm-22ec44f509ff266b581dbb490d7b040473b7c31a.zip llvm-22ec44f509ff266b581dbb490d7b040473b7c31a.tar.gz llvm-22ec44f509ff266b581dbb490d7b040473b7c31a.tar.bz2 |
[DAGCombiner] Add support for scalarising extracts of a vector setcc (#116031)
For IR like this:
%icmp = icmp ult <4 x i32> %a, splat (i32 5)
%res = extractelement <4 x i1> %icmp, i32 1
where there is only one use of %icmp we can take a similar approach
to what we already do for binary ops such add, sub, etc. and convert
this into
%ext = extractelement <4 x i32> %a, i32 1
%res = icmp ult i32 %ext, 5
For AArch64 targets at least the scalar boolean result will almost
certainly need to be in a GPR anyway, since it will probably be
used by branches for control flow. I've tried to reuse existing code
in scalarizeExtractedBinop to also work for setcc.
NOTE: The optimisations don't apply for tests such as
extract_icmp_v4i32_splat_rhs in the file
CodeGen/AArch64/extract-vector-cmp.ll
because scalarizeExtractedBinOp only works if one of the input
operands is a constant.
Diffstat (limited to 'clang/lib')
0 files changed, 0 insertions, 0 deletions