From: Vladimir N. Makarov Date: Wed, 22 Mar 2023 16:33:11 +0000 (-0400) Subject: LRA: Do not repeat inheritance and live range splitting in case of asm error X-Git-Tag: basepoints/gcc-14~403 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81d762cbec9685c2f2571da21d48f42c42eff33b;p=thirdparty%2Fgcc.git LRA: Do not repeat inheritance and live range splitting in case of asm error LRA was trying to do live range splitting again and again as there were no enough regs for asm. This patch solves the problem. PR target/109137 gcc/ChangeLog: * lra.cc (lra): Do not repeat inheritance and live range splitting when asm error is found. gcc/testsuite/ChangeLog: * gcc.target/i386/pr109137.c: New. --- diff --git a/gcc/lra.cc b/gcc/lra.cc index f7fdd601e716..eb3ee1f8b63a 100644 --- a/gcc/lra.cc +++ b/gcc/lra.cc @@ -2453,7 +2453,7 @@ lra (FILE *f) lra_hard_reg_split_p = true; } } - while (fails_p); + while (fails_p && !lra_asm_error_p); if (! live_p) { /* We need the correct reg notes for work of constraint sub-pass. */ lra_create_live_ranges (true, true); diff --git a/gcc/testsuite/gcc.target/i386/pr109137.c b/gcc/testsuite/gcc.target/i386/pr109137.c new file mode 100644 index 000000000000..ffd8e8c574b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr109137.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-m32 -O3 -march=znver1 -fPIC -mfpmath=sse -w" } */ +#include +typedef struct { + char bytestream_end; +} CABACContext; +int get_cabac___trans_tmp_3, get_cabac_tmp, get_cabac_c, + decode_cabac_mb_intra4x4_pred_mode_mode, ff_h264_decode_mb_cabac_h_0, + ff_h264_decode_mb_cabac_bit; +typedef struct { + char intra4x4_pred_mode_cache[2]; +} H264SliceContext; +H264SliceContext ff_h264_decode_mb_cabac_sl; +void ff_h264_decode_mb_cabac(void) { + memset((void*)ff_h264_decode_mb_cabac_h_0, 6, 48); + int i; + for (;; i++) { + __asm__(""/* { dg-error "'asm' operand has impossible constraints" } */ + : "=&r"(ff_h264_decode_mb_cabac_bit), "=&r"(get_cabac_c), + "=&r"(get_cabac_c), "=&q"(get_cabac_tmp) + : "r"(get_cabac___trans_tmp_3), + "r"(__builtin_offsetof(CABACContext, bytestream_end)) + : "ecx"); + ff_h264_decode_mb_cabac_sl.intra4x4_pred_mode_cache[i] = + decode_cabac_mb_intra4x4_pred_mode_mode; + } +} +