x86: simplify legacy prefix emission

Message ID 5B44B5CF02000078001D2AEE@prv1-mh.provo.novell.com
State New
Headers show
Series
  • x86: simplify legacy prefix emission
Related show

Commit Message

Jan Beulich July 10, 2018, 1:34 p.m.
The check_prefix label was bogus from the beginning: The special
checking is supposed to happen for PadLock insns only; no
3-opcode-byte insn should go this path.

gas/
2018-07-10  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (output_insn): Remove check_prefix label and
	fold remaining expression.

Comments

H.J. Lu July 10, 2018, 2 p.m. | #1
On Tue, Jul 10, 2018 at 6:34 AM, Jan Beulich <JBeulich@suse.com> wrote:
> The check_prefix label was bogus from the beginning: The special

> checking is supposed to happen for PadLock insns only; no

> 3-opcode-byte insn should go this path.

>

> gas/

> 2018-07-10  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (output_insn): Remove check_prefix label and

>         fold remaining expression.

>

> --- a/gas/config/tc-i386.c

> +++ b/gas/config/tc-i386.c

> @@ -7676,22 +7676,16 @@ output_insn (void)

>               if (i.tm.base_opcode & 0xff000000)

>                 {

>                   prefix = (i.tm.base_opcode >> 24) & 0xff;

> -                 goto check_prefix;

> +                 add_prefix (prefix);

>                 }

>               break;

>             case 2:

>               if ((i.tm.base_opcode & 0xff0000) != 0)

>                 {

>                   prefix = (i.tm.base_opcode >> 16) & 0xff;

> -                 if (i.tm.cpu_flags.bitfield.cpupadlock)

> -                   {

> -check_prefix:

> -                     if (prefix != REPE_PREFIX_OPCODE

> -                         || (i.prefix[REP_PREFIX]

> -                             != REPE_PREFIX_OPCODE))

> -                       add_prefix (prefix);

> -                   }

> -                 else

> +                 if (!i.tm.cpu_flags.bitfield.cpupadlock

> +                     || prefix != REPE_PREFIX_OPCODE

> +                     || (i.prefix[REP_PREFIX] != REPE_PREFIX_OPCODE))

>                     add_prefix (prefix);

>                 }

>               break;


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7676,22 +7676,16 @@  output_insn (void)
 	      if (i.tm.base_opcode & 0xff000000)
 		{
 		  prefix = (i.tm.base_opcode >> 24) & 0xff;
-		  goto check_prefix;
+		  add_prefix (prefix);
 		}
 	      break;
 	    case 2:
 	      if ((i.tm.base_opcode & 0xff0000) != 0)
 		{
 		  prefix = (i.tm.base_opcode >> 16) & 0xff;
-		  if (i.tm.cpu_flags.bitfield.cpupadlock)
-		    {
-check_prefix:
-		      if (prefix != REPE_PREFIX_OPCODE
-			  || (i.prefix[REP_PREFIX]
-			      != REPE_PREFIX_OPCODE))
-			add_prefix (prefix);
-		    }
-		  else
+		  if (!i.tm.cpu_flags.bitfield.cpupadlock
+		      || prefix != REPE_PREFIX_OPCODE
+		      || (i.prefix[REP_PREFIX] != REPE_PREFIX_OPCODE))
 		    add_prefix (prefix);
 		}
 	      break;