Hi! After the recent r12-7240 simplify_immed_subreg changes, we bail on more simplify_subreg calls than before, e.g. apparently for decimal modes in the NaN representations we almost never preserve anything except the canonical {q,s}NaNs. simplify_gen_subreg will punt in such cases because a SUBREG with VOIDmode is not valid, but debug_lowpart_subreg wants to attempt even harder, even if e.g. target indicates certain mode combinations aren't valid for the backend, dwarf2out can still handle them. But a SUBREG from a VOIDmode operand is just too much, the inner mode is lost there. We'd need some new rtx that would be able to represent those cases. For now, just punt in those cases.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-02-17 Jakub Jelinek <ja...@redhat.com> PR debug/104557 * valtrack.cc (debug_lowpart_subreg): Don't call gen_rtx_raw_SUBREG if expr has VOIDmode. * gcc.dg/dfp/pr104557.c: New test. --- gcc/valtrack.cc.jj 2022-01-18 11:59:00.252972485 +0100 +++ gcc/valtrack.cc 2022-02-16 11:29:28.234826860 +0100 @@ -558,7 +558,9 @@ debug_lowpart_subreg (machine_mode outer rtx ret = simplify_gen_subreg (outer_mode, expr, inner_mode, offset); if (ret) return ret; - return gen_rtx_raw_SUBREG (outer_mode, expr, offset); + if (GET_MODE (expr) != VOIDmode) + return gen_rtx_raw_SUBREG (outer_mode, expr, offset); + return NULL_RTX; } /* If UREGNO is referenced by any entry in DEBUG, emit a debug insn --- gcc/testsuite/gcc.dg/dfp/pr104557.c.jj 2022-02-16 11:36:03.733329235 +0100 +++ gcc/testsuite/gcc.dg/dfp/pr104557.c 2022-02-16 11:35:27.599831513 +0100 @@ -0,0 +1,22 @@ +/* PR debug/104557 */ +/* { dg-do compile } */ +/* { dg-options "-O -g -Wno-psabi" } */ + +typedef int __attribute__((__vector_size__ (32))) U; +typedef double __attribute__((__vector_size__ (32))) F; +typedef _Decimal64 __attribute__((__vector_size__ (32))) D; + +F +bar (void) +{ + F f = __builtin_convertvector ((D) (-10.d < (D) ((D) (U) { 0, 0, 0, 0, 0, 0, 0, -0xe0 } + >= (D) { 80000000 })), F); + return f; +} + +F +foo () +{ + F x = bar (); + return x; +} Jakub