[PATCH] D113371: [X86] combinePMULH - recognise 'cheap' trunctions via PACKS/PACKUS as well as SEXT/ZEXT
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 30 09:44:56 PST 2021
lebedev.ri added a comment.
In D113371#3161934 <https://reviews.llvm.org/D113371#3161934>, @RKSimon wrote:
> In D113371#3161727 <https://reviews.llvm.org/D113371#3161727>, @lebedev.ri wrote:
>
>> Hm, i'm not sure i'm following, why is the truncation free if the dropped bits are zeros / why it won't be free otherwise?
>
> Its not - IsTruncateFree is only true if we've extended both inputs, in which case truncating the inputs should be free, and we're better off doing that so we can perform the MULH on a smaller vector.
Does the patch description need updating? In particular, i'm not sure what the second part of phrase this mean:
> But we can generalize this to any source operand with sufficient leading sign/zero bits that would allow PACKS/PACKUS to be used as a 'cheap' truncation.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:48584
+ // For AVX2+ targets, with the upper bits known zero, we can perform MULHU on
+ // the (bitcasted) inputs directly, and then cheaply truncate the result
+ // (upper elts will be zero). Don't attempt this with just AVX512F as MULHU
----------------
What does "cheaply" mean here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113371/new/
https://reviews.llvm.org/D113371
More information about the llvm-commits
mailing list