* [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc
[not found] <bug-90000-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-02 15:52 ` willschm at gcc dot gnu.org
2020-04-02 16:38 ` wschmidt at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-04-02 15:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90000
Will Schmidt <willschm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |willschm at gcc dot gnu.org
--- Comment #2 from Will Schmidt <willschm at gcc dot gnu.org> ---
Debug dump.
Testcase looks like so:
void foo (void)
{
register float __attribute__ ((mode(SD))) r31 __asm__ ("r31");
register float __attribute__ ((mode(SD))) fr1 __asm__ ("fr1");
__asm__ ("#" : "=d" (fr1));
r31 = fr1;
__asm__ ("#" : : "r" (r31));
}
# When we reach function.c: instantiate_virtual_regs_in_insn() ->
error_for_asm(), pcfun looks like so.
Breakpoint 12, error_for_asm (insn=0x200000710340, gmsgid=0x1195d100
"impossible constraint in %<asm%>") at rtl-error.c:82
82 va_start (ap, gmsgid);
foo ()
{
(note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note 2 3 5 2 NOTE_INSN_FUNCTION_BEG)
(insn 5 2 6 2 (parallel [
(set (reg/v:SD 33 1 [ fr1 ])
(asm_operands:SD ("#") ("=d") 0 []
[]
[] /tmp/pr60032.c:10))
(clobber (reg:SI 98 ca))
]) "/tmp/pr60032.c":10:3 -1
(nil))
(insn 6 5 7 2 (set (subreg:SI (reg:SD 117 [ fr1.0_1 ]) 0)
(subreg:SI (reg/v:SD 33 1 [ fr1 ]) 0)) "/tmp/pr60032.c":11:7 -1
(nil))
(insn 7 6 8 2 (set (reg:SI 30 30 [ r31 ])
(subreg:SI (reg:SD 117 [ fr1.0_1 ]) 0)) "/tmp/pr60032.c":11:7 -1
(nil))
(insn 8 7 0 2 (parallel [
(asm_operands/v ("#") ("") 0 [
(reg/v:SD 30 30 [ r31 ])
]
[
(asm_input:SD ("r") /tmp/pr60032.c:12)
]
[] /tmp/pr60032.c:12)
(clobber (reg:SI 98 ca))
]) "/tmp/pr60032.c":12:3 -1
(nil))
}
# The error is reported:
/tmp/pr60032.c: In function 'foo':
/tmp/pr60032.c:10:3: error: impossible constraint in 'asm'
10 | __asm__ ("#" : "=d" (fr1));
| ^~~~~~~
"..."84 va_end (ap);
# set a break at the subsequent call into delete_insn().
0x000000001063486c <+2268>: cmpwi r9,10
0x0000000010634870 <+2272>: beq 0x10634e5c <(anonymous
namespace)::pass_instantiate_virtual_regs::execute(function*)+3788>
=> 0x0000000010634874 <+2276>: mr r3,r31
0x0000000010634878 <+2280>: bl 0x1041d528 <delete_insn(rtx_insn*)+8>
0x000000001063487c <+2284>: nop
(gdb) break * 0x000000001063487c
Breakpoint 15 at 0x1063487c: file function.c, line 1796.
(gdb) c
Continuing.
"..."
Breakpoint 15, 0x000000001063487c in instantiate_virtual_regs_in_insn
(insn=0x200000710340) at function.c:1796
1796 delete_insn (insn);
(gdb) p insn
$7 = (rtx_insn *) 0x200000710340
(gdb) pr insn
warning: Expression is not an assignment (and might have no effect)
(insn/v 5 2 6 2 (parallel [
(set (reg/v:SD 33 1 [ fr1 ])
(asm_operands:SD ("#") ("=d") 0 []
[]
[] /tmp/pr60032.c:10))
(clobber (reg:SI 98 ca))
]) "/tmp/pr60032.c":10:3 -1
(nil))
(gdb)
# And we can see via pcfun that the instruction (#5) has been removed.
(gdb) pcfun
foo ()
{
(note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note 2 3 6 2 NOTE_INSN_FUNCTION_BEG)
(insn 6 2 7 2 (set (subreg:SI (reg:SD 117 [ fr1.0_1 ]) 0)
(subreg:SI (reg/v:SD 33 1 [ fr1 ]) 0)) "/tmp/pr60032.c":11:7 -1
(nil))
(insn 7 6 8 2 (set (reg:SI 30 30 [ r31 ])
(subreg:SI (reg:SD 117 [ fr1.0_1 ]) 0)) "/tmp/pr60032.c":11:7 -1
(nil))
(insn 8 7 0 2 (parallel [
(asm_operands/v ("#") ("") 0 [
(reg/v:SD 30 30 [ r31 ])
]
[
(asm_input:SD ("r") /tmp/pr60032.c:12)
]
[] /tmp/pr60032.c:12)
(clobber (reg:SI 98 ca))
]) "/tmp/pr60032.c":12:3 -1
(nil))
}
(
When we get to lra, we are spinning in the loop
lra_init_equiv ();
for (;;)
{
for (;;)
{
bool reloads_p = lra_constraints (lra_constraint_iter == 0);
...
lra_eliminate (false, false);
...
# backtrace and assorted debug shows we are repeatedly emitting an instruction
via emit_move_insn down this call path:
#0 emit_move_insn (x=0x20000065ed48, y=0x20000065ac80) at expr.c:3804
#1 0x000000001085f7bc in lra_emit_move (x=0x20000065ed48, y=<optimized out>)
at lra.c:499
#2 0x000000001087cf5c in curr_insn_transform
(check_only_p=check_only_p@entry=0x0) at lra-constraints.c:4425
#3 0x000000001087ec00 in lra_constraints (first_p=<optimized out>) at
lra-constraints.c:5025
#4 0x0000000010860518 in lra (f=<optimized out>) at lra.c:2437
#5 0x00000000107ffdec in do_reload () at ira.c:5523
And our pcfun output shows we are continuing to insert a (pair?) of insn
entries.
foo ()
{
(note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note 2 3 38 2 NOTE_INSN_FUNCTION_BEG)
(insn 38 2 39 2 (set (mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 80 [0x50])) [1 %sfp+80 S4 A32])
(subreg:SI (reg/v:SD 33 1 [ fr1 ]) 0)) "/tmp/pr60032.c":11:7 492
{*movsi_internal1}
(expr_list:REG_DEAD (reg:DI 33 1)
(nil)))
(insn 39 38 36 2 (set (subreg:SI (reg/v:SD 142 [ fr1 ]) 0)
(mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 80 [0x50])) [1 %sfp+80 S4 A32]))
"/tmp/pr60032.c":11:7 492 {*movsi_internal1}
(expr_list:REG_DEAD (reg:SI 143)
(nil)))
...
(insn 14 17 15 2 (set (mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 32 [0x20])) [1 %sfp+32 S4 A32])
(subreg:SI (reg/v:SD 120 [ fr1 ]) 0)) "/tmp/pr60032.c":11:7 492
{*movsi_internal1}
(expr_list:REG_DEAD (reg/v:SD 120 [ fr1 ])
(nil)))
(insn 15 14 6 2 (set (subreg:SI (reg/v:SD 118 [ fr1 ]) 0)
(mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 32 [0x20])) [1 %sfp+32 S4 A32]))
"/tmp/pr60032.c":11:7 492 {*movsi_internal1}
(nil))
(insn 6 15 7 2 (set (mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 32 [0x20])) [1 %sfp+32 S4 A32])
(subreg:SI (reg/v:SD 118 [ fr1 ]) 0)) "/tmp/pr60032.c":11:7 492
{*movsi_internal1}
(expr_list:REG_DEAD (reg/v:SD 118 [ fr1 ])
(nil)))
(insn 7 6 8 2 (set (reg:SI 30 30 [ r31 ])
(mem/c:SI (plus:DI (reg/f:DI 110 sfp)
(const_int 32 [0x20])) [1 %sfp+32 S4 A32]))
"/tmp/pr60032.c":11:7 492 {*movsi_internal1}
(nil))
(insn 8 7 11 2 (parallel [
(asm_operands/v ("#") ("") 0 [
(reg/v:SD 30 30 [ r31 ])
]
[
(asm_input:SD ("r") /tmp/pr60032.c:12)
]
[] /tmp/pr60032.c:12)
(clobber (reg:SI 98 ca))
]) "/tmp/pr60032.c":12:3 -1
(expr_list:REG_DEAD (reg/v:SD 30 30 [ r31 ])
(expr_list:REG_UNUSED (reg:SI 98 ca)
(nil))))
(note 11 8 12 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 12 11 13 3 (unspec [
(const_int 0 [0])
] UNSPEC_NOP) "/tmp/pr60032.c":13:1 829 {nop}
(nil))
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc
[not found] <bug-90000-4@http.gcc.gnu.org/bugzilla/>
2020-04-02 15:52 ` [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc willschm at gcc dot gnu.org
@ 2020-04-02 16:38 ` wschmidt at gcc dot gnu.org
2020-05-08 16:51 ` willschm at gcc dot gnu.org
2020-05-08 16:53 ` willschm at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-04-02 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90000
Bill Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-04-02
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #3 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
So, confirmed...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc
[not found] <bug-90000-4@http.gcc.gnu.org/bugzilla/>
2020-04-02 15:52 ` [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc willschm at gcc dot gnu.org
2020-04-02 16:38 ` wschmidt at gcc dot gnu.org
@ 2020-05-08 16:51 ` willschm at gcc dot gnu.org
2020-05-08 16:53 ` willschm at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-05-08 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90000
--- Comment #4 from Will Schmidt <willschm at gcc dot gnu.org> ---
I'll be attaching a proposed(/rfc) patch momentarily.
I'm able to add logic in cfgexpand.c expand_asm_stmt() to catch the use of a FP
register when our target is SOFT_FLOAT ; but the result is an ICE while trying
to process a subsequent instruction.
FAIL: gcc.target/powerpc/pr90000.c (test for excess errors)
Excess errors:
/home/willschm/gcc/gcc-patches/gcc/testsuite/gcc.target/powerpc/pr90000.c:14:3:
error: invalid fp register usage with a soft_float target
^ desired error.
during RTL pass: expand
/home/willschm/gcc/gcc-patches/gcc/testsuite/gcc.target/powerpc/pr90000.c:16:3:
internal compiler error: in operator[], at vec.h:867
0x1018dc3f vec<edge_def*, va_gc, vl_embed>::operator[](unsigned int)
/home/willschm/gcc/gcc-patches/gcc/vec.h:867
0x103f0a0f vec<tree_node*, va_heap, vl_embed>::operator[](unsigned int)
/home/willschm/gcc/gcc-patches/gcc/tree.h:3417
0x103f0a0f vec<tree_node*, va_heap, vl_ptr>::operator[](unsigned int)
/home/willschm/gcc/gcc-patches/gcc/vec.h:1433
0x103f0a0f expand_asm_stmt
/home/willschm/gcc/gcc-patches/gcc/cfgexpand.c:2959
0x103f829f expand_gimple_stmt_1
/home/willschm/gcc/gcc-patches/gcc/cfgexpand.c:3694
0x103f829f expand_gimple_stmt
/home/willschm/gcc/gcc-patches/gcc/cfgexpand.c:3862
0x103ffde3 expand_gimple_basic_block
/home/willschm/gcc/gcc-patches/gcc/cfgexpand.c:5902
0x10402907 execute
/home/willschm/gcc/gcc-patches/gcc/cfgexpand.c:6557
^ subsequent undesired.
Per debug, the subsequent error is occurring when trying to process a
subsequent instruction.
Breakpoint 7, expand_asm_stmt (stmt=stmt@entry=0x200000c10000) at
cfgexpand.c:2920
2920 location_t locus = gimple_location (stmt);
# .MEM_3 = VDEF <.MEM_2(D)>
__asm__("#" : "=d" fr1);
(gdb) c
Continuing./tmp/pr90000.c: In function 'foo':
/tmp/pr90000.c:14:3: error: invalid fp register usage with a soft-float target
14 | __asm__ ("#" : "=d" (fr1)); /* { dg-error "invalid fp register usage
with a soft-float target" } */
| ^~~~~~~
#0 expand_asm_stmt (stmt=stmt@entry=0x200000c10058) at
cfgexpand.c:2920Breakpoint 7, expand_asm_stmt (stmt=stmt@entry=0x200000c10058)
at cfgexpand.c:2920
2920 location_t locus = gimple_location (stmt);
# VUSE <.MEM_4>
__asm__ __volatile__("#" : : "r" r31);
(gdb) c
Continuing.
#0 fancy_abort (file=0x11912d80 "/home/willschm/gcc/gcc-patches/gcc/vec.h",
line=0x363,
function=0x11919948 "operator[]") at diagnostic.c:1778
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/90000] Compile-time hog w/ impossible asm constraints on powerpc
[not found] <bug-90000-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-05-08 16:51 ` willschm at gcc dot gnu.org
@ 2020-05-08 16:53 ` willschm at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: willschm at gcc dot gnu.org @ 2020-05-08 16:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90000
--- Comment #5 from Will Schmidt <willschm at gcc dot gnu.org> ---
Created attachment 48486
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48486&action=edit
Patch that seemed promising but is not sufficient.
^ permalink raw reply [flat|nested] 4+ messages in thread