From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71DA138708AA; Tue, 16 Feb 2021 16:45:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71DA138708AA From: "meissner at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/98519] rs6000: @pcrel unsupported on this instruction error in pveclib Date: Tue, 16 Feb 2021 16:45:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: meissner at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 16:45:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98519 --- Comment #23 from Michael Meissner --- Obviously one approach is to use the recog_data.is_asm field to determine if the %m constraint is in an asm and restrict it to non-prefixed memory addresses. However, this doesn't work, because is_asm is not reliably set. For example in this program: static int x; int *p_x =3D &x; int get (void) { int a; __asm__ ("lwz%U0%X0 %0,%1" : "=3Dr" (a) : "m" (x)); return a; } And we look at calls to satisfies_constraint_m, the is_asm field it not set= for each of the references: Current directory is /home/meissner/fsf-build-x86_64/work036-powerpc64le-linux/gcc/ GNU gdb (GDB) 11.0.50.20210212-git Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/meissner/fsf-build-x86_64/work036-powerpc64le-linux/gcc/cc1... .gdbinit:14: Error in sourced command file: /home/meissner/fsf-src/work036/gcc/gdbinit.in:323: Error in sourced command file: Python scripting is not supported in this copy of GDB. (gdb) b ira.c:5527 Breakpoint 1 at 0xa10c45: file /home/meissner/fsf-src/work036/gcc/ira.c, li= ne 5527. # the above line is after the initial setup that IRA does. (gdb) b satisfies_constraint_m Breakpoint 2 at 0x1363e30: satisfies_constraint_m. (2 locations) (gdb) dis 2 (gdb) commands 2 Type commands for breakpoint(s) 2, one per line. End with a line saying just "end". >print op >pr >print recog_data.is_asm >(gdb) r -O2 -quiet -mcpu=3Dpower10 foo02.c Starting program: /home/meissner/fsf-build-x86_64/work036-powerpc64le-linux/gcc/cc1 -O2 -quiet -mcpu=3Dpower10 foo02.c Breakpoint 1, ira (f=3D0x0) at /home/meissner/fsf-src/work036/gcc/ira.c:5527 (gdb) en 2 (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $1 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $2 =3D false # Note, is_asm should be true here (gdb) where #0 satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:10 #1 0x0000000000a59ba7 in constraint_satisfied_p (c=3DCONSTRAINT_m, x=3D0x7ffff0de35e8) at ./tm-preds.h:258 #2 valid_address_p (op=3Dop@entry=3D0x7ffff0de35e8, ad=3Dad@entry=3D0x7fff= ffffbc80, constraint=3Dconstraint@entry=3DCONSTRAINT_m) at /home/meissner/fsf-src/work036/gcc/lra-constraints.c:415 #3 0x0000000000a612d6 in process_address_1 (nop=3D-17280, check_only_p=3D, before=3D0x7fffffffbe50, after=3D) at /home/meissner/fsf-src/work036/gcc/lra-constraints.c:3531 #4 0x0000000000a63101 in process_address (after=3D0x7fffffffbe58, before=3D0x7fffffffbe50, check_only_p=3Dfalse, nop=3D1) at /home/meissner/fsf-src/work036/gcc/lra-constraints.c:3739 #5 curr_insn_transform (check_only_p=3D) at /home/meissner/fsf-src/work036/gcc/lra-constraints.c:4054 #6 0x0000000000a681ee in lra_constraints (first_p=3D) at /home/meissner/fsf-src/work036/gcc/lra-constraints.c:5143 #7 0x0000000000a5089b in lra (f=3D) at /home/meissner/fsf-src/work036/gcc/lra.c:2336 #8 0x0000000000a0bcfa in do_reload () at /home/meissner/fsf-src/work036/gcc/ira.c:5827 #9 (anonymous namespace)::pass_reload::execute (this=3D) at /home/meissner/fsf-src/work036/gcc/ira.c:6013 #10 0x0000000000b133fd in execute_one_pass (pass=3D0x20b66c0) at /home/meissner/fsf-src/work036/gcc/passes.c:2567 #11 0x0000000000b13da0 in execute_pass_list_1 (pass=3D0x20b66c0) at /home/meissner/fsf-src/work036/gcc/passes.c:2656 #12 0x0000000000b13db2 in execute_pass_list_1 (pass=3D0x20b54c0) at /home/meissner/fsf-src/work036/gcc/passes.c:2657 #13 0x0000000000b13dd9 in execute_pass_list (fn=3D0x7ffff0dd8000, pass=3D) at /home/meissner/fsf-src/work036/gcc/passes.c:2667 #14 0x00000000007a34e1 in cgraph_node::expand (this=3D0x7ffff0fd6440) at /home/meissner/fsf-src/work036/gcc/context.h:48 #15 0x00000000007a49f0 in expand_all_functions () at /home/meissner/fsf-src/work036/gcc/cgraphunit.c:1995 #16 symbol_table::compile (this=3D0x7ffff0fce000) at /home/meissner/fsf-src/work036/gcc/cgraphunit.c:2359 #17 0x00000000007a7398 in symbol_table::compile (this=3D0x7ffff0fce000) at /home/meissner/fsf-src/work036/gcc/cgraphunit.c:2272 #18 symbol_table::finalize_compilation_unit (this=3D0x7ffff0fce000) at /home/meissner/fsf-src/work036/gcc/cgraphunit.c:2540 #19 0x0000000000bed568 in compile_file () at /home/meissner/fsf-src/work036/gcc/toplev.c:482 #20 0x00000000005f4a17 in do_compile () at /home/meissner/fsf-src/work036/gcc/toplev.c:2197 #21 toplev::main (this=3Dthis@entry=3D0x7fffffffcdde, argc=3D, argc@entry=3D5, argv=3D, argv@entry=3D0x7fffffffced8) at /home/meissner/fsf-src/work036/gcc/toplev.c:2336 #22 0x00000000005f73af in main (argc=3D5, argv=3D0x7fffffffced8) at /home/meissner/fsf-src/work036/gcc/main.c:39 (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $3 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $4 =3D false (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $5 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $6 =3D false (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $7 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $8 =3D false (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $9 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $10 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $11 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $12 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $13 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $14 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $15 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $16 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $17 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $18 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $19 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $20 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $21 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $22 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $23 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $24 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $25 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $26 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $27 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $28 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at tm-constrs.h:= 10 $29 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $30 =3D true (gdb) c Continuing. Breakpoint 2, satisfies_constraint_m (op=3D0x7ffff0de35e8) at /home/meissner/fsf-src/work036/gcc/common.md:27 $31 =3D (rtx) 0x7ffff0de35e8 (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) [1 x+0 S4 A32]) $32 =3D true (gdb) c Continuing. [Inferior 1 (process 4757) exited normally] (gdb)=20 If we change rs6000_legitimate_address_p to return false if we have a prefi= xed address and we are in asm, we get an insn not found error: --- /home/meissner/tmp/gcc-tmp/TskwFJ_rs6000.c 2021-02-16 11:44:05.5202016= 74 -0500 +++ gcc/config/rs6000/rs6000.c 2021-02-16 11:41:41.444740394 -0500 @@ -9532,7 +9532,7 @@ rs6000_legitimate_address_p (machine_mod /* Handle prefixed addresses (PC-relative or 34-bit offset). */ if (address_is_prefixed (x, mode, NON_PREFIXED_DEFAULT)) - return 1; + return !recog_data.is_asm; /* Handle restricted vector d-form offsets in ISA 3.0. */ if (quad_offset_p) $ file=3D"foo02"; ./xgcc -B./ -O2 -mcpu=3Dpower10 -save-temps -c $file.c=20 foo02.c:9:1: error: unrecognizable insn: 9 | } | ^ (insn 7 5 12 2 (parallel [ (set (reg:SI 3 3 [orig:118 a ] [118]) (asm_operands:SI ("lwz%U0%X0 %0,%1") ("=3Dr") 0 [ (mem/c:SI (symbol_ref:DI ("*.LANCHOR0") [flags 0x18= 2]) [1 x+0 S4 A32]) ] [ (asm_input:SI ("m") foo02.c:7) ] [] foo02.c:7)) (clobber (reg:SI 98 ca)) ]) "foo02.c":7:3 -1 (nil)) during RTL pass: reload foo02.c:9:1: internal compiler error: in extract_constrain_insn, at recog.c:2670 0x4d50db _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) /home/meissner/fsf-src/work036/gcc/rtl-error.c:108 0x4d50f7 _fatal_insn_not_found(rtx_def const*, char const*, int, char const= *) /home/meissner/fsf-src/work036/gcc/rtl-error.c:116 0xb5907f extract_constrain_insn(rtx_insn*) /home/meissner/fsf-src/work036/gcc/recog.c:2670 0xa4d0a7 check_rtl /home/meissner/fsf-src/work036/gcc/lra.c:2087 0xa510ad lra(_IO_FILE*) /home/meissner/fsf-src/work036/gcc/lra.c:2505 0xa0bcf9 do_reload /home/meissner/fsf-src/work036/gcc/ira.c:5827 0xa0bcf9 execute /home/meissner/fsf-src/work036/gcc/ira.c:6013 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions.=