2018-08-23  Uros Bizjak  <ubiz...@gmail.com>

    * emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
    * emit-rtl.h (rtl_data): Remove return_bnd.
    * explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
    * function.c (diddle_return_value): Do not handle crtl->return_bnd.
    * genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
    (POINTER_BOUNDS_MODE): Remove definition.
    (make_pointer_bounds_mode): Remove.
    (get_mode_class): Do not handle MODE_POINTER_BOUNDS.
    * machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
    (scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
    * mode-classes.def: Do not define MODE_POINTER_BOUNDS.
    * stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
    * tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
    * varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.

    * config/i386/i386-modes.def (BND32, BND64): Remove.
    * config/i386/i386.c (dbx_register_map): Remove bound registers.
    (dbx64_register_map): Ditto.
    (svr4_dbx_register_map): Ditto.
    (indirect_thunk_bnd_needed): Remove.
    (indirect_thunks_bnd_used): Ditto.
    (indirect_return_bnd_needed): Ditto.
    (indirect_return_via_cx_bnd): Ditto.
    (enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
    (indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
    (output_indirect_thunk): Ditto.  Remove need_prefix argument.
    (output_indirect_thunk_function): Remove handling of
    indirect_return_bnd_needed, indirect_return_via_cx_bnd,
    indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
    (ix86_save_reg): Remove handling of crtl->return_bnd.
    (ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
    (ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
    and UNSPEC_BNDLX_ADDR.
    (ix86_output_indirect_branch_via_reg): Remove handling of
    indirect_thunk_prefix_bnd.
    (ix86_output_indirect_branch_via_push): Ditto.
    (ix86_output_function_return): Ditto.
    (ix86_output_indirect_function_return): Ditto.
    (avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
    * config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
    (CALL_USED_REGISTERS): Ditto.
    (REG_ALLOC_ORDER): Update for removal of bound registers.
    (HI_REGISTER_NAMES): Ditto.
    * config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
    (UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
    (UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
    (BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
    (FIRST_PSEUDO_REG): Update.
    (BND): Remove mode iterator.
    * config/i386/predicates.md (bnd_mem_operator): Remove.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline?

Uros.
diff --git a/gcc/config/i386/i386-modes.def b/gcc/config/i386/i386-modes.def
index 08c79a5df4e9..12c17ce7dfc2 100644
--- a/gcc/config/i386/i386-modes.def
+++ b/gcc/config/i386/i386-modes.def
@@ -98,9 +98,6 @@ VECTOR_MODE (INT, QI, 14);    /*                  V14QI */
 VECTOR_MODE (INT, HI, 6);     /*                   V6HI */
 VECTOR_MODE (INT, SI, 64);    /*                 V64SI */
 
-POINTER_BOUNDS_MODE (BND32, 8);
-POINTER_BOUNDS_MODE (BND64, 16);
-
 INT_MODE (OI, 32);
 INT_MODE (XI, 64);
 
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 03118102319b..98677386a2b9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -262,7 +262,7 @@ enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER] =
   EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS,
   /* Mask registers.  */
   MASK_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
-  MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
+  MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS
 };
 
 /* The "default" register map used in 32bit mode.  */
@@ -278,8 +278,7 @@ int const dbx_register_map[FIRST_PSEUDO_REGISTER] =
   -1, -1, -1, -1, -1, -1, -1, -1,      /* extended SSE registers */
   -1, -1, -1, -1, -1, -1, -1, -1,       /* AVX-512 registers 16-23*/
   -1, -1, -1, -1, -1, -1, -1, -1,       /* AVX-512 registers 24-31*/
-  93, 94, 95, 96, 97, 98, 99, 100,      /* Mask registers */
-  101, 102, 103, 104,                  /* bound registers */
+  93, 94, 95, 96, 97, 98, 99, 100       /* Mask registers */
 };
 
 /* The "default" register map used in 64bit mode.  */
@@ -295,8 +294,7 @@ int const dbx64_register_map[FIRST_PSEUDO_REGISTER] =
   25, 26, 27, 28, 29, 30, 31, 32,      /* extended SSE registers */
   67, 68, 69, 70, 71, 72, 73, 74,       /* AVX-512 registers 16-23 */
   75, 76, 77, 78, 79, 80, 81, 82,       /* AVX-512 registers 24-31 */
-  118, 119, 120, 121, 122, 123, 124, 125, /* Mask registers */
-  126, 127, 128, 129,                  /* bound registers */
+  118, 119, 120, 121, 122, 123, 124, 125 /* Mask registers */
 };
 
 /* Define the register numbers to be used in Dwarf debugging information.
@@ -364,8 +362,7 @@ int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER] =
   -1, -1, -1, -1, -1, -1, -1, -1,      /* extended SSE registers */
   -1, -1, -1, -1, -1, -1, -1, -1,       /* AVX-512 registers 16-23*/
   -1, -1, -1, -1, -1, -1, -1, -1,       /* AVX-512 registers 24-31*/
-  93, 94, 95, 96, 97, 98, 99, 100,      /* Mask registers */
-  101, 102, 103, 104,                  /* bound registers */
+  93, 94, 95, 96, 97, 98, 99, 100       /* Mask registers */
 };
 
 /* Define parameter passing and return registers.  */
@@ -10646,26 +10643,16 @@ static int indirectlabelno;
 
 /* True if call thunk function is needed.  */
 static bool indirect_thunk_needed = false;
-/* True if call thunk function with the BND prefix is needed.  */
-static bool indirect_thunk_bnd_needed = false;
 
 /* Bit masks of integer registers, which contain branch target, used
    by call thunk functions.  */
 static int indirect_thunks_used;
-/* Bit masks of integer registers, which contain branch target, used
-   by call thunk functions with the BND prefix.  */
-static int indirect_thunks_bnd_used;
 
 /* True if return thunk function is needed.  */
 static bool indirect_return_needed = false;
-/* True if return thunk function with the BND prefix is needed.  */
-static bool indirect_return_bnd_needed = false;
 
 /* True if return thunk function via CX is needed.  */
 static bool indirect_return_via_cx;
-/* True if return thunk function via CX with the BND prefix is
-   needed.  */
-static bool indirect_return_via_cx_bnd;
 
 #ifndef INDIRECT_LABEL
 # define INDIRECT_LABEL "LIND"
@@ -10675,7 +10662,6 @@ static bool indirect_return_via_cx_bnd;
 enum indirect_thunk_prefix
 {
   indirect_thunk_prefix_none,
-  indirect_thunk_prefix_bnd,
   indirect_thunk_prefix_nt
 };
 
@@ -10712,10 +10698,8 @@ indirect_thunk_name (char name[32], unsigned int regno,
     {
       const char *prefix;
 
-      if (need_prefix == indirect_thunk_prefix_bnd)
-       prefix = "_bnd";
-      else if (need_prefix == indirect_thunk_prefix_nt
-              && regno != INVALID_REGNUM)
+      if (need_prefix == indirect_thunk_prefix_nt
+         && regno != INVALID_REGNUM)
        {
          /* NOTRACK prefix is only used with external thunk via
             register so that NOTRACK prefix can be added to indirect
@@ -10743,35 +10727,19 @@ indirect_thunk_name (char name[32], unsigned int 
regno,
   else
     {
       if (regno != INVALID_REGNUM)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno);
-         else
-           ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
-       }
+       ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
       else
        {
          if (ret_p)
-           {
-             if (need_prefix == indirect_thunk_prefix_bnd)
-               ASM_GENERATE_INTERNAL_LABEL (name, "LRTB", 0);
-             else
-               ASM_GENERATE_INTERNAL_LABEL (name, "LRT", 0);
-           }
+           ASM_GENERATE_INTERNAL_LABEL (name, "LRT", 0);
          else
-           {
-             if (need_prefix == indirect_thunk_prefix_bnd)
-               ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0);
-             else
-               ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
-           }
+           ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
        }
     }
 }
 
-/* Output a call and return thunk for indirect branch.  If BND_P is
-   true, the BND prefix is needed.   If REGNO != -1,  the function
-   address is in REGNO and the call and return thunk looks like:
+/* Output a call and return thunk for indirect branch.  If REGNO != -1,
+   the function address is in REGNO and the call and return thunk looks like:
 
        call    L2
    L1:
@@ -10796,8 +10764,7 @@ indirect_thunk_name (char name[32], unsigned int regno,
  */
 
 static void
-output_indirect_thunk (enum indirect_thunk_prefix need_prefix,
-                      unsigned int regno)
+output_indirect_thunk (unsigned int regno)
 {
   char indirectlabel1[32];
   char indirectlabel2[32];
@@ -10808,10 +10775,7 @@ output_indirect_thunk (enum indirect_thunk_prefix 
need_prefix,
                               indirectlabelno++);
 
   /* Call */
-  if (need_prefix == indirect_thunk_prefix_bnd)
-    fputs ("\tbnd call\t", asm_out_file);
-  else
-    fputs ("\tcall\t", asm_out_file);
+  fputs ("\tcall\t", asm_out_file);
   assemble_name_raw (asm_out_file, indirectlabel2);
   fputc ('\n', asm_out_file);
 
@@ -10845,17 +10809,13 @@ output_indirect_thunk (enum indirect_thunk_prefix 
need_prefix,
       output_asm_insn ("lea\t{%E1, %0|%0, %E1}", xops);
     }
 
-  if (need_prefix == indirect_thunk_prefix_bnd)
-    fputs ("\tbnd ret\n", asm_out_file);
-  else
-    fputs ("\tret\n", asm_out_file);
+  fputs ("\tret\n", asm_out_file);
 }
 
 /* Output a funtion with a call and return thunk for indirect branch.
-   If BND_P is true, the BND prefix is needed.  If REGNO != UNVALID_REGNUM,
-   the function address is in REGNO.  Otherwise, the function address is
-   on the top of stack.  Thunk is used for function return if RET_P is
-   true.  */
+   If REGNO != INVALID_REGNUM, the function address is in REGNO.
+   Otherwise, the function address is on the top of stack.  Thunk is
+   used for function return if RET_P is true.  */
 
 static void
 output_indirect_thunk_function (enum indirect_thunk_prefix need_prefix,
@@ -10864,7 +10824,7 @@ output_indirect_thunk_function (enum 
indirect_thunk_prefix need_prefix,
   char name[32];
   tree decl;
 
-  /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd.  */
+  /* Create __x86_indirect_thunk.  */
   indirect_thunk_name (name, regno, need_prefix, ret_p);
   decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
                     get_identifier (name),
@@ -10919,7 +10879,7 @@ output_indirect_thunk_function (enum 
indirect_thunk_prefix need_prefix,
   /* Make sure unwind info is emitted for the thunk if needed.  */
   final_start_function (emit_barrier (), asm_out_file, 1);
 
-  output_indirect_thunk (need_prefix, regno);
+  output_indirect_thunk (regno);
 
   final_end_function ();
   init_insn_lengths ();
@@ -10957,23 +10917,12 @@ ix86_code_end (void)
   if (indirect_return_needed)
     output_indirect_thunk_function (indirect_thunk_prefix_none,
                                    INVALID_REGNUM, true);
-  if (indirect_return_bnd_needed)
-    output_indirect_thunk_function (indirect_thunk_prefix_bnd,
-                                   INVALID_REGNUM, true);
-
   if (indirect_return_via_cx)
     output_indirect_thunk_function (indirect_thunk_prefix_none,
                                    CX_REG, true);
-  if (indirect_return_via_cx_bnd)
-    output_indirect_thunk_function (indirect_thunk_prefix_bnd,
-                                   CX_REG, true);
-
   if (indirect_thunk_needed)
     output_indirect_thunk_function (indirect_thunk_prefix_none,
                                    INVALID_REGNUM, false);
-  if (indirect_thunk_bnd_needed)
-    output_indirect_thunk_function (indirect_thunk_prefix_bnd,
-                                   INVALID_REGNUM, false);
 
   for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++)
     {
@@ -10981,10 +10930,6 @@ ix86_code_end (void)
       if ((indirect_thunks_used & (1 << i)))
        output_indirect_thunk_function (indirect_thunk_prefix_none,
                                        regno, false);
-
-      if ((indirect_thunks_bnd_used & (1 << i)))
-       output_indirect_thunk_function (indirect_thunk_prefix_bnd,
-                                       regno, false);
     }
 
   for (regno = FIRST_INT_REG; regno <= LAST_INT_REG; regno++)
@@ -10996,10 +10941,6 @@ ix86_code_end (void)
        output_indirect_thunk_function (indirect_thunk_prefix_none,
                                        regno, false);
 
-      if ((indirect_thunks_bnd_used & (1 << regno)))
-       output_indirect_thunk_function (indirect_thunk_prefix_bnd,
-                                       regno, false);
-
       if (!(pic_labels_used & (1 << regno)))
        continue;
 
@@ -11274,16 +11215,6 @@ ix86_save_reg (unsigned int regno, bool 
maybe_eh_return, bool ignore_outlined)
          while (nregs-- > 0)
            if ((i + nregs) == regno)
              return false;
-
-         reg = crtl->return_bnd;
-         if (reg)
-           {
-             i = REGNO (reg);
-             nregs = REG_NREGS (reg);
-             while (nregs-- > 0)
-               if ((i + nregs) == regno)
-                 return false;
-           }
        }
 
       return (df_regs_ever_live_p (regno)
@@ -15494,10 +15425,6 @@ ix86_force_load_from_GOT_p (rtx x)
 static bool
 ix86_legitimate_constant_p (machine_mode mode, rtx x)
 {
-  /* Pointer bounds constants are not valid.  */
-  if (POINTER_BOUNDS_MODE_P (GET_MODE (x)))
-    return false;
-
   switch (GET_CODE (x))
     {
     case CONST:
@@ -18636,25 +18563,6 @@ ix86_print_operand_address_as (FILE *file, rtx addr,
       ok = ix86_decompose_address (XVECEXP (addr, 0, 0), &parts);
       code = 'q';
     }
-  else if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_BNDMK_ADDR)
-    {
-      ok = ix86_decompose_address (XVECEXP (addr, 0, 1), &parts);
-      gcc_assert (parts.base == NULL_RTX || parts.index == NULL_RTX);
-      if (parts.base != NULL_RTX)
-       {
-         parts.index = parts.base;
-         parts.scale = 1;
-       }
-      parts.base = XVECEXP (addr, 0, 0);
-      addr = XVECEXP (addr, 0, 0);
-    }
-  else if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_BNDLDX_ADDR)
-    {
-      ok = ix86_decompose_address (XVECEXP (addr, 0, 0), &parts);
-      gcc_assert (parts.index == NULL_RTX);
-      parts.index = XVECEXP (addr, 0, 1);
-      addr = XVECEXP (addr, 0, 0);
-    }
   else
     ok = ix86_decompose_address (addr, &parts);
 
@@ -28540,10 +28448,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool 
sibcall_p)
          int i = regno;
          if (i >= FIRST_REX_INT_REG)
            i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           indirect_thunks_bnd_used |= 1 << i;
-         else
-           indirect_thunks_used |= 1 << i;
+         indirect_thunks_used |= 1 << i;
        }
       indirect_thunk_name (thunk_name_buf, regno, need_prefix, false);
       thunk_name = thunk_name_buf;
@@ -28554,23 +28459,15 @@ ix86_output_indirect_branch_via_reg (rtx call_op, 
bool sibcall_p)
   if (sibcall_p)
     {
       if (thunk_name != NULL)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-         else
-           fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-       }
+       fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
       else
-       output_indirect_thunk (need_prefix, regno);
+       output_indirect_thunk (regno);
     }
   else
     {
       if (thunk_name != NULL)
        {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           fprintf (asm_out_file, "\tbnd call\t%s\n", thunk_name);
-         else
-           fprintf (asm_out_file, "\tcall\t%s\n", thunk_name);
+         fprintf (asm_out_file, "\tcall\t%s\n", thunk_name);
          return;
        }
 
@@ -28585,32 +28482,21 @@ ix86_output_indirect_branch_via_reg (rtx call_op, 
bool sibcall_p)
                                   indirectlabelno++);
 
       /* Jump.  */
-      if (need_prefix == indirect_thunk_prefix_bnd)
-       fputs ("\tbnd jmp\t", asm_out_file);
-      else
-       fputs ("\tjmp\t", asm_out_file);
+      fputs ("\tjmp\t", asm_out_file);
       assemble_name_raw (asm_out_file, indirectlabel2);
       fputc ('\n', asm_out_file);
 
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
 
       if (thunk_name != NULL)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-         else
-           fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-       }
+       fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
       else
-       output_indirect_thunk (need_prefix, regno);
+       output_indirect_thunk (regno);
 
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
 
       /* Call.  */
-      if (need_prefix == indirect_thunk_prefix_bnd)
-       fputs ("\tbnd call\t", asm_out_file);
-      else
-       fputs ("\tcall\t", asm_out_file);
+      fputs ("\tcall\t", asm_out_file);
       assemble_name_raw (asm_out_file, indirectlabel1);
       fputc ('\n', asm_out_file);
     }
@@ -28649,12 +28535,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, 
const char *xasm,
       != indirect_branch_thunk_inline)
     {
       if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           indirect_thunk_bnd_needed = true;
-         else
-           indirect_thunk_needed = true;
-       }
+       indirect_thunk_needed = true;
       indirect_thunk_name (thunk_name_buf, regno, need_prefix, false);
       thunk_name = thunk_name_buf;
     }
@@ -28668,14 +28549,9 @@ ix86_output_indirect_branch_via_push (rtx call_op, 
const char *xasm,
     {
       output_asm_insn (push_buf, &call_op);
       if (thunk_name != NULL)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-         else
-           fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-       }
+       fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
       else
-       output_indirect_thunk (need_prefix, regno);
+       output_indirect_thunk (regno);
     }
   else
     {
@@ -28690,10 +28566,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, 
const char *xasm,
                                   indirectlabelno++);
 
       /* Jump.  */
-      if (need_prefix == indirect_thunk_prefix_bnd)
-       fputs ("\tbnd jmp\t", asm_out_file);
-      else
-       fputs ("\tjmp\t", asm_out_file);
+      fputs ("\tjmp\t", asm_out_file);
       assemble_name_raw (asm_out_file, indirectlabel2);
       fputc ('\n', asm_out_file);
 
@@ -28735,22 +28608,14 @@ ix86_output_indirect_branch_via_push (rtx call_op, 
const char *xasm,
       output_asm_insn (push_buf, &call_op);
 
       if (thunk_name != NULL)
-       {
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-         else
-           fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-       }
+       fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
       else
-       output_indirect_thunk (need_prefix, regno);
+       output_indirect_thunk (regno);
 
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
 
       /* Call.  */
-      if (need_prefix == indirect_thunk_prefix_bnd)
-       fputs ("\tbnd call\t", asm_out_file);
-      else
-       fputs ("\tcall\t", asm_out_file);
+      fputs ("\tcall\t", asm_out_file);
       assemble_name_raw (asm_out_file, indirectlabel1);
       fputc ('\n', asm_out_file);
     }
@@ -28808,19 +28673,11 @@ ix86_output_function_return (bool long_p)
                             == indirect_branch_thunk);
          indirect_thunk_name (thunk_name, INVALID_REGNUM, need_prefix,
                               true);
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           {
-             indirect_return_bnd_needed |= need_thunk;
-             fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-           }
-         else
-           {
-             indirect_return_needed |= need_thunk;
-             fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
-           }
+         indirect_return_needed |= need_thunk;
+         fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
        }
       else
-       output_indirect_thunk (need_prefix, INVALID_REGNUM);
+       output_indirect_thunk (INVALID_REGNUM);
 
       return "";
     }
@@ -28851,27 +28708,16 @@ ix86_output_indirect_function_return (rtx ret_op)
          bool need_thunk = (cfun->machine->function_return_type
                             == indirect_branch_thunk);
          indirect_thunk_name (thunk_name, regno, need_prefix, true);
-         if (need_prefix == indirect_thunk_prefix_bnd)
-           {
-             if (need_thunk)
-               {
-                 indirect_return_via_cx_bnd = true;
-                 indirect_thunks_bnd_used |= 1 << CX_REG;
-               }
-             fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
-           }
-         else
+
+         if (need_thunk)
            {
-             if (need_thunk)
-               {
-                 indirect_return_via_cx = true;
-                 indirect_thunks_used |= 1 << CX_REG;
-               }
-             fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+             indirect_return_via_cx = true;
+             indirect_thunks_used |= 1 << CX_REG;
            }
+         fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
        }
       else
-       output_indirect_thunk (need_prefix, regno);
+       output_indirect_thunk (regno);
 
       return "";
     }
@@ -29486,16 +29332,6 @@ avoid_func_arg_motion (rtx_insn *first_arg, rtx_insn 
*insn)
   rtx set;
   rtx tmp;
 
-  /* Add anti dependencies for bounds stores.  */
-  if (INSN_P (insn)
-      && GET_CODE (PATTERN (insn)) == PARALLEL
-      && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == UNSPEC
-      && XINT (XVECEXP (PATTERN (insn), 0, 0), 1) == UNSPEC_BNDSTX)
-    {
-      add_dependence (first_arg, insn, REG_DEP_ANTI);
-      return;
-    }
-
   set = single_set (insn);
   if (!set)
     return;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index fbba598ffd5b..2a46fccdec11 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1033,9 +1033,7 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
 /*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/            \
      0,   0,    0,    0,    0,    0,    0,    0,               \
 /*  k0,  k1, k2, k3, k4, k5, k6, k7*/                          \
-     0,  0,   0,  0,  0,  0,  0,  0,                           \
-/*   b0, b1, b2, b3*/                                          \
-     0,  0,  0,  0 }
+     0,  0,   0,  0,  0,  0,  0,  0 }
 
 /* 1 for registers not available across function calls.
    These must include the FIXED_REGISTERS and also any
@@ -1072,9 +1070,7 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
 /*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/            \
      6,    6,     6,    6,    6,    6,    6,    6,             \
  /* k0,  k1,  k2,  k3,  k4,  k5,  k6,  k7*/                    \
-     1,   1,   1,   1,   1,   1,   1,   1,                     \
-/*   b0, b1, b2, b3*/                                          \
-     1,  1,  1,  1 }
+     1,   1,   1,   1,   1,   1,   1,   1 }
 
 /* Order in which to allocate registers.  Each register must be
    listed once, even those in FIXED_REGISTERS.  List frame pointer
@@ -1090,8 +1086,7 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, \
    33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,  \
    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, \
-   63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,  \
-   78, 79, 80 }
+   63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 }
 
 /* ADJUST_REG_ALLOC_ORDER is a macro which permits reg_alloc_order
    to be rearranged based on a particular function.  When using sse math,
@@ -2043,8 +2038,7 @@ do {                                                      
\
  "xmm20", "xmm21", "xmm22", "xmm23",                                   \
  "xmm24", "xmm25", "xmm26", "xmm27",                                   \
  "xmm28", "xmm29", "xmm30", "xmm31",                                   \
- "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",                       \
- "bnd0", "bnd1", "bnd2", "bnd3" }
+ "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" }
 
 #define REGISTER_NAMES HI_REGISTER_NAMES
 
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 71faa218ffaa..62dab1662a38 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -184,16 +184,6 @@
   UNSPEC_PDEP
   UNSPEC_PEXT
 
-  UNSPEC_BNDMK
-  UNSPEC_BNDMK_ADDR
-  UNSPEC_BNDSTX
-  UNSPEC_BNDLDX
-  UNSPEC_BNDLDX_ADDR
-  UNSPEC_BNDCL
-  UNSPEC_BNDCU
-  UNSPEC_BNDCN
-  UNSPEC_MPX_FENCE
-
   ;; IRET support
   UNSPEC_INTERRUPT_RETURN
 ])
@@ -428,11 +418,7 @@
    (MASK5_REG                  74)
    (MASK6_REG                  75)
    (MASK7_REG                  76)
-   (BND0_REG                   77)
-   (BND1_REG                   78)
-   (BND2_REG                   79)
-   (BND3_REG                   80)
-   (FIRST_PSEUDO_REG           81)
+   (FIRST_PSEUDO_REG           77)
   ])
 
 ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
@@ -1054,10 +1040,6 @@
 (define_mode_iterator DWIH [(SI "!TARGET_64BIT")
                            (DI "TARGET_64BIT")])
 
-;; Bound modes.
-(define_mode_iterator BND [(BND32 "!TARGET_LP64")
-                          (BND64 "TARGET_LP64")])
-
 ;; Instruction suffix for integer modes.
 (define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
 
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index babaf1d94337..ed3bc7c6619d 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1135,9 +1135,6 @@
 (define_predicate "vsib_mem_operator"
   (match_code "mem"))
 
-(define_predicate "bnd_mem_operator"
-  (match_code "mem"))
-
 ;; Return true if the rtx is known to be at least 32 bits aligned.
 (define_predicate "aligned_operand"
   (match_operand 0 "general_operand")
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index dacf27e087ce..9a735fab5bfa 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -6410,13 +6410,6 @@ init_emit_once (void)
     if (GET_MODE_CLASS ((machine_mode) i) == MODE_CC)
       const_tiny_rtx[0][i] = const0_rtx;
 
-  FOR_EACH_MODE_IN_CLASS (smode_iter, MODE_POINTER_BOUNDS)
-    {
-      scalar_mode smode = smode_iter.require ();
-      wide_int wi_zero = wi::zero (GET_MODE_PRECISION (smode));
-      const_tiny_rtx[0][smode] = immed_wide_int_const (wi_zero, smode);
-    }
-
   pc_rtx = gen_rtx_fmt_ (PC, VOIDmode);
   ret_rtx = gen_rtx_fmt_ (RETURN, VOIDmode);
   simple_return_rtx = gen_rtx_fmt_ (SIMPLE_RETURN, VOIDmode);
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index 4e7bd1ec26d8..f089355aef7e 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -75,9 +75,6 @@ struct GTY(()) rtl_data {
      result in a register, current_function_return_rtx will always be
      the hard register containing the result.  */
   rtx return_rtx;
-  /* If nonxero, an RTL expression for the lcoation at which the current
-     function returns bounds for its result.  */
-  rtx return_bnd;
 
   /* Vector of initial-value pairs.  Each pair consists of a pseudo
      register of approprite mode that stores the initial value a hard
diff --git a/gcc/explow.c b/gcc/explow.c
index 9a6182ac5c5f..7d83eb16b6dd 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -56,8 +56,7 @@ trunc_int_for_mode (HOST_WIDE_INT c, machine_mode mode)
   int width = GET_MODE_PRECISION (smode);
 
   /* You want to truncate to a _what_?  */
-  gcc_assert (SCALAR_INT_MODE_P (mode)
-             || POINTER_BOUNDS_MODE_P (mode));
+  gcc_assert (SCALAR_INT_MODE_P (mode));
 
   /* Canonicalize BImode to 0 and STORE_FLAG_VALUE.  */
   if (smode == BImode)
diff --git a/gcc/function.c b/gcc/function.c
index dee303cdbdd4..302438323c87 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5180,7 +5180,6 @@ diddle_return_value_1 (void (*doit) (rtx, void *), void 
*arg, rtx outgoing)
 void
 diddle_return_value (void (*doit) (rtx, void *), void *arg)
 {
-  diddle_return_value_1 (doit, arg, crtl->return_bnd);
   diddle_return_value_1 (doit, arg, crtl->return_rtx);
 }
 
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index af0d280e2080..6db9ed475f4d 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -340,7 +340,6 @@ complete_mode (struct mode_data *m)
       break;
 
     case MODE_INT:
-    case MODE_POINTER_BOUNDS:
     case MODE_FLOAT:
     case MODE_DECIMAL_FLOAT:
     case MODE_FRACT:
@@ -572,19 +571,6 @@ make_special_mode (enum mode_class cl, const char *name,
   new_mode (cl, name, file, line);
 }
 
-#define POINTER_BOUNDS_MODE(N, Y) \
-  make_pointer_bounds_mode (#N, Y, __FILE__, __LINE__)
-
-static void ATTRIBUTE_UNUSED
-make_pointer_bounds_mode (const char *name,
-                         unsigned int bytesize,
-                         const char *file, unsigned int line)
-{
-  struct mode_data *m = new_mode (MODE_POINTER_BOUNDS, name, file, line);
-  m->bytesize = bytesize;
-}
-
-
 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
 #define FRACTIONAL_INT_MODE(N, B, Y) \
   make_int_mode (#N, B, Y, __FILE__, __LINE__)
@@ -1213,7 +1199,6 @@ get_mode_class (struct mode_data *mode)
     case MODE_UFRACT:
     case MODE_ACCUM:
     case MODE_UACCUM:
-    case MODE_POINTER_BOUNDS:
       return "scalar_mode";
 
     case MODE_FLOAT:
diff --git a/gcc/machmode.h b/gcc/machmode.h
index b938eeaa26bf..239a9098f53a 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -237,9 +237,6 @@ extern const unsigned char mode_class[NUM_MACHINE_MODES];
    || CLASS == MODE_ACCUM                      \
    || CLASS == MODE_UACCUM)
 
-#define POINTER_BOUNDS_MODE_P(MODE)      \
-  (GET_MODE_CLASS (MODE) == MODE_POINTER_BOUNDS)
-
 /* An optional T (i.e. a T or nothing), where T is some form of mode class.  */
 template<typename T>
 class opt_mode
@@ -482,7 +479,6 @@ scalar_mode::includes_p (machine_mode m)
     case MODE_UACCUM:
     case MODE_FLOAT:
     case MODE_DECIMAL_FLOAT:
-    case MODE_POINTER_BOUNDS:
       return true;
     default:
       return false;
diff --git a/gcc/mode-classes.def b/gcc/mode-classes.def
index 522e446c7ba6..62ec13815f8f 100644
--- a/gcc/mode-classes.def
+++ b/gcc/mode-classes.def
@@ -22,7 +22,6 @@ along with GCC; see the file COPYING3.  If not see
   DEF_MODE_CLASS (MODE_CC),            /* condition code in a register */ \
   DEF_MODE_CLASS (MODE_INT),           /* integer */                      \
   DEF_MODE_CLASS (MODE_PARTIAL_INT),   /* integer with padding bits */    \
-  DEF_MODE_CLASS (MODE_POINTER_BOUNDS), /* bounds */                       \
   DEF_MODE_CLASS (MODE_FRACT),         /* signed fractional number */     \
   DEF_MODE_CLASS (MODE_UFRACT),                /* unsigned fractional number 
*/   \
   DEF_MODE_CLASS (MODE_ACCUM),         /* signed accumulator */           \
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index cb377ca5b828..85937d070b4c 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -390,7 +390,6 @@ int_mode_for_mode (machine_mode mode)
     case MODE_VECTOR_ACCUM:
     case MODE_VECTOR_UFRACT:
     case MODE_VECTOR_UACCUM:
-    case MODE_POINTER_BOUNDS:
       return int_mode_for_size (GET_MODE_BITSIZE (mode), 0);
 
     case MODE_RANDOM:
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c 
b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
index 7d396a31953d..0cf8daeb5b17 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
@@ -19,4 +19,3 @@ male_indirect_jump (long offset)
 /* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch"  } } */
 /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
 /* { dg-final { scan-assembler-not "__x86_indirect_thunk\n" } } */
-/* { dg-final { scan-assembler-not "__x86_indirect_thunk_bnd\n" } } */
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 4a04e9e8b26d..f98cfefef94c 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -620,8 +620,6 @@ enum tree_index {
   TI_CONST_FEXCEPT_T_PTR_TYPE,
   TI_POINTER_SIZED_TYPE,
 
-  TI_POINTER_BOUNDS_TYPE,
-
   TI_DFLOAT32_TYPE,
   TI_DFLOAT64_TYPE,
   TI_DFLOAT128_TYPE,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 0d3609e2807c..99de27d9d3c4 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3923,7 +3923,6 @@ output_constant_pool_2 (fixed_size_mode mode, rtx x, 
unsigned int align)
     case MODE_UFRACT:
     case MODE_ACCUM:
     case MODE_UACCUM:
-    case MODE_POINTER_BOUNDS:
       assemble_integer (x, GET_MODE_SIZE (mode), align, 1);
       break;
 

Reply via email to