From fb5d9e8361892a627f5ef9dda7f356f34000ed5b Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Tue, 9 Mar 2021 10:57:21 -0500 Subject: [PATCH] [PR99454] LRA: Process separately 'g' and digital constraints > 9 in process_address_1 gcc/ChangeLog: PR target/99454 * lra-constraints.c (process_address_1): Process constraint 'g' separately and digital constraints containing more one digit. gcc/testsuite/ChangeLog: PR target/99454 * gcc.target/i386/pr99454.c: New. --- gcc/lra-constraints.c | 13 +++++--- gcc/testsuite/gcc.target/i386/pr99454.c | 43 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr99454.c diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index feff766c590..05cb493852f 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -3452,10 +3452,13 @@ process_address_1 (int nop, bool check_only_p, constraint = skip_contraint_modifiers (curr_static_id->operand[nop].constraint); - if ('0' <= constraint[0] && constraint[0] <= '9') - constraint - = skip_contraint_modifiers (curr_static_id->operand - [constraint[0] - '0'].constraint); + if (IN_RANGE (constraint[0], '0', '9')) + { + char *end; + unsigned long dup = strtoul (constraint, &end, 10); + constraint + = skip_contraint_modifiers (curr_static_id->operand[dup].constraint); + } cn = lookup_constraint (constraint); if (insn_extra_address_constraint (cn) /* When we find an asm operand with an address constraint that @@ -3472,7 +3475,7 @@ process_address_1 (int nop, bool check_only_p, i.e. bcst_mem_operand in i386 backend. */ else if (MEM_P (mem) && !(INSN_CODE (curr_insn) < 0 - && (cn == CONSTRAINT__UNKNOWN + && ((cn == CONSTRAINT__UNKNOWN && *constraint != 'g') || (get_constraint_type (cn) == CT_FIXED_FORM && constraint_satisfied_p (op, cn))))) decompose_mem_address (&ad, mem); diff --git a/gcc/testsuite/gcc.target/i386/pr99454.c b/gcc/testsuite/gcc.target/i386/pr99454.c new file mode 100644 index 00000000000..a59ba7dcbe0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99454.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O -w" } */ + +struct skb_shared_info { + short gso_size; +}; + +enum { NETDEV_TX_OK }; + +struct iphdr { + short tot_len; + int daddr; +}; + +int tg3_tso_bug(); +int netdev_priv(); +int skb_cow_head(); +int tcp_hdrlen__builtin_expect(); +struct iphdr *ip_hdr(); +int _tg3_flag(); +int tg3_tso_bug_gso_check(); + +int +tg3_start_xmit() { + int *tp = netdev_priv(); + int mss, tnapi; + struct iphdr *iph; + tnapi = mss = ((struct skb_shared_info *)0)->gso_size; + if (mss) { + int hdr_len; + if (skb_cow_head()) + iph = ip_hdr(); + hdr_len = tcp_hdrlen__builtin_expect() && _tg3_flag(); + if (tg3_tso_bug_gso_check()) + return tg3_tso_bug(tp, tnapi); + iph->tot_len = mss + hdr_len; + if (_tg3_flag(tp) || tp) + ; + else + asm("" : : "g"(iph->daddr)); + } + return 0; +}