[PR99454] LRA: Process separately 'g' and digital constraints > 9 in process_address_1
authorVladimir N. Makarov <vmakarov@redhat.com>
Tue, 9 Mar 2021 15:57:21 +0000 (10:57 -0500)
committerVladimir N. Makarov <vmakarov@redhat.com>
Tue, 9 Mar 2021 16:10:29 +0000 (11:10 -0500)
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
gcc/testsuite/gcc.target/i386/pr99454.c [new file with mode: 0644]

index feff766..05cb493 100644 (file)
@@ -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 (file)
index 0000000..a59ba7d
--- /dev/null
@@ -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;
+}