[llvm] [AMDGPU] Fix canonicalization of truncated values. (PR #83054)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 02:58:03 PDT 2024


arsenm 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)
>;
```

https://github.com/llvm/llvm-project/pull/83054


More information about the llvm-commits mailing list