x86: fold certain AVX512 rotate and shift templates
[deliverable/binutils-gdb.git] / gas / read.c
index afa1a168a65469a112f1ffdc7941a74bddc590c9..ff78caef38c77f77bfc959df3f2220c2955ebf42 100644 (file)
@@ -1,5 +1,5 @@
 /* read.c - read a source file -
-   Copyright (C) 1986-2017 Free Software Foundation, Inc.
+   Copyright (C) 1986-2018 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -62,6 +62,7 @@
 #endif
 
 char *input_line_pointer;      /*->next char of source file to parse.  */
+bfd_boolean input_from_string = FALSE;
 
 #if BITS_PER_CHAR != 8
 /*  The following table is indexed by[(char)] and will break if
@@ -416,6 +417,7 @@ static const pseudo_typeS potable[] = {
   {"noformat", s_ignore, 0},
   {"nolist", listing_list, 0}, /* Turn listing off.  */
   {"nopage", listing_nopage, 0},
+  {"nops", s_nops, 0},
   {"octa", cons, 16},
   {"offset", s_struct, 0},
   {"org", s_org, 0},
@@ -1684,16 +1686,16 @@ read_symbol_name (void)
       if (mbstowcs (NULL, name, len) == (size_t) -1)
        as_warn (_("symbol name not recognised in the current locale"));
     }
-  else if (is_name_beginner (c) || c == '\001')
+  else if (is_name_beginner (c) || (input_from_string && c == FAKE_LABEL_CHAR))
     {
       ptrdiff_t len;
 
       name = input_line_pointer - 1;
 
-      /* We accept \001 in a name in case this is
+      /* We accept FAKE_LABEL_CHAR in a name in case this is
         being called with a constructed string.  */
       while (is_part_of_name (c = *input_line_pointer++)
-            || c == '\001')
+            || (input_from_string && c == FAKE_LABEL_CHAR))
        ;
 
       len = (input_line_pointer - name) - 1;
@@ -3507,6 +3509,58 @@ s_space (int mult)
     mri_comment_end (stop, stopc);
 }
 
+void
+s_nops (int ignore ATTRIBUTE_UNUSED)
+{
+  expressionS exp;
+  expressionS val;
+
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
+#ifdef md_cons_align
+  md_cons_align (1);
+#endif
+
+  expression (&exp);
+
+  if (*input_line_pointer == ',')
+    {
+      ++input_line_pointer;
+      expression (&val);
+    }
+  else
+    {
+      val.X_op = O_constant;
+      val.X_add_number = 0;
+    }
+
+  if (val.X_op == O_constant)
+    {
+      if (val.X_add_number < 0)
+       {
+         as_warn (_("negative nop control byte, ignored"));
+         val.X_add_number = 0;
+       }
+
+      if (!need_pass_2)
+       {
+         /* Store the no-op instruction control byte in the first byte
+            of frag.  */
+         char *p;
+         symbolS *sym = make_expr_symbol (&exp);
+         p = frag_var (rs_space_nop, 1, 1, (relax_substateT) 0,
+                       sym, (offsetT) 0, (char *) 0);
+         *p = val.X_add_number;
+       }
+    }
+  else
+    as_bad (_("unsupported variable nop control in .nops directive"));
+
+  demand_empty_rest_of_line ();
+}
+
 /* This is like s_space, but the value is a floating point number with
    the given precision.  This is for the MRI dcb.s pseudo-op and
    friends.  */
@@ -6385,6 +6439,7 @@ temp_ilp (char *buf)
 
   input_line_pointer = buf;
   buffer_limit = buf + strlen (buf);
+  input_from_string = TRUE;
 }
 
 /* Restore a saved input line pointer.  */
@@ -6396,6 +6451,7 @@ restore_ilp (void)
 
   input_line_pointer = saved_ilp;
   buffer_limit = saved_limit;
+  input_from_string = FALSE;
 
   saved_ilp = NULL;
 }
This page took 0.024748 seconds and 4 git commands to generate.