https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87511

            Bug ID: 87511
           Summary: [9 Regression][AArch64] UBFIZ instruction with invalid
                    immediate emitted
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sudi at gcc dot gnu.org
  Target Milestone: ---

When compiling the code below with aarch64 and -Os

int a, d;
struct {
  signed f5 : 26;
  signed f6 : 12;
} b;
signed char c;
void fn1() {
  signed char *e = &c;
  d = a * 10;
  *e = d;
  b.f6 = c;
  b.f5 = 8 <= 3;
}

We get:
$ aarch64-none-elf-gcc -march=armv8-a -c test.c -o /dev/null -Os -Wall
/tmp/ccVimNZB.s: Assembler messages:
/tmp/ccVimNZB.s:20: Error: immediate value out of range 1 to 32 at operand 4 --
`ubfiz x0,x0,32,38'

This started somewhere between r260322 and r261702.

Seems to be incorrectly matching the below in IRA
//(insn:TI 30 22 35 (set (reg:DI 0 x0 [120])
// (and:DI (ashift:DI (reg:DI 0 x0 [orig:92 _3 ] [92])
// (const_int 32 [0x20]))
// (const_int 17587958185983 [0xfff03ffffff]))) "bfiz.c":12 786
\{*andim_ashiftdi_bfiz}
// (nil))
 ubfiz x0, x0, 32, 38 // 30 [c=4 l=4] *andim_ashiftdi_bfiz

Reply via email to