[PATCH] D81992: [AArch64][GlobalISel] Make G_SEXT_INREG legal and add selection support.
John Brawn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 25 09:40:59 PDT 2020
john.brawn added a comment.
It looks like this patch is causing incorrect code generation for
signed int x = -0x8000;
int fn(int *ptr) {
return ptr[(signed short)(unsigned short)(x - 0x8000)];
}
we have initially
%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
subs w9, w9, #8, lsl #12
mov w0, w9
ldr w0, [x8, w0, uxtw #2]
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