[PATCH] D81992: [AArch64][GlobalISel] Make G_SEXT_INREG legal and add selection support.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 17:29:43 PDT 2020


aemerson added a comment.

In D81992#2115822 <https://reviews.llvm.org/D81992#2115822>, @aemerson wrote:

> In D81992#2114675 <https://reviews.llvm.org/D81992#2114675>, @john.brawn wrote:>
>
> >   %6:_(s32) = nsw G_SUB %3:_, %5:_
> >   %7:_(s16) = G_TRUNC %6:_(s32)
> >   %8:_(s64) = G_SEXT %7:_(s16)
> >   
> >
> > which then gets converted to
> >
> >   %6:_(s32) = nsw G_SUB %3:_, %5:_
> >   %16:_(s64) = G_ANYEXT %6:_(s32)
> >   %8:_(s64) = G_SEXT_INREG %16:_, 16
> >   
> >
> > The truncation has been lost, and we eventually end up with
>
>
> The anyext is fine there, the SEXT_INREG should do the right thing and sign extend from bit 16, however it looks like we have a bug in the selector in this case. Fix incoming.


I've pushed a fix in 97a34b5f8d2e <https://reviews.llvm.org/rG97a34b5f8d2e855be5d43854de6ef237ed81139f>, thanks for the reproducer.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81992/new/

https://reviews.llvm.org/D81992





More information about the llvm-commits mailing list