[llvm] [AMDGPU] Fix canonicalization of truncated values. (PR #83054)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 04:07:35 PDT 2024
jayfoad wrote:
> > Thanks! If I happen to end up figuring out how to simplify the TableGen I can create a followup PR, otherwise I look forward to seeing how someone else manages to do :)
>
> I managed to get it to work with this:
>
> ```
> def is_canonicalized : PatLeaf<(fAny srcvalue:$src),
> [{
> const SITargetLowering &Lowering =
> *static_cast<const SITargetLowering *>(getTargetLowering());
> return Lowering.isCanonicalized(*CurDAG, SDValue(N, 0));
> }]
> >;
>
> def : GCNPat<
> (fcanonicalize (f32 is_canonicalized:$src)),
> (COPY f32:$src)
> >;
> ```
Awesome! I wonder if we could do something similar for is_divergent and is_uniform, so we don't need separate DivergentUnaryFrag/DivergentBinFrag/etc.
https://github.com/llvm/llvm-project/pull/83054
More information about the llvm-commits
mailing list