https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100028
Bug ID: 100028
Summary: arm64 failure to generate bfxil
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: luc.vanoostenryck at gmail dot com
Target Milestone: ---
Target: aarch64
Created attachment 50555
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50555&action=edit
should generate bfxil but doesn't
The attached code reproduced here:
#define W 3
#define L 11
int bfxil(int d, int s)
{
int wmask = (1 << W) - 1;
return (d & ~wmask) | ((s >> L) & wmask);
}
Should return:
bfxil:
bfxil w0, w1, 11, 3
ret
but instead returns:
bfxil:
ubfx x1, x1, 11, 3
and w0, w0, -8
orr w0, w1, w0
ret
The problem is still present in trunk, was also present in 9.3 but wasn't in
GCC 8.2 (see https://gcc.godbolt.org/z/E6z31hr9r ).