From patchwork Fri Feb 23 11:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 86263 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 54C2838582B7 for ; Fri, 23 Feb 2024 11:12:10 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 669F538582A4 for ; Fri, 23 Feb 2024 11:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 669F538582A4 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 669F538582A4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686697; cv=none; b=aViOO1k7HPsr/oJb70V1RQrgTqq+GfX6Js667CSTMqvJIAnOZFyXAkXt4U7qqcVZVp8Uz6gF1KWZz3CVAEpwYNFY7Wmv+XX5tUIVlT2h4a4u+Twd3+D46etx/kUhRzYOXLsEnsAPK1TRaadkNQkzPLWtFl7tbC4nrxBkvTezcqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686697; c=relaxed/simple; bh=PJ7MJlglvofQ2wO9rAwrZeaFWNAwRZIw39N06nr7AhE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=rIS7kG0TtCvbG0NLwGcZlSBQdR3D11PZv/q0ElZv2KOE9b5DttK8JgS/jm0XfgU1mtHw5mxfctF/wmuyjB/5NzFkbeorWTVzabXKutP01aacZrJfEkGxU0NR6HmotLrQc2aInhissVMVbsdOfezIWbqJFPl//Wds7kcC6z0jXIA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a3e7f7b3d95so80142866b.3 for ; Fri, 23 Feb 2024 03:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1708686692; x=1709291492; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=InXRxv07IJOnZ04sjat+bqrdTcpHFa/O1trlDvaZaLc=; b=TqgNSVCeTPExHiIXMLAukemzV+9CfPsQh01HZ3us1UqPHkhdBew6l+H0XROBhdVtgK WPFep2rrPGjFg6oYPMc4POEoBMntJytXx5qzaIcm1sd6FHN4HvITa6oiccM1OWtPcgH7 jk11cC8WldrnijAtlwbx696oGAhAUEcU2f49TeuVEztDqogdAqRmeNBx0lT1BauZlS2I OSQ0FV/cMc7lU26foTvElpaNghU2LHUkypc8JI8TEENm470CjkdlmjfTxjl6A6SYTfLE OdthZTagL7YHPPI9Cl59MXZWmW+keJ4+IkJWELQ3djRL3pfzr6UY2uA5u0xqqwHW1g6j mcQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708686692; x=1709291492; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=InXRxv07IJOnZ04sjat+bqrdTcpHFa/O1trlDvaZaLc=; b=KB5kErRz/oou76RVWMiZ7Btkr5cMuC2m6SPDJjI1jZTxSp2x1Cw25XrxSqv0XGiMej SeFNoC5U9STkVj9dvcJMFOWBMFRe+si00RtjH9ohtJ++9bjDjDL8k0y5spBlhhkFJUqB Y9J8iG/acgDYpg21oQ72DHFzUNEETCnISVV8USSaTDDIWJNlvdzI2uTv+uG8HSwlyBSI U8s4J2A2XHx1zUE50Nk/8/yoI1Mf3zjQQ+sVpuNMOq7hBmykeeulgxqMz/PYYvSVzxfJ u0l3tvLeQBsTfu/pMcmIiflewHIraBp4leeKeueZE9F39DgiNDxjCDUMM1mrh3SRt1CH VyYQ== X-Gm-Message-State: AOJu0YxQSmYCKsD377o86iU9TbKFS2Jszq4FACSwZeClHro1s2mEhn5l QuJQ7NmGm1kjTuHjRg2Xz/CByLhKZObHiFq2emorYILNyOuoHSiBAEhPyRXWsa80I01Tvkv3jME = X-Google-Smtp-Source: AGHT+IGVUlRHTG82QFnUeYBl6xcgKsfjwJu0POJGKyOGKoQpfrsHSsWlV60jXFbVW7ZUzVpIr0TW2w== X-Received: by 2002:a17:906:1710:b0:a3e:f4c9:b90c with SMTP id c16-20020a170906171000b00a3ef4c9b90cmr1178417eje.64.1708686691899; Fri, 23 Feb 2024 03:11:31 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ps2-20020a170906bf4200b00a3f20a8d2f6sm2836017ejb.112.2024.02.23.03.11.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Feb 2024 03:11:31 -0800 (PST) Message-ID: Date: Fri, 23 Feb 2024 12:11:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 1/4] x86/APX: respect {vex}/{vex3} Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3025.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org Even when an EVEX encoding is available, use of such a prefix ought to be respected (resulting in an error) rather than ignored. As requested during review already, introduce a new encoding enumerator to record use of eGPR-s, and update state transitions accordingly. The optimize_encoding() change also addresses an internal assembler error that was previously raised when respective memory operands used eGPR-s for addressing. While this results in a change of diagnostic issued for VEX-encoded insns, the new one is at least no worse than the prior one. --- Question is whether for the state transitions we want to introduce a couple of helper functions: check_register() has duplicates each of what RC_SAE_specifier() and check_VecOperations() also do. --- v2: Add comments in testcase. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -439,9 +439,6 @@ struct _i386_insn /* Prefer the REX2 prefix in encoding. */ bool rex2_encoding; - /* Need to use an Egpr capable encoding (REX2 or EVEX). */ - bool has_egpr; - /* Disable instruction size optimization. */ bool no_optimize; @@ -451,6 +448,7 @@ struct _i386_insn encoding_default = 0, encoding_vex, encoding_vex3, + encoding_egpr, /* REX2 or EVEX. */ encoding_evex, encoding_evex512, encoding_error @@ -1887,7 +1885,7 @@ static INLINE bool need_evex_encoding (c { return i.encoding == encoding_evex || i.encoding == encoding_evex512 - || (t->opcode_modifier.vex && i.has_egpr) + || (t->opcode_modifier.vex && i.encoding == encoding_egpr) || i.mask.reg; } @@ -2489,7 +2487,8 @@ static INLINE int fits_in_imm4 (offsetT num) { /* Despite the name, check for imm3 if we're dealing with EVEX. */ - return (num & (i.encoding != encoding_evex ? 0xf : 7)) == num; + return (num & (i.encoding != encoding_evex + && i.encoding != encoding_egpr ? 0xf : 7)) == num; } static i386_operand_type @@ -4837,6 +4836,7 @@ optimize_encoding (void) } } else if (i.encoding != encoding_evex + && i.encoding != encoding_egpr && !i.types[0].bitfield.zmmword && !i.types[1].bitfield.zmmword && !i.mask.reg @@ -6839,10 +6839,13 @@ md_assemble (char *line) if (optimize && !i.no_optimize && i.tm.opcode_modifier.optimize) optimize_encoding (); - /* Past optimization there's no need to distinguish encoding_evex and - encoding_evex512 anymore. */ + /* Past optimization there's no need to distinguish encoding_evex, + encoding_evex512, and encoding_egpr anymore. */ if (i.encoding == encoding_evex512) i.encoding = encoding_evex; + else if (i.encoding == encoding_egpr) + i.encoding = is_any_vex_encoding (&i.tm) ? encoding_evex + : encoding_default; if (use_unaligned_vector_move) encode_with_unaligned_vector_move (); @@ -8277,27 +8280,42 @@ VEX_check_encoding (const insn_template return 1; } - if (i.encoding == encoding_evex - || i.encoding == encoding_evex512) + switch (i.encoding) { + case encoding_default: + break; + + case encoding_vex: + case encoding_vex3: + /* This instruction must be encoded with VEX prefix. */ + if (!t->opcode_modifier.vex) + { + i.error = no_vex_encoding; + return 1; + } + break; + + case encoding_evex: + case encoding_evex512: /* This instruction must be encoded with EVEX prefix. */ if (!t->opcode_modifier.evex) { i.error = no_evex_encoding; return 1; } - return 0; - } + break; - if (!t->opcode_modifier.vex) - { - /* This instruction template doesn't have VEX prefix. */ - if (i.encoding != encoding_default) + case encoding_egpr: + /* This instruction must be encoded with REX2 or EVEX prefix. */ + if (t->opcode_modifier.vex && !t->opcode_modifier.evex) { - i.error = no_vex_encoding; + i.error = no_evex_encoding; return 1; } - return 0; + break; + + default: + abort (); } return 0; @@ -12896,6 +12914,19 @@ s_insn (int dummy ATTRIBUTE_UNUSED) if (i.encoding == encoding_evex512) i.encoding = encoding_evex; + if (i.encoding == encoding_egpr) + { + if (vex || xop) + { + as_bad (_("eGPR use conflicts with encoding specifier")); + goto done; + } + if (evex) + i.encoding = encoding_evex; + else + i.encoding = encoding_default; + } + /* Are we to emit ModR/M encoding? */ if (!i.short_form && (i.mem_operands @@ -13340,11 +13371,18 @@ RC_SAE_specifier (const char *pstr) return NULL; } - if (i.encoding == encoding_default) - i.encoding = encoding_evex512; - else if (i.encoding != encoding_evex - && i.encoding != encoding_evex512) - return NULL; + switch (i.encoding) + { + case encoding_default: + case encoding_egpr: + i.encoding = encoding_evex512; + break; + case encoding_evex: + case encoding_evex512: + break; + default: + return NULL; + } i.rounding.type = RC_NamesTable[j].type; @@ -13405,11 +13443,18 @@ check_VecOperations (char *op_string) } op_string++; - if (i.encoding == encoding_default) - i.encoding = encoding_evex; - else if (i.encoding != encoding_evex - && i.encoding != encoding_evex512) - goto unknown_vec_op; + switch (i.encoding) + { + case encoding_default: + case encoding_egpr: + i.encoding = encoding_evex; + break; + case encoding_evex: + case encoding_evex512: + break; + default: + goto unknown_vec_op; + } i.broadcast.type = bcst_type; i.broadcast.operand = this_operand; @@ -15676,11 +15721,19 @@ static bool check_register (const reg_en if (vector_size < VSZ512) return false; - if (i.encoding == encoding_default) - i.encoding = encoding_evex512; - else if (i.encoding != encoding_evex - && i.encoding != encoding_evex512) - i.encoding = encoding_error; + switch (i.encoding) + { + case encoding_default: + case encoding_egpr: + i.encoding = encoding_evex512; + break; + case encoding_evex: + case encoding_evex512: + break; + default: + i.encoding = encoding_error; + break; + } } if (vector_size < VSZ256 && r->reg_type.bitfield.ymmword) @@ -15706,11 +15759,19 @@ static bool check_register (const reg_en || flag_code != CODE_64BIT) return false; - if (i.encoding == encoding_default - || i.encoding == encoding_evex512) - i.encoding = encoding_evex; - else if (i.encoding != encoding_evex) - i.encoding = encoding_error; + switch (i.encoding) + { + case encoding_default: + case encoding_egpr: + case encoding_evex512: + i.encoding = encoding_evex; + break; + case encoding_evex: + break; + default: + i.encoding = encoding_error; + break; + } } if (r->reg_flags & RegRex2) @@ -15719,7 +15780,19 @@ static bool check_register (const reg_en || flag_code != CODE_64BIT) return false; - i.has_egpr = true; + switch (i.encoding) + { + case encoding_default: + i.encoding = encoding_egpr; + break; + case encoding_egpr: + case encoding_evex: + case encoding_evex512: + break; + default: + i.encoding = encoding_error; + break; + } } if (((r->reg_flags & (RegRex64 | RegRex)) || r->reg_type.bitfield.qword) --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -209,11 +209,18 @@ operatorT i386_operator (const char *nam || i386_types[j].sz[0] > 8 || (i386_types[j].sz[0] & (i386_types[j].sz[0] - 1))) return O_illegal; - if (i.encoding == encoding_default) - i.encoding = encoding_evex; - else if (i.encoding != encoding_evex - && i.encoding != encoding_evex512) - return O_illegal; + switch (i.encoding) + { + case encoding_default: + case encoding_egpr: + i.encoding = encoding_evex; + break; + case encoding_evex: + case encoding_evex512: + break; + default: + return O_illegal; + } if (!i.broadcast.bytes && !i.broadcast.type) { i.broadcast.bytes = i386_types[j].sz[0]; --- a/gas/testsuite/gas/i386/x86-64-apx-egpr-inval.l +++ b/gas/testsuite/gas/i386/x86-64-apx-egpr-inval.l @@ -101,102 +101,109 @@ .*:108: Error: extended GPR cannot be used as base/index for `gf2p8affineinvqb' .*:109: Error: extended GPR cannot be used as base/index for `gf2p8affineqb' .*:110: Error: extended GPR cannot be used as base/index for `gf2p8mulb' -.*:112: Error: extended GPR cannot be used as base/index for `vaesimc' -.*:113: Error: extended GPR cannot be used as base/index for `vaeskeygenassist' -.*:114: Error: extended GPR cannot be used as base/index for `vblendpd' -.*:115: Error: extended GPR cannot be used as base/index for `vblendpd' -.*:116: Error: extended GPR cannot be used as base/index for `vblendps' -.*:117: Error: extended GPR cannot be used as base/index for `vblendps' -.*:118: Error: extended GPR cannot be used as base/index for `vblendvpd' -.*:119: Error: extended GPR cannot be used as base/index for `vblendvpd' -.*:120: Error: extended GPR cannot be used as base/index for `vblendvps' -.*:121: Error: extended GPR cannot be used as base/index for `vblendvps' -.*:122: Error: extended GPR cannot be used as base/index for `vdppd' -.*:123: Error: extended GPR cannot be used as base/index for `vdpps' -.*:124: Error: extended GPR cannot be used as base/index for `vdpps' -.*:125: Error: extended GPR cannot be used as base/index for `vhaddpd' -.*:126: Error: extended GPR cannot be used as base/index for `vhaddpd' -.*:127: Error: extended GPR cannot be used as base/index for `vhsubps' -.*:128: Error: extended GPR cannot be used as base/index for `vhsubps' -.*:129: Error: extended GPR cannot be used as base/index for `vlddqu' -.*:130: Error: extended GPR cannot be used as base/index for `vlddqu' -.*:131: Error: extended GPR cannot be used as base/index for `vldmxcsr' -.*:132: Error: extended GPR cannot be used as base/index for `vmaskmovpd' -.*:133: Error: extended GPR cannot be used as base/index for `vmaskmovpd' -.*:134: Error: extended GPR cannot be used as base/index for `vmaskmovpd' -.*:135: Error: extended GPR cannot be used as base/index for `vmaskmovpd' -.*:136: Error: extended GPR cannot be used as base/index for `vmaskmovps' -.*:137: Error: extended GPR cannot be used as base/index for `vmaskmovps' -.*:138: Error: extended GPR cannot be used as base/index for `vmaskmovps' -.*:139: Error: extended GPR cannot be used as base/index for `vmaskmovps' -.*:140: Error: register type mismatch for `vmovmskpd' -.*:141: Error: register type mismatch for `vmovmskpd' -.*:142: Error: register type mismatch for `vmovmskps' -.*:143: Error: register type mismatch for `vmovmskps' -.*:144: Error: extended GPR cannot be used as base/index for `vpblendd' -.*:145: Error: extended GPR cannot be used as base/index for `vpblendd' -.*:146: Error: extended GPR cannot be used as base/index for `vpblendvb' -.*:147: Error: extended GPR cannot be used as base/index for `vpblendvb' -.*:148: Error: extended GPR cannot be used as base/index for `vpblendw' -.*:149: Error: extended GPR cannot be used as base/index for `vpblendw' -.*:150: Error: extended GPR cannot be used as base/index for `vpcmpeqb' -.*:151: Error: extended GPR cannot be used as base/index for `vpcmpeqd' -.*:152: Error: extended GPR cannot be used as base/index for `vpcmpeqq' -.*:153: Error: extended GPR cannot be used as base/index for `vpcmpeqw' -.*:154: Error: extended GPR cannot be used as base/index for `vpcmpestri' -.*:155: Error: extended GPR cannot be used as base/index for `vpcmpestrm' -.*:156: Error: extended GPR cannot be used as base/index for `vpcmpgtb' -.*:157: Error: extended GPR cannot be used as base/index for `vpcmpgtd' -.*:158: Error: extended GPR cannot be used as base/index for `vpcmpgtq' -.*:159: Error: extended GPR cannot be used as base/index for `vpcmpgtw' -.*:160: Error: extended GPR cannot be used as base/index for `vpcmpistri' -.*:161: Error: extended GPR cannot be used as base/index for `vpcmpistrm' -.*:162: Error: extended GPR cannot be used as base/index for `vperm2f128' -.*:163: Error: extended GPR cannot be used as base/index for `vperm2i128' -.*:164: Error: extended GPR cannot be used as base/index for `vphaddd' -.*:165: Error: extended GPR cannot be used as base/index for `vphaddd' -.*:166: Error: extended GPR cannot be used as base/index for `vphaddsw' -.*:167: Error: extended GPR cannot be used as base/index for `vphaddsw' -.*:168: Error: extended GPR cannot be used as base/index for `vphaddw' -.*:169: Error: extended GPR cannot be used as base/index for `vphaddw' -.*:170: Error: extended GPR cannot be used as base/index for `vphminposuw' -.*:171: Error: extended GPR cannot be used as base/index for `vphsubd' -.*:172: Error: extended GPR cannot be used as base/index for `vphsubd' -.*:173: Error: extended GPR cannot be used as base/index for `vphsubsw' -.*:174: Error: extended GPR cannot be used as base/index for `vphsubsw' -.*:175: Error: extended GPR cannot be used as base/index for `vphsubw' -.*:176: Error: extended GPR cannot be used as base/index for `vphsubw' -.*:177: Error: extended GPR cannot be used as base/index for `vpmaskmovd' -.*:178: Error: extended GPR cannot be used as base/index for `vpmaskmovd' -.*:179: Error: extended GPR cannot be used as base/index for `vpmaskmovd' -.*:180: Error: extended GPR cannot be used as base/index for `vpmaskmovd' -.*:181: Error: extended GPR cannot be used as base/index for `vpmaskmovq' -.*:182: Error: extended GPR cannot be used as base/index for `vpmaskmovq' -.*:183: Error: extended GPR cannot be used as base/index for `vpmaskmovq' -.*:184: Error: extended GPR cannot be used as base/index for `vpmaskmovq' -.*:185: Error: register type mismatch for `vpmovmskb' -.*:186: Error: register type mismatch for `vpmovmskb' -.*:187: Error: extended GPR cannot be used as base/index for `vpsignb' -.*:188: Error: extended GPR cannot be used as base/index for `vpsignb' -.*:189: Error: extended GPR cannot be used as base/index for `vpsignd' -.*:190: Error: extended GPR cannot be used as base/index for `vpsignd' -.*:191: Error: extended GPR cannot be used as base/index for `vpsignw' -.*:192: Error: extended GPR cannot be used as base/index for `vpsignw' -.*:193: Error: extended GPR cannot be used as base/index for `vptest' -.*:194: Error: extended GPR cannot be used as base/index for `vptest' -.*:195: Error: extended GPR cannot be used as base/index for `vrcpps' -.*:196: Error: extended GPR cannot be used as base/index for `vrcpps' -.*:197: Error: extended GPR cannot be used as base/index for `vrcpss' +.*:112: Error: no EVEX encoding for `vaesimc' +.*:113: Error: no EVEX encoding for `vaeskeygenassist' +.*:114: Error: no EVEX encoding for `vblendpd' +.*:115: Error: no EVEX encoding for `vblendpd' +.*:116: Error: no EVEX encoding for `vblendps' +.*:117: Error: no EVEX encoding for `vblendps' +.*:118: Error: no EVEX encoding for `vblendvpd' +.*:119: Error: no EVEX encoding for `vblendvpd' +.*:120: Error: no EVEX encoding for `vblendvps' +.*:121: Error: no EVEX encoding for `vblendvps' +.*:122: Error: no EVEX encoding for `vdppd' +.*:123: Error: no EVEX encoding for `vdpps' +.*:124: Error: no EVEX encoding for `vdpps' +.*:125: Error: no EVEX encoding for `vhaddpd' +.*:126: Error: no EVEX encoding for `vhaddpd' +.*:127: Error: no EVEX encoding for `vhsubps' +.*:128: Error: no EVEX encoding for `vhsubps' +.*:129: Error: no EVEX encoding for `vlddqu' +.*:130: Error: no EVEX encoding for `vlddqu' +.*:131: Error: no EVEX encoding for `vldmxcsr' +.*:132: Error: no EVEX encoding for `vmaskmovpd' +.*:133: Error: no EVEX encoding for `vmaskmovpd' +.*:134: Error: no EVEX encoding for `vmaskmovpd' +.*:135: Error: no EVEX encoding for `vmaskmovpd' +.*:136: Error: no EVEX encoding for `vmaskmovps' +.*:137: Error: no EVEX encoding for `vmaskmovps' +.*:138: Error: no EVEX encoding for `vmaskmovps' +.*:139: Error: no EVEX encoding for `vmaskmovps' +.*:140: Error: no EVEX encoding for `vmovmskpd' +.*:141: Error: no EVEX encoding for `vmovmskpd' +.*:142: Error: no EVEX encoding for `vmovmskps' +.*:143: Error: no EVEX encoding for `vmovmskps' +.*:144: Error: no EVEX encoding for `vpblendd' +.*:145: Error: no EVEX encoding for `vpblendd' +.*:146: Error: no EVEX encoding for `vpblendvb' +.*:147: Error: no EVEX encoding for `vpblendvb' +.*:148: Error: no EVEX encoding for `vpblendw' +.*:149: Error: no EVEX encoding for `vpblendw' +.*:150: Error: no EVEX encoding for `vpcmpeqb' +.*:151: Error: no EVEX encoding for `vpcmpeqd' +.*:152: Error: no EVEX encoding for `vpcmpeqq' +.*:153: Error: no EVEX encoding for `vpcmpeqw' +.*:154: Error: no EVEX encoding for `vpcmpestri' +.*:155: Error: no EVEX encoding for `vpcmpestrm' +.*:156: Error: no EVEX encoding for `vpcmpgtb' +.*:157: Error: no EVEX encoding for `vpcmpgtd' +.*:158: Error: no EVEX encoding for `vpcmpgtq' +.*:159: Error: no EVEX encoding for `vpcmpgtw' +.*:160: Error: no EVEX encoding for `vpcmpistri' +.*:161: Error: no EVEX encoding for `vpcmpistrm' +.*:162: Error: no EVEX encoding for `vperm2f128' +.*:163: Error: no EVEX encoding for `vperm2i128' +.*:164: Error: no EVEX encoding for `vphaddd' +.*:165: Error: no EVEX encoding for `vphaddd' +.*:166: Error: no EVEX encoding for `vphaddsw' +.*:167: Error: no EVEX encoding for `vphaddsw' +.*:168: Error: no EVEX encoding for `vphaddw' +.*:169: Error: no EVEX encoding for `vphaddw' +.*:170: Error: no EVEX encoding for `vphminposuw' +.*:171: Error: no EVEX encoding for `vphsubd' +.*:172: Error: no EVEX encoding for `vphsubd' +.*:173: Error: no EVEX encoding for `vphsubsw' +.*:174: Error: no EVEX encoding for `vphsubsw' +.*:175: Error: no EVEX encoding for `vphsubw' +.*:176: Error: no EVEX encoding for `vphsubw' +.*:177: Error: no EVEX encoding for `vpmaskmovd' +.*:178: Error: no EVEX encoding for `vpmaskmovd' +.*:179: Error: no EVEX encoding for `vpmaskmovd' +.*:180: Error: no EVEX encoding for `vpmaskmovd' +.*:181: Error: no EVEX encoding for `vpmaskmovq' +.*:182: Error: no EVEX encoding for `vpmaskmovq' +.*:183: Error: no EVEX encoding for `vpmaskmovq' +.*:184: Error: no EVEX encoding for `vpmaskmovq' +.*:185: Error: no EVEX encoding for `vpmovmskb' +.*:186: Error: no EVEX encoding for `vpmovmskb' +.*:187: Error: no EVEX encoding for `vpsignb' +.*:188: Error: no EVEX encoding for `vpsignb' +.*:189: Error: no EVEX encoding for `vpsignd' +.*:190: Error: no EVEX encoding for `vpsignd' +.*:191: Error: no EVEX encoding for `vpsignw' +.*:192: Error: no EVEX encoding for `vpsignw' +.*:193: Error: no EVEX encoding for `vptest' +.*:194: Error: no EVEX encoding for `vptest' +.*:195: Error: no EVEX encoding for `vrcpps' +.*:196: Error: no EVEX encoding for `vrcpps' +.*:197: Error: no EVEX encoding for `vrcpss' .*:198: Error: .* 4 bits for `vroundpd' .*:199: Error: .* 4 bits for `vroundps' .*:200: Error: .* 4 bits for `vroundsd' .*:201: Error: .* 4 bits for `vroundss' -.*:202: Error: extended GPR cannot be used as base/index for `vrsqrtps' -.*:203: Error: extended GPR cannot be used as base/index for `vrsqrtps' -.*:204: Error: extended GPR cannot be used as base/index for `vrsqrtss' -.*:205: Error: extended GPR cannot be used as base/index for `vstmxcsr' -.*:206: Error: extended GPR cannot be used as base/index for `vtestpd' -.*:207: Error: extended GPR cannot be used as base/index for `vtestpd' -.*:208: Error: extended GPR cannot be used as base/index for `vtestps' -.*:209: Error: extended GPR cannot be used as base/index for `vtestps' +.*:202: Error: no EVEX encoding for `vrsqrtps' +.*:203: Error: no EVEX encoding for `vrsqrtps' +.*:204: Error: no EVEX encoding for `vrsqrtss' +.*:205: Error: no EVEX encoding for `vstmxcsr' +.*:206: Error: no EVEX encoding for `vtestpd' +.*:207: Error: no EVEX encoding for `vtestpd' +.*:208: Error: no EVEX encoding for `vtestps' +.*:209: Error: no EVEX encoding for `vtestps' +.*:211: Error: no VEX/XOP encoding for `and' +.*:212: Error: no VEX/XOP encoding for `and' +.*:213: Error: .* `and' +.*:214: Error: no VEX/XOP encoding for `and' +.*:215: Error: no VEX/XOP encoding for `and' +.*:216: Error: .* `and' +.*:219: Error: .* `andn' #pass --- a/gas/testsuite/gas/i386/x86-64-apx-egpr-inval.s +++ b/gas/testsuite/gas/i386/x86-64-apx-egpr-inval.s @@ -207,3 +207,13 @@ vtestpd (%r27),%ymm6 vtestps (%r27),%xmm6 vtestps (%r27),%ymm6 +# {vex} + {vex} and %eax, %eax + {vex} and %r8, %r8 + {vex} and %r16, %r16 + {vex} and %eax, %eax, %eax + {vex} and %r8, %r8, %r8 + {vex} and %r16, %r16, %r16 + {vex} andn %eax, %eax, %eax # This one's valid. + {vex} andn %r8, %r8, %r8 # And this. + {vex} andn %r16, %r16, %r16 From patchwork Fri Feb 23 11:12:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 86264 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 782A83858018 for ; Fri, 23 Feb 2024 11:12:41 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 248873858425 for ; Fri, 23 Feb 2024 11:12:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 248873858425 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 248873858425 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686727; cv=none; b=q0kfJeriAHEUjHtLQfihn2GSaNidICcJxW1rWOi+/6v6MGhZg6qEr6AewldVM3drB7uzuqP1Y3WVS9qKxExF/axLPPz9onRH00jiVfwvRTzuoVDg527By6PMZWxvvzJyOLHC+0ELNpuHzv7k6dom2gJIEpG9M355AHBQ5EkFoS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686727; c=relaxed/simple; bh=RfLM3bVBl1uMnEMWOuSSPVDYq/W6Yg32/VG1EZlCZOo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=vUbiGCQpimA/JwA72SOwISOnHUmjhPDQxsbKHhyD0tZ7BaT+t8921f7mhacLWVQw9DMJ8PCSGcpxM7SxpoPeOmHNqfc5fkQEhlhMgwa6HcAkV49PHN0fdAUC2VpD2TrX1g3KKdZXD6TPsjWI+QGK7Fk47MqzCtTLZmoXE/Zx+Cw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a3e891b5e4eso79802566b.0 for ; Fri, 23 Feb 2024 03:12:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1708686724; x=1709291524; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=zSXmVsbMIwtV+zq4PXTv1Zs8QXSeMcMGVj/s3Dv9Gfc=; b=QtqYVK/SJWAICX4kbZWLmQMPl7/uoIqcXNavI66usr8JZP6DD4mlgLlKFdZGzZGuEg d1c1othbT7+OD2X/dAocmPeZpPrqqTL29jNac/Df/NbNTD3REQVa1+FXxULmVn4YTD0J YP82YLavpdPzw5JdowijgzOM4b6dRx6Tk3nZRhgpGKxCtpUd2oxT2YEok4HVXvxiKlbk mTINAshMJdAnQ4Djohxp4EMnf4sVrmlsZ+M0ZumL1nh90EA+neBdobRC00GdraysOBx/ P8PyC7wcP3K7FUQqdhpnGoA2RbKaFJANo7XG7CoXYij3WYwpbUi9cPlrHNGAGN4ZdT0g elIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708686724; x=1709291524; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zSXmVsbMIwtV+zq4PXTv1Zs8QXSeMcMGVj/s3Dv9Gfc=; b=oDh+LvgwNYgUAR4d38OOrS3Crd/nozjcveSL6G41uzBfy94kyzMw+VxpOYSihYMXlG pkME6Bha0Py/SE8tq2ep/zHItlp2dWtjOTfDiHRGYXrt+8ZwqXOEpz8vN73LIwL0CdFw aTCy7+VTfciSgYKU9XaIjrFjxJXUCPfBZzY2IJfxxe3Dge3QrsEPppuInTaz40yMd+xl NGoIa8FPInu8zmhQXpyFqtMdJatpmRu79heoQickgaCHJLHV/W75ZIVpFhDPpkingGJ8 Px+kTAsfiWncAaJf08OShB1haMU/L0mKjE2nqIo99B3THBfB0yaYmUqEbNP9MGl3a3la pWIg== X-Gm-Message-State: AOJu0YyZKMqCrCtRZ+Erx13f1aVXzcv9o87wEdqBTGV6iNweTKNo0/0O EB5l1KcD7GHUJvpj9YUXtLSEFHyYYoZF9Cb/+epWeQmxJzYlbdN/5fnmeqpocEx24Yo9q8JhfSY = X-Google-Smtp-Source: AGHT+IGXrgXOc6mcy4oLYvE/UHvN1tl0Vpj4k66rBMzVltVLNj+jZok8rApZuN0+sbnIFfe0HSsaFQ== X-Received: by 2002:a17:906:f847:b0:a3e:bc98:7243 with SMTP id ks7-20020a170906f84700b00a3ebc987243mr1077363ejb.71.1708686723820; Fri, 23 Feb 2024 03:12:03 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ps2-20020a170906bf4200b00a3f20a8d2f6sm2836017ejb.112.2024.02.23.03.12.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Feb 2024 03:12:03 -0800 (PST) Message-ID: Date: Fri, 23 Feb 2024 12:12:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 2/4] x86/APX: correct .insn opcode space determination when REX2 is needed Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3025.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org In this case spaces 0f38 and 0f3a may not be put in place. To achieve the intended effect, operand parsing (but not operand processing) needs pulling ahead, so we know whether eGRP-s are in use. --- v2: Add --divide for new testcase. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -12849,13 +12849,43 @@ s_insn (int dummy ATTRIBUTE_UNUSED) } } + /* Parse operands, if any, before evaluating encoding space. */ + if (*line == ',') + { + i.memshift = -1; + + ptr = parse_operands (line + 1, &i386_mnemonics[MN__insn]); + this_operand = -1; + if (!ptr) + goto bad; + line = ptr; + + if (!i.operands) + { + as_bad (_("expecting operand after ','; got nothing")); + goto done; + } + + if (i.mem_operands > 1) + { + as_bad (_("too many memory references for `%s'"), + &i386_mnemonics[MN__insn]); + goto done; + } + + /* No need to distinguish encoding_evex and encoding_evex512. */ + if (i.encoding == encoding_evex512) + i.encoding = encoding_evex; + } + /* Trim off encoding space. */ if (j > 1 && !i.insn_opcode_space && (val >> ((j - 1) * 8)) == 0x0f) { uint8_t byte = val >> ((--j - 1) * 8); i.insn_opcode_space = SPACE_0F; - switch (byte & -(j > 1)) + switch (byte & -(j > 1 && !i.rex2_encoding + && (i.encoding != encoding_egpr || evex))) { case 0x38: i.insn_opcode_space = SPACE_0F38; @@ -12878,42 +12908,17 @@ s_insn (int dummy ATTRIBUTE_UNUSED) if (j > 2) { as_bad (_("opcode residual (%#"PRIx64") too wide"), (uint64_t) val); - goto bad; + goto done; } i.opcode_length = j; /* Handle operands, if any. */ - if (*line == ',') + if (i.operands) { i386_operand_type combined; expressionS *disp_exp = NULL; bool changed; - i.memshift = -1; - - ptr = parse_operands (line + 1, &i386_mnemonics[MN__insn]); - this_operand = -1; - if (!ptr) - goto bad; - line = ptr; - - if (!i.operands) - { - as_bad (_("expecting operand after ','; got nothing")); - goto done; - } - - if (i.mem_operands > 1) - { - as_bad (_("too many memory references for `%s'"), - &i386_mnemonics[MN__insn]); - goto done; - } - - /* No need to distinguish encoding_evex and encoding_evex512. */ - if (i.encoding == encoding_evex512) - i.encoding = encoding_evex; - if (i.encoding == encoding_egpr) { if (vex || xop) --- /dev/null +++ b/gas/testsuite/gas/i386/insn-rex2.l @@ -0,0 +1,38 @@ +[ ]*[0-9]+[ ]+\.text +[ ]*[0-9]+[ ]+insn_rex2: +[ ]*[0-9]+ .... D58001C0[ ]+\.insn \{rex2\} 0x0f01/0, %eax +[ ]*[0-9]+ .... D58038C0[ ]+\.insn \{rex2\} 0x0f38/0, %eax +[ ]*[0-9]+ .... D5803801[ ]+\.insn \{rex2\} 0x0f3801/0, %eax +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5803901[ ]+\.insn \{rex2\} 0x0f3901/0, %eax +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5803A01[ ]+\.insn \{rex2\} 0x0f3a01/0, \$0xCC, %eax +[ ]*[0-9]+ +C0CC +[ ]*[0-9]+[ ]+ +[ ]*[0-9]+ .... D58801C0[ ]+\.insn \{rex2\} 0x0f01/0, %rax +[ ]*[0-9]+ .... D58838C0[ ]+\.insn \{rex2\} 0x0f38/0, %rax +[ ]*[0-9]+ .... D5883801[ ]+\.insn \{rex2\} 0x0f3801/0, %rax +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5883901[ ]+\.insn \{rex2\} 0x0f3901/0, %rax +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5883A01[ ]+\.insn \{rex2\} 0x0f3a01/0, \$0xCC, %rax +[ ]*[0-9]+ +C0CC +[ ]*[0-9]+[ ]+ +[ ]*[0-9]+ .... D58901C0[ ]+\.insn \{rex2\} 0x0f01/0, %r8 +[ ]*[0-9]+ .... D58938C0[ ]+\.insn \{rex2\} 0x0f38/0, %r8 +[ ]*[0-9]+ .... D5893801[ ]+\.insn \{rex2\} 0x0f3801/0, %r8 +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5893901[ ]+\.insn \{rex2\} 0x0f3901/0, %r8 +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5893A01[ ]+\.insn \{rex2\} 0x0f3a01/0, \$0xCC, %r8 +[ ]*[0-9]+ +C0CC +[ ]*[0-9]+[ ]+ +[ ]*[0-9]+ .... D59801C0[ ]+\.insn 0x0f01/0, %r16 +[ ]*[0-9]+ .... D59838C0[ ]+\.insn 0x0f38/0, %r16 +[ ]*[0-9]+ .... D5983801[ ]+\.insn 0x0f3801/0, %r16 +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5983901[ ]+\.insn 0x0f3901/0, %r16 +[ ]*[0-9]+ +C0 +[ ]*[0-9]+ .... D5983A01[ ]+\.insn 0x0f3a01/0, \$0xCC, %r16 +[ ]*[0-9]+[ ]+C0CC +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/insn-rex2.s @@ -0,0 +1,25 @@ + .text +insn_rex2: + .insn {rex2} 0x0f01/0, %eax + .insn {rex2} 0x0f38/0, %eax + .insn {rex2} 0x0f3801/0, %eax + .insn {rex2} 0x0f3901/0, %eax + .insn {rex2} 0x0f3a01/0, $0xCC, %eax + + .insn {rex2} 0x0f01/0, %rax + .insn {rex2} 0x0f38/0, %rax + .insn {rex2} 0x0f3801/0, %rax + .insn {rex2} 0x0f3901/0, %rax + .insn {rex2} 0x0f3a01/0, $0xCC, %rax + + .insn {rex2} 0x0f01/0, %r8 + .insn {rex2} 0x0f38/0, %r8 + .insn {rex2} 0x0f3801/0, %r8 + .insn {rex2} 0x0f3901/0, %r8 + .insn {rex2} 0x0f3a01/0, $0xCC, %r8 + + .insn 0x0f01/0, %r16 + .insn 0x0f38/0, %r16 + .insn 0x0f3801/0, %r16 + .insn 0x0f3901/0, %r16 + .insn 0x0f3a01/0, $0xCC, %r16 --- a/gas/testsuite/gas/i386/x86-64.exp +++ b/gas/testsuite/gas/i386/x86-64.exp @@ -126,6 +126,7 @@ run_dump_test "x86-64-sysenter-mixed" run_dump_test "x86-64-sysenter-amd" run_list_test "x86-64-sysenter-amd" "-mamd64" run_dump_test "insn-64" +run_list_test "insn-rex2" "-aln --divide" run_dump_test "noreg64" run_list_test "noreg64" run_dump_test "noreg64-data16" From patchwork Fri Feb 23 11:12:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 86265 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3C159385800E for ; Fri, 23 Feb 2024 11:13:00 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id ECA3B38582BB for ; Fri, 23 Feb 2024 11:12:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECA3B38582BB Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ECA3B38582BB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686749; cv=none; b=K95wFkSF+e4Bo+IGm0xzzgRPH7YGJCqNR3yRJKbjibTPQJSwBIs0WRnPsGtYyl1wYLFqHYaQ6rI2HXLvM1YLvOjp4v7PWXxvfw9uHJXvQB3C6HyCJwMG3alMUT1KUNl7qAOJ+1P3Ya2CvcPQ3wJZcJo0rhLlX5yhabhpTLEHyp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686749; c=relaxed/simple; bh=zCXIW4qUZZyDeE5OYLMpSfm9d2vaIaqZ4At3iRxp9B4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=pBjZ7aQiO8c0C2kgm70YU5MUFvNAnLuPyzhsyNjn4m+KdB9KJ+LWfx3t3ljjamvnwycI2p1NlmHM8rsQHjI6K74WXH+9mCnU9VCwg0D8kmMn91Slvyk8e+eLhv4S7OSbxC5ofjw/aa06pVd96ShXJFW7qGK63y5/hWmAWhxDtoc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a3e72ec566aso92229566b.2 for ; Fri, 23 Feb 2024 03:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1708686745; x=1709291545; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=j9vs3953WFVTvIDfMEcyn5LG6r3NG10TsLUww0lIlQc=; b=ZsnRqP2Er+Hi+aT+j/D4zLZV0Zp0PUMuqTgOzjSA7Gpub0Vzc5CdSKTnnsaWMid4r1 KcFCi6D+NoHBEmuBGKumoTUBkupm5sDdYsW4nP6eMdnRHkNiaO9713nZDjmTD06bkz46 3rhfi8o0zbOyEIv9Nq6rDluVm3OHN81li3YCo+UAvH3zrAfEFPED/TSQeB2UdClLnJt6 XX5AqtcG+wpNBFV2kxT2nib/PtLRxXO+pp+bip/zUPBDtrie/P8HMwIWRT56G+Q0vrS0 SZOEWhz07XpVDnTaOA8Bwn976D6BedA55Tzn4l/u5XQGbyKgIxTRV8EeP2P7WpgchHfV vqUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708686745; x=1709291545; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j9vs3953WFVTvIDfMEcyn5LG6r3NG10TsLUww0lIlQc=; b=Mk0nknMfg2/j8g9nABTcIOIf6pGqQf0UHkO6qadtUlBxON1ILX8/gi6l87ikVUbJyu 4juP9dWDLQztjYkxU3z9pA5j0qnZeT5J542HWKuiSnt2JkSNOAsvSGLmrBSrgMJZCXjf drJKo+CIIBprg1n17WywG+e32mjq4bixoC8U6x5ldpsC2WRMIXEH9htzyBzv+DlS7+S1 9mFJWmzEtGSc1ypnyo+Ax0IHkeFBdXdNa8Enh1iBmYQcmlRRACehj3KsKdJb/x9kqYMb mg3H2DHAeRMmpXfp0Fr9fFkSN9HWE/jx8u8pQkhf3wuunL3sKm63pEJy89uCge9YVgKi /DVA== X-Gm-Message-State: AOJu0YxJqIg1v4/m8/VQob9IDdhRAnzaAY4p3jJw56AlosiMCndiGCp8 ZZa2bDakMxNNHQlZVMei3t+ZDSMDjaM8tblSL0BKmTeqjaXphkguLXHiA8YSnyyI2KptqGp0Hjc = X-Google-Smtp-Source: AGHT+IE2dR2Y30nw83E4VeaeFctuDsBe35oBDYMaUfBvApyDIphIV+/uR+IDTErWi5PQmGXhYQLWFg== X-Received: by 2002:a17:906:e2cc:b0:a3d:7532:15ad with SMTP id gr12-20020a170906e2cc00b00a3d753215admr414543ejb.39.1708686745776; Fri, 23 Feb 2024 03:12:25 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ps2-20020a170906bf4200b00a3f20a8d2f6sm2836017ejb.112.2024.02.23.03.12.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Feb 2024 03:12:25 -0800 (PST) Message-ID: Date: Fri, 23 Feb 2024 12:12:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 3/4] x86/APX: optimize certain XOR and SUB forms Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3023.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, PERCENT_RANDOM, RCVD_IN_DNSWL_NONE, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org While most logic in optimize_encoding() is already covering APX by way of the earlier NDD->REX2 conversion, there's a remaining set of cases which wants handling separately. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4693,6 +4693,34 @@ optimize_encoding (void) } } } + else if (i.reg_operands == 3 + && i.op[0].regs == i.op[1].regs + && i.encoding != encoding_evex + && (i.tm.mnem_off == MN_xor + || i.tm.mnem_off == MN_sub)) + { + /* Optimize: -O: + xorb %rNb, %rNb, %rMb -> xorl %rMd, %rMd + xorw %rNw, %rNw, %rMw -> xorl %rMd, %rMd + xorl %rNd, %rNd, %rMd -> xorl %rMd, %rMd + xorq %rN, %rN, %rM -> xorl %rMd, %rMd + subb %rNb, %rNb, %rMb -> subl %rMd, %rMd + subw %rNw, %rNw, %rMw -> subl %rMd, %rMd + subl %rNd, %rNd, %rMd -> subl %rMd, %rMd + subq %rN, %rN, %rM -> subl %rMd, %rMd + */ + i.tm.opcode_space = SPACE_BASE; + i.tm.opcode_modifier.evex = 0; + i.tm.opcode_modifier.size = SIZE32; + i.types[0].bitfield.byte = 0; + i.types[0].bitfield.word = 0; + i.types[0].bitfield.dword = 1; + i.types[0].bitfield.qword = 0; + i.op[0].regs = i.op[2].regs; + i.types[1] = i.types[0]; + i.op[1].regs = i.op[2].regs; + i.reg_operands = 2; + } else if (optimize > 1 && !optimize_for_space && i.reg_operands == 2 --- a/gas/testsuite/gas/i386/x86-64-optimize-1.d +++ b/gas/testsuite/gas/i386/x86-64-optimize-1.d @@ -71,4 +71,28 @@ Disassembly of section .text: +[a-f0-9]+: 48 0f ba f0 1f btr \$0x1f,%rax +[a-f0-9]+: 66 0f ba e8 0f bts \$0xf,%ax +[a-f0-9]+: 48 0f ba e8 1f bts \$0x1f,%rax + +[a-f0-9]+: 31 c9 xor %ecx,%ecx + +[a-f0-9]+: 48 31 d1 xor %rdx,%rcx + +[a-f0-9]+: 31 c9 xor %ecx,%ecx + +[a-f0-9]+: 29 c9 sub %ecx,%ecx + +[a-f0-9]+: 48 29 d1 sub %rdx,%rcx + +[a-f0-9]+: 29 c9 sub %ecx,%ecx + +[a-f0-9]+: d5 50 31 c9 xor %r17d,%r17d + +[a-f0-9]+: d5 58 31 d1 xor %r18,%r17 + +[a-f0-9]+: d5 50 31 c9 xor %r17d,%r17d + +[a-f0-9]+: d5 50 29 c9 sub %r17d,%r17d + +[a-f0-9]+: d5 58 29 d1 sub %r18,%r17 + +[a-f0-9]+: d5 50 29 c9 sub %r17d,%r17d + +[a-f0-9]+: 31 c9 xor %ecx,%ecx + +[a-f0-9]+: 62 f4 75 18 31 d1 xor %dx,%cx,%cx + +[a-f0-9]+: 31 c9 xor %ecx,%ecx + +[a-f0-9]+: 29 c9 sub %ecx,%ecx + +[a-f0-9]+: 62 f4 75 18 29 d1 sub %dx,%cx,%cx + +[a-f0-9]+: 29 c9 sub %ecx,%ecx + +[a-f0-9]+: d5 50 31 c9 xor %r17d,%r17d + +[a-f0-9]+: 62 ec 74 10 30 d1 xor %r18b,%r17b,%r17b + +[a-f0-9]+: d5 50 31 c9 xor %r17d,%r17d + +[a-f0-9]+: d5 50 29 c9 sub %r17d,%r17d + +[a-f0-9]+: 62 ec 74 10 28 d1 sub %r18b,%r17b,%r17b + +[a-f0-9]+: d5 50 29 c9 sub %r17d,%r17d #pass --- a/gas/testsuite/gas/i386/x86-64-optimize-1.s +++ b/gas/testsuite/gas/i386/x86-64-optimize-1.s @@ -65,3 +65,27 @@ _start: btr $31, %rax bts $15, %ax bts $31, %rax + xor %rcx, %rcx, %rcx + xor %rdx, %rcx, %rcx + xor %rdx, %rdx, %rcx + sub %rcx, %rcx, %rcx + sub %rdx, %rcx, %rcx + sub %rdx, %rdx, %rcx + xor %r17, %r17, %r17 + xor %r18, %r17, %r17 + xor %r18, %r18, %r17 + sub %r17, %r17, %r17 + sub %r18, %r17, %r17 + sub %r18, %r18, %r17 + xor %cx, %cx, %cx + xor %dx, %cx, %cx + xor %dx, %dx, %cx + sub %cx, %cx, %cx + sub %dx, %cx, %cx + sub %dx, %dx, %cx + xor %r17b, %r17b, %r17b + xor %r18b, %r17b, %r17b + xor %r18b, %r18b, %r17b + sub %r17b, %r17b, %r17b + sub %r18b, %r17b, %r17b + sub %r18b, %r18b, %r17b --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -320,7 +320,7 @@ inc, 0x40, No64, No_bSuf|No_sSuf|No_qSuf inc, 0xfe/0, APX_F, W|Modrm|No_sSuf|CheckOperandSize|DstVVVV|EVexMap4|NF, {Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64} inc, 0xfe/0, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } -sub, 0x28, APX_F, D|W|CheckOperandSize|Modrm|No_sSuf|DstVVVV|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64, } +sub, 0x28, APX_F, D|W|CheckOperandSize|Modrm|No_sSuf|DstVVVV|EVexMap4|NF|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64, } sub, 0x28, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } sub, 0x83/5, APX_F, Modrm|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } sub, 0x83/5, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex } @@ -366,7 +366,7 @@ or, 0xc, 0, W|No_sSuf, { Imm8|Imm16|Imm3 or, 0x80/1, APX_F, W|Modrm|CheckOperandSize|No_sSuf|DstVVVV|EVexMap4|NF, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } or, 0x80/1, 0, W|Modrm|No_sSuf|HLEPrefixLock, { Imm8|Imm16|Imm32|Imm32S, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } -xor, 0x30, APX_F, D|C|W|CheckOperandSize|Modrm|No_sSuf|DstVVVV|EVexMap4|NF, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } +xor, 0x30, APX_F, D|C|W|CheckOperandSize|Modrm|No_sSuf|DstVVVV|EVexMap4|NF|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg8|Reg16|Reg32|Reg64 } xor, 0x30, 0, D|W|CheckOperandSize|Modrm|No_sSuf|HLEPrefixLock|Optimize, { Reg8|Reg16|Reg32|Reg64, Reg8|Reg16|Reg32|Reg64|Unspecified|BaseIndex } xor, 0x83/6, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } xor, 0x83/6, 0, Modrm|No_bSuf|No_sSuf|HLEPrefixLock, { Imm8S, Reg16|Reg32|Reg64|Unspecified|BaseIndex } From patchwork Fri Feb 23 11:13:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 86266 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FFE0385843B for ; Fri, 23 Feb 2024 11:13:45 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id C36E33858D1E for ; Fri, 23 Feb 2024 11:13:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C36E33858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C36E33858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::633 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686788; cv=none; b=ZfPrhyoY5gVdeeXw0hdg3xJoXYkP8g9mgzdK6VUZaOr2J1rRKjMGOZDBapDxjp0IvDnL+TOt/S21+Ee7CgxBxV82uf8k+ZQq4SJZkWtzVoV0MOF5fBsKuIydT/XPZsetkZuterkOIp7w7gkOuJavRfnXvvoWDN7n2XpmLWjIxiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708686788; c=relaxed/simple; bh=dix9tYoTbZR+A6pgNOlaMsL4YR3aPzw10bMajZnCYJc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=eamy9294jUW6vqOYNKyeddk1xuZsj296uHZg/f3jZIxKGocjNqdahu9rZC1bS+xo0Z17ZU3Jh4V2o83OrkR1YLWM8oOGFbykR7XJ0b+q4hImHzucNOWZyf4KzaE4b5e1rl8BV+3QtF7RINf3V8NgYUZNIbce5T6r06O8QSBmvxE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a3d484a58f6so98194466b.3 for ; Fri, 23 Feb 2024 03:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1708686784; x=1709291584; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=qX+BT9w3joadY8x4XNK3KWHvhVfZalntYq3vHtMhABI=; b=cI3eB9dQ82a4Mg/xKgedbxLZqbgvZg8LA/kww3vvavS8n7MY2TijpTZoh9dPrg5kSa AXENXPLfSIkp8OZDlsrMx8sk+dMipNvAQVdMdvLEsZXqrDLFnEckJSv1Vcf0gEHM9Y9M ezyRVjLLZ1K85QyqrjySTQOkdqKkYkI/0R0Q04lWOmgw+4pdAkvQcAhrRwMFKwFVmdgn t+nxkmm4MFCxKMECF/VYM+ATJPACt54zZ7zUoLkzT+5IsqWshhpwb+U9pxq3moV6om6m //Tc0DRIGlj+MCb7opG/8jc8/vyhuYclJUz3Ql951yynAafufCQi2fDWngN1gbvge35J /VWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708686784; x=1709291584; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qX+BT9w3joadY8x4XNK3KWHvhVfZalntYq3vHtMhABI=; b=HHCZ+G7RPsp2oDm99FOBxeVfithH9cZAkhqoZ0edV989TRRxr/xdoiXYLdTSnl1ObO zrWSx7XQUHFzjH6rpBzrZeE2AFgP0UQ+Ce7BRcukVdji8bjtK5RNxMEQTAs0SvaqPbY0 kOpIFZYJDq2cxKNgEL/2M+w3snkhpfZfysF9LqgKxF9tRMYlaff7ORuXff3QXPPVlfhP QRyadFqHiOU9wCu/zRaWINDjeaid1WbvUlQYNVJnL7PYkdXJlsDWk4WybPMJ/Ajpyk2J 7lz74HyWfj3yvZOCLA89ssh1jVEGKzQpbzcAvcWBuLj8EAhq+SQZJ7vBTcnfwu0gpXIr uRjA== X-Gm-Message-State: AOJu0Ywl9a9IIKBcqP59jlg8bGd+ZlxXyk2ohKKT7ApxXMAUrYOyHgj5 Is/y6VYKgs9L3hWr0bRRhAqlFBuJotDPbdVq7Jv/x6u1Wa81KWLgnXo4H7/cvGutyJuCrSzlQc0 = X-Google-Smtp-Source: AGHT+IE+XbicXizoEN/dgM1hb56ihAH7Rv7ZEXbzarzxhFMaUgHeFYp/aCUdG+krDm3SP9oXWm48NQ== X-Received: by 2002:a17:906:28db:b0:a3e:5836:1473 with SMTP id p27-20020a17090628db00b00a3e58361473mr1049064ejd.65.1708686784260; Fri, 23 Feb 2024 03:13:04 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ps2-20020a170906bf4200b00a3f20a8d2f6sm2836017ejb.112.2024.02.23.03.13.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Feb 2024 03:13:04 -0800 (PST) Message-ID: <79228e84-31d2-4801-a014-daf451949637@suse.com> Date: Fri, 23 Feb 2024 12:13:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 4/4] x86/APX: honor -mevexwig= for byte-size insns Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Lili Cui References: Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3025.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org These uniformly ignore EVEX.W, and hence what we emit ought to be controllable by the command line option. --- While doing the adjustment right after install_template() seems desirable, there's still the question whether this might better be done in process_operands(). This is in particular because when non-NDD EVEX insns / forms of various insns are added (so far only ADCX and ADOX are there, which have neither memory destinations nor byte variants), the destination operand isn't the only one that will need considering here: An unsized memory destination would require inspecting an earlier operand (if any) or the suffix (which, just to mention it, must not be taken into consideration for CRC32, but that allows for memory source only anyway). Otoh process_operands() is also used by .insn handling, and we may not do such an adjustment there. --- v2: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -9103,6 +9103,15 @@ match_template (char mnem_suffix) i.tm.operand_types[addr_prefix_disp] = operand_types[addr_prefix_disp]; + /* APX insns acting on byte operands are WIG, yet that can't be expressed + in the templates (they're also covering word/dword/qword operands). */ + if (t->opcode_space == SPACE_EVEXMAP4 && !t->opcode_modifier.vexw && + i.types[i.operands - 1].bitfield.byte) + { + gas_assert (t->opcode_modifier.w); + i.tm.opcode_modifier.vexw = VEXWIG; + } + switch (found_reverse_match) { case 0: --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-apx-ndd-wig.d @@ -0,0 +1,161 @@ +#as: -mevexwig=1 +#objdump: -dw +#name: x86-64 APX NDD instructions w/ EVEX prefix and -mevexwig=1 +#source: x86-64-apx-ndd.s + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 d0 34 12 adc \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 10 f9 adc %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 11 38 adc %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 12 04 07 adc \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 13 04 07 adc \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 14 83 11 adc \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*62 54 6d 10 66 c7 adcx %r15d,%r8d,%r18d +[ ]*[a-f0-9]+:[ ]*62 14 f9 08 66 04 3f adcx \(%r15,%r31,1\),%r8 +[ ]*[a-f0-9]+:[ ]*62 14 69 10 66 04 3f adcx \(%r15,%r31,1\),%r8d,%r18d +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 c0 34 12 add \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 d4 fc 10 81 c7 33 44 34 12 add \$0x12344433,%r15,%r16 +[ ]*[a-f0-9]+:[ ]*62 d4 f4 10 80 c5 34 add \$0x34,%r13b,%r17b +[ ]*[a-f0-9]+:[ ]*62 f4 bc 18 81 c0 11 22 33 f4 add \$0xfffffffff4332211,%rax,%r8 +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 01 f8 add %r31,%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 01 38 add %r31,\(%r8\),%r16 +[ ]*[a-f0-9]+:[ ]*62 44 f8 10 01 3c c0 add %r31,\(%r8,%r16,8\),%r16 +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 00 f8 add %r31b,%r8b,%r16b +[ ]*[a-f0-9]+:[ ]*62 44 7c 10 01 f8 add %r31d,%r8d,%r16d +[ ]*[a-f0-9]+:[ ]*62 44 7d 10 01 f8 add %r31w,%r8w,%r16w +[ ]*[a-f0-9]+:[ ]*62 5c fc 10 03 07 add \(%r31\),%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 5c f8 10 03 84 07 90 90 00 00 add 0x9090\(%r31,%r16,1\),%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 00 f8 add %r31b,%r8b,%r16b +[ ]*[a-f0-9]+:[ ]*62 44 7c 10 01 f8 add %r31d,%r8d,%r16d +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 04 83 11 add \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 01 f8 add %r31,%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 d4 fc 10 81 04 8f 33 44 34 12 add \$0x12344433,\(%r15,%rcx,4\),%r16 +[ ]*[a-f0-9]+:[ ]*62 44 7d 10 01 f8 add %r31w,%r8w,%r16w +[ ]*[a-f0-9]+:[ ]*62 54 6e 10 66 c7 adox %r15d,%r8d,%r18d +[ ]*[a-f0-9]+:[ ]*62 5c fc 10 03 c7 add %r31,%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 44 fc 10 01 f8 add %r31,%r8,%r16 +[ ]*[a-f0-9]+:[ ]*62 14 fa 08 66 04 3f adox \(%r15,%r31,1\),%r8 +[ ]*[a-f0-9]+:[ ]*62 14 6a 10 66 04 3f adox \(%r15,%r31,1\),%r8d,%r18d +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 e0 34 12 and \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 20 f9 and %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 21 38 and %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 22 04 07 and \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 23 04 07 and \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 24 83 11 and \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 47 90 90 90 90 90 cmova -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 43 90 90 90 90 90 cmovae -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 42 90 90 90 90 90 cmovb -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 46 90 90 90 90 90 cmovbe -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 44 90 90 90 90 90 cmove -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4f 90 90 90 90 90 cmovg -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4d 90 90 90 90 90 cmovge -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4c 90 90 90 90 90 cmovl -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4e 90 90 90 90 90 cmovle -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 45 90 90 90 90 90 cmovne -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 41 90 90 90 90 90 cmovno -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4b 90 90 90 90 90 cmovnp -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 49 90 90 90 90 90 cmovns -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 40 90 90 90 90 90 cmovo -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 4a 90 90 90 90 90 cmovp -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 48 90 90 90 90 90 cmovs -0x6f6f6f70\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*62 f4 f4 10 ff c8 dec %rax,%r17 +[ ]*[a-f0-9]+:[ ]*62 9c bc 18 fe 0c 27 dec \(%r31,%r12,1\),%r8b +[ ]*[a-f0-9]+:[ ]*62 b4 b0 10 af 94 f8 09 09 00 00 imul 0x909\(%rax,%r31,8\),%rdx,%r25 +[ ]*[a-f0-9]+:[ ]*67 62 f4 3c 18 af 90 09 09 09 00 imul 0x90909\(%eax\),%edx,%r8d +[ ]*[a-f0-9]+:[ ]*62 dc fc 10 ff c7 inc %r31,%r16 +[ ]*[a-f0-9]+:[ ]*62 dc bc 18 ff c7 inc %r31,%r8 +[ ]*[a-f0-9]+:[ ]*62 f4 e4 18 ff c0 inc %rax,%rbx +[ ]*[a-f0-9]+:[ ]*62 f4 f4 10 f7 d8 neg %rax,%r17 +[ ]*[a-f0-9]+:[ ]*62 9c bc 18 f6 1c 27 neg \(%r31,%r12,1\),%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 f4 10 f7 d0 not %rax,%r17 +[ ]*[a-f0-9]+:[ ]*62 9c bc 18 f6 14 27 not \(%r31,%r12,1\),%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 c8 34 12 or \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 08 f9 or %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 09 38 or %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 0a 04 07 or \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 0b 04 07 or \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 0c 83 11 or \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 d4 02 rcl \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 d0 rcl %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 10 rcl \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 10 02 rcl \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 10 rcl \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 14 83 rcl %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 dc 02 rcr \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 d8 rcr %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 18 rcr \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 18 02 rcr \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 18 rcr \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 1c 83 rcr %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 c4 02 rol \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 c0 rol %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 00 rol \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 00 02 rol \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 00 rol \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 04 83 rol %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 cc 02 ror \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 c8 ror %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 08 ror \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 08 02 ror \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 08 ror \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 0c 83 ror %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 fc 02 sar \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 f8 sar %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 38 sar \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 38 02 sar \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 38 sar \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 3c 83 sar %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 d8 34 12 sbb \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 18 f9 sbb %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 19 38 sbb %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 1a 04 07 sbb \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 1b 04 07 sbb \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 1c 83 11 sbb \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 e4 02 shl \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 e4 02 shl \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 e0 shl %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 e0 shl %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 20 shl \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 20 shl \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 74 84 10 24 20 01 shld \$0x1,%r12,\(%rax\),%r31 +[ ]*[a-f0-9]+:[ ]*62 74 04 10 24 38 02 shld \$0x2,%r15d,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 54 05 10 24 c4 02 shld \$0x2,%r8w,%r12w,%r31w +[ ]*[a-f0-9]+:[ ]*62 7c bc 18 a5 e0 shld %cl,%r12,%r16,%r8 +[ ]*[a-f0-9]+:[ ]*62 7c 05 10 a5 2c 83 shld %cl,%r13w,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 74 05 10 a5 08 shld %cl,%r9w,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 20 02 shl \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 20 02 shl \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 20 shl \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 20 shl \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 24 83 shl %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 24 83 shl %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 d4 84 10 c0 ec 02 shr \$0x2,%r12b,%r31b +[ ]*[a-f0-9]+:[ ]*62 fc bc 18 d2 e8 shr %cl,%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 f4 84 10 d0 28 shr \$1,\(%rax\),%r31b +[ ]*[a-f0-9]+:[ ]*62 74 84 10 2c 20 01 shrd \$0x1,%r12,\(%rax\),%r31 +[ ]*[a-f0-9]+:[ ]*62 74 04 10 2c 38 02 shrd \$0x2,%r15d,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 54 05 10 2c c4 02 shrd \$0x2,%r8w,%r12w,%r31w +[ ]*[a-f0-9]+:[ ]*62 7c bc 18 ad e0 shrd %cl,%r12,%r16,%r8 +[ ]*[a-f0-9]+:[ ]*62 7c 05 10 ad 2c 83 shrd %cl,%r13w,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 74 05 10 ad 08 shrd %cl,%r9w,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 f4 04 10 c1 28 02 shr \$0x2,\(%rax\),%r31d +[ ]*[a-f0-9]+:[ ]*62 f4 05 10 d1 28 shr \$1,\(%rax\),%r31w +[ ]*[a-f0-9]+:[ ]*62 fc 05 10 d3 2c 83 shr %cl,\(%r19,%rax,4\),%r31w +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 e8 34 12 sub \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 28 f9 sub %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 29 38 sub %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 2a 04 07 sub \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 2b 04 07 sub \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 2c 83 11 sub \$0x11,\(%r19,%rax,4\),%r20d +[ ]*[a-f0-9]+:[ ]*62 f4 0d 10 81 f0 34 12 xor \$0x1234,%ax,%r30w +[ ]*[a-f0-9]+:[ ]*62 7c ec 10 30 f9 xor %r15b,%r17b,%r18b +[ ]*[a-f0-9]+:[ ]*62 54 6c 10 31 38 xor %r15d,\(%r8\),%r18d +[ ]*[a-f0-9]+:[ ]*62 c4 bc 18 32 04 07 xor \(%r15,%rax,1\),%r16b,%r8b +[ ]*[a-f0-9]+:[ ]*62 c4 3d 18 33 04 07 xor \(%r15,%rax,1\),%r16w,%r8w +[ ]*[a-f0-9]+:[ ]*62 fc 5c 10 83 34 83 11 xor \$0x11,\(%r19,%rax,4\),%r20d +#pass --- a/gas/testsuite/gas/i386/x86-64.exp +++ b/gas/testsuite/gas/i386/x86-64.exp @@ -381,6 +381,7 @@ run_dump_test "x86-64-apx-evex-promoted- run_dump_test "x86-64-apx-evex-promoted-wig" run_dump_test "x86-64-apx-evex-egpr" run_dump_test "x86-64-apx-ndd" +run_dump_test "x86-64-apx-ndd-wig" run_dump_test "x86-64-apx-jmpabs" run_dump_test "x86-64-apx-jmpabs-intel" run_dump_test "x86-64-apx-jmpabs-inval"