From patchwork Fri Mar 3 12:56:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 63885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp391780wrd; Fri, 3 Mar 2023 04:56:35 -0800 (PST) X-Google-Smtp-Source: AK7set+8AaXCFb41/MPvksSBXWR+6efgfxZwFRZn7kv2131yYyw526Px9Xys9ynsGzxHUibvKp2Y X-Received: by 2002:a17:907:8a0c:b0:8b1:3002:bd6d with SMTP id sc12-20020a1709078a0c00b008b13002bd6dmr1808769ejc.31.1677848195539; Fri, 03 Mar 2023 04:56:35 -0800 (PST) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l7-20020aa7c307000000b004c087824bd0si2540126edq.47.2023.03.03.04.56.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 04:56:35 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DmSob3WJ; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7F20B3858408 for ; Fri, 3 Mar 2023 12:56:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F20B3858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677848194; bh=K2HlOjQjBJfRH3J+/HiqV92pvOum+ShkZzY8HFnJ7Ao=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=DmSob3WJBTv0CsaG+3+WvBv/mtxVKu/IJeMjlI/nyo995FPe5rH+VRrPu7pQS1Ouc hFY5XWCZ62RLQ4I9VB3b15x9J79jpcUCi/kcBdlV+CIs+xW3S63+icFR3nKDjAgH+u Xfe5vBVQokBKf5ua2/MFw2HcM+Ul3ovk0dDtNVJo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2069.outbound.protection.outlook.com [40.107.6.69]) by sourceware.org (Postfix) with ESMTPS id 9892F3858D33 for ; Fri, 3 Mar 2023 12:56:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9892F3858D33 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enG+ugzsi46QhgXYLlx8/sr2zK61QhiQN7+L4Otp3Fqlmajn1+4OqxJ0B3WCxsAewlKvNIwnz8ywXRO9wBDQM59OdvdgW7b//9It4vJ7amhz6gL6/QABFfpfNxDqNqj9XjELb9xI+iOdDfNncbtM5gzhn4eAt9JjKu+8ergqGhPkxZhKjIESZqaIW9Wg4SCGkBmWUASCDSYQ6DOsQZo6VzaIDZ/JV6rRddJvNDMUrATX4eGa1jOeadp+vqZqiDKeCJ3Sh+iF1GekRP9E6zMgREvgB7/z5pKn1ljweLIz6v3TSihTHSurDJTMWn7GupJo2JhE9UdVkoY4LYyyYF/wow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K2HlOjQjBJfRH3J+/HiqV92pvOum+ShkZzY8HFnJ7Ao=; b=maLzTjIe8eyQ94b5INYcvGPvAz4vAWodaiCbHLxHyrKzThVOmH1cB18SRTtF9f89C3Ex9TfYPi3RfQdU/z71tEMRkANnFcZOZN6cOtI1AvAeoB4wAeA4oAHLk9taewMpkckNQF7uq3pZuX/r72FHJXJ9QW8gECaOSYmEUbQo4JK+UXOJIzfFziphj4ZU1s6sepNoTc069oMfnfIVJeGbj6jwj9XBKkUFtcuhs4d1w066iZRBEAKhgN/c1+cnJhoIDH11IkIvvNG7PGL8WJhOxT27w/CywDxuEr/urd80RB2gTLj5wM0x7+hzO9qtiaPVIaVr2+BP3UXOW1ezFgyxJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DBBPR04MB7513.eurprd04.prod.outlook.com (2603:10a6:10:20a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.21; Fri, 3 Mar 2023 12:56:22 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%7]) with mapi id 15.20.6156.019; Fri, 3 Mar 2023 12:56:22 +0000 Message-ID: Date: Fri, 3 Mar 2023 13:56:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH 01/18] x86: introduce .insn directive Content-Language: en-US To: Binutils Cc: "H.J. Lu" , "Jiang, Haochen" References: <764b9e03-18bd-6945-692f-a250522196ca@suse.com> In-Reply-To: <764b9e03-18bd-6945-692f-a250522196ca@suse.com> X-ClientProxiedBy: FR3P281CA0028.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::19) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DBBPR04MB7513:EE_ X-MS-Office365-Filtering-Correlation-Id: b7f3e805-e883-47b2-94fd-08db1be6b077 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qqAO+hb+5yukl1hi509va2vNo2jsrARbH/qIpcMvI44NzzilrS2cJmRi6l4mMW9jWCvFyQm9XgyeZOqOFabjBTesvGjkqG6Us8PdgBhubjDNdmqqQllEMk8r6AEk4QyT3EteHmurC/m2RTJmBfq1GqRPliGOdOhBWHNZLCnnB2UPSJWYsTZXtQZBYbFWQYekNXvFV2SJfpmHzCXDga6+vcfgVPfjGduW3FeqWTxRrhY77T7OIhvK/vdb0BmsBVyi9uyFl9YDCWNscB26QhvSyPv/YGjQVGYaXMfEzSgmYfJp5xWpxaf7ZYXHyjONi9/YQ2WubKvSRWcPU00UGcCpiRvz2nGSRgFpA1DF6qwBKEzhMOFZygBFRZchN9F7rhDtgiqskt+9Zr7ITBPDUUkcnjXsfOAKSVvJRwUjG5N9o2e/RgD+ooTEGCLbqXW2B5zfdhG6uNUH12ALMo1TydwkgfNOApt7F6bLAZ6MB0k+Z+A4VQujy/9PMCWsNw15h4PRDSbcanW6GWzssvm8bGDbqfD3dIZkO0sNr2vpYU66xQA53asJIE5fqBFbKwZ5tvZs4pt6X4NmDtEU4GjZHb0Yf7u7XO1DAQyBXEFIE1HhT2jerrKC1zrqjz9bQj7OCvyd8qWP1Oda+F0iWh9KXUBLkRgaawtnJuiRB/SXQmqyCz/wRGS2pFkB9jHKlGLCJb4KWpfuJrFInLF6joc6gljdQGzeOXUAM0F7pNjodIPF1jfvPDHMBY5ffbJzelLJxUaJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(366004)(346002)(376002)(39860400002)(136003)(451199018)(66899018)(83380400001)(31686004)(8936002)(31696002)(36756003)(38100700002)(5660300002)(478600001)(86362001)(66946007)(2616005)(186003)(26005)(6506007)(6486002)(6512007)(8676002)(66556008)(66476007)(2906002)(6916009)(316002)(41300700001)(4326008)(54906003)(142923001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?bwgKIlDOkwpBAJNaD+zIbCfSCpQO?= =?utf-8?q?7E6UGF5CbQmgyjO12lHHDfrj44WbFIfvRM+Yy3ACKKj/uzmQgrIuF8IUENsqNt/2z?= =?utf-8?q?Ta/t4nD4mVNRynFK0i1e0kEl+FZdd8CpZJRvcQ/CssYXK6Vx71hlhh7kT+OjJMH95?= =?utf-8?q?TDSvfHGmgz35BhGxPwVMxZT9I6SQ4P6l6yq8+x+1NkvAmlqL0DXrgBEdhMLy67jF3?= =?utf-8?q?kLvWe8y/+5DDyxb5xSiZ7ZpRx9m9Qa3lOUTW0/a6QHVgMM69G89kufsTVptwDnu6h?= =?utf-8?q?6zknIWvkXSoshPAaHHZGDUcXk4y9G/YjYHUKomhxXgE+AmsR7gI5TswDmFcRSf+2P?= =?utf-8?q?DSLR8tYGM862W8RYx5HKG5rjNszihxAM+CEX2triZH5cBgDo22Pc4XbtzgU+fO2q2?= =?utf-8?q?HVaJ3Q5qy0Doko4eYknyqgGxgbLq2DwIrjDCt8/jy2Nfk03nY+A+EG/k+uPtIH9G0?= =?utf-8?q?v/rB+KXhGqnQJzk3n4jaWhFNpnk2Sy5Tx9ykEQ1mMNzXphfzbEK3EEb1VBQBX9Qd/?= =?utf-8?q?okY5T75svyOdQ9MfV5akDD495C4NalKZbXfIm1m0bPH5K7Ca7nJcobpZ/8h7el2VS?= =?utf-8?q?ZOpuhX1IpQEDh0Ni1BDYVm8HaSo9UCwhb/CwhO7oVhuBbj2jXZmQ5EqgTIvIaCL5b?= =?utf-8?q?RnneyM6uTtalSQCdhaPBkWLUMchK6tH9ujddEGp4K93XqTohD1hVCm+73cuu+doMi?= =?utf-8?q?p0DDoqkOunXmKVTE4GRtnyPrWX+rTizbk88Du8ELircnuR/9HHFseuRIwrVTAY5Ok?= =?utf-8?q?DmwYwg7F9wfndgNdI262rscvwAEjklkoyeA5kaTnl++J3QH5h0L2sgN7eTi6kp5f8?= =?utf-8?q?YYXokoWMcYmMY7AOhAbjifTzko5yAT45VU7d52Y1Zgko3zwn6VKBATpEUdB4kapGP?= =?utf-8?q?DRAbX49r16XqlOpV1tQYcQofBSpu4lh9TwOt/YEdvX5TeUGHK3Rhm3vdiRNk2pSCt?= =?utf-8?q?QCvjkR46zINR1vq8AhObv2E7WVt6bhpAeSL/gmvm9mXqeAvwbthu74+oQQ/L7nYjX?= =?utf-8?q?PxfVSP5uakrTxyrVkypGNDwN+G6k7L6RchybffFd7o6w63lqlLaC6e4+PQUl3vHMS?= =?utf-8?q?cq/NFYJAFGBdK2UvNkpO+H6yLnSxbuLOZPrcNYuC2Y/0HkcSANHRR/4ePLzuiraMd?= =?utf-8?q?COpCfiJ23Nyl+H4pqM+MGq7MOhtfEPyEfNRVf1eQOUxRzwSffs2p7kuDEqp0lqCm1?= =?utf-8?q?wRxK2t9VbbVRy/2tX6YG5UWT6SPQGaBnOfIztelXhLiuNy/ARw+kEUSFN9+glT5v9?= =?utf-8?q?jLHXukCXoh/VvlmEe3p0efiOJ6sWyHOoU5k0DjLrC/H6tLUU7qxFlniNTU6TBKyFX?= =?utf-8?q?I0JOpHjplGlNU+HyXDwGk7fUcU+FjrDI9ud0I/b80j6v/NMi20+q0/lvqh6bF0sAo?= =?utf-8?q?oFd3PpFuLcm+hPjugpI334QHZA3grj7C4UdLba4raR/oKPZCpqq3Pet6faLTsTdPh?= =?utf-8?q?I+BbbjfawFRr8HJ9LGH6JMB+KeaB4o9EzNDiuQCZrh7Mo9X4tYVjvPjft/qUg5/hZ?= =?utf-8?q?ft/FBI5wUiv5?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7f3e805-e883-47b2-94fd-08db1be6b077 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2023 12:56:22.6674 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t5Y0dkruw10pR27pAlBLEr0eahiiprLfyihdD7CkLoQgR92j/ni2f04QKsFRdV15zauzfP9c858LIY3tq6P1Wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7513 X-Spam-Status: No, score=-3028.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759351349083020386?= X-GMAIL-MSGID: =?utf-8?q?1759351349083020386?= For starters this deals with only very basic constructs. --- Subsequently a dot_insn() predicate will be introduced. If deemed better than parse_insn()'s new parameter, its introduction could be pulled ahead into here, and the predicate then be used there instead. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -137,6 +137,7 @@ typedef struct arch_entry; static void update_code_flag (int, int); +static void s_insn (int); static void set_code_flag (int); static void set_16bit_gcc_code_flag (int); static void set_intel_syntax (int); @@ -159,7 +160,7 @@ static int i386_intel_operand (char *, i static int i386_intel_simplify (expressionS *); static int i386_intel_parse_name (const char *, expressionS *); static const reg_entry *parse_register (char *, char **); -static const char *parse_insn (const char *, char *); +static const char *parse_insn (const char *, char *, bool); static char *parse_operands (char *, const char *); static void swap_operands (void); static void swap_2_operands (unsigned int, unsigned int); @@ -1198,6 +1199,7 @@ const pseudo_typeS md_pseudo_table[] = {"bfloat16", float_cons, 'b'}, {"value", cons, 2}, {"slong", signed_cons, 4}, + {"insn", s_insn, 0}, {"noopt", s_ignore, 0}, {"optim", s_ignore, 0}, {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT}, @@ -4855,6 +4857,20 @@ insert_lfence_before (void) } } +/* Shared helper for md_assemble() and s_insn(). */ +static void init_globals (void) +{ + unsigned int j; + + memset (&i, '\0', sizeof (i)); + i.rounding.type = rc_none; + for (j = 0; j < MAX_OPERANDS; j++) + i.reloc[j] = NO_RELOC; + memset (disp_expressions, '\0', sizeof (disp_expressions)); + memset (im_expressions, '\0', sizeof (im_expressions)); + save_stack_p = save_stack; +} + /* Helper for md_assemble() to decide whether to prepare for a possible 2nd parsing pass. Instead of introducing a rarely use new insn attribute this utilizes a common pattern between affected templates. It is deemed @@ -4887,19 +4903,13 @@ md_assemble (char *line) /* Initialize globals. */ current_templates = NULL; retry: - memset (&i, '\0', sizeof (i)); - i.rounding.type = rc_none; - for (j = 0; j < MAX_OPERANDS; j++) - i.reloc[j] = NO_RELOC; - memset (disp_expressions, '\0', sizeof (disp_expressions)); - memset (im_expressions, '\0', sizeof (im_expressions)); - save_stack_p = save_stack; + init_globals (); /* First parse an instruction mnemonic & call i386_operand for the operands. We assume that the scrubber has arranged it so that line[0] is the valid start of a (possibly prefixed) mnemonic. */ - end = parse_insn (line, mnemonic); + end = parse_insn (line, mnemonic, false); if (end == NULL) { if (pass1_mnem != NULL) @@ -5472,7 +5482,7 @@ static INLINE bool q_suffix_allowed(cons } static const char * -parse_insn (const char *line, char *mnemonic) +parse_insn (const char *line, char *mnemonic, bool prefix_only) { const char *l = line, *token_start = l; char *mnem_p; @@ -5502,6 +5512,8 @@ parse_insn (const char *line, char *mnem || (*l != PREFIX_SEPARATOR && *l != ','))) { + if (prefix_only) + break; as_bad (_("invalid character %s in mnemonic"), output_invalid (*l)); return NULL; @@ -5623,6 +5635,9 @@ parse_insn (const char *line, char *mnem break; } + if (prefix_only) + return token_start; + if (!current_templates) { /* Deprecated functionality (new code should use pseudo-prefixes instead): @@ -10702,6 +10717,136 @@ signed_cons (int size) cons_sign = -1; } +static void +s_insn (int dummy ATTRIBUTE_UNUSED) +{ + char mnemonic[MAX_MNEM_SIZE], *line = input_line_pointer; + char *saved_ilp = find_end_of_line (line, false), saved_char; + const char *end; + unsigned int j; + valueT val; + bool vex = false, xop = false, evex = false; + static const templates tt = { &i.tm, &i.tm + 1 }; + + init_globals (); + + saved_char = *saved_ilp; + *saved_ilp = 0; + + end = parse_insn (line, mnemonic, true); + if (end == NULL) + { + bad: + *saved_ilp = saved_char; + ignore_rest_of_line (); + return; + } + line += end - line; + + current_templates = &tt; + i.tm.mnem_off = MN__insn; + + if (startswith (line, "VEX") + && (line[3] == '.' || is_space_char (line[3]))) + { + vex = true; + line += 3; + } + else if (startswith (line, "XOP") && ISDIGIT (line[3])) + { + char *e; + unsigned long n = strtoul (line + 3, &e, 16); + + if (e == line + 5 && n >= 0x08 && n <= 0x1f + && (*e == '.' || is_space_char (*e))) + { + xop = true; + line = e; + } + } + else if (startswith (line, "EVEX") + && (line[4] == '.' || is_space_char (line[4]))) + { + evex = true; + line += 4; + } + + if (vex || xop + ? i.vec_encoding == vex_encoding_evex + : evex + ? i.vec_encoding == vex_encoding_vex + || i.vec_encoding == vex_encoding_vex3 + : i.vec_encoding != vex_encoding_default) + { + as_bad (_("pseudo-prefix conflicts with encoding specifier")); + goto bad; + } + + if (line > end && *line == '.') + { + } + + input_line_pointer = line; + val = get_absolute_expression (); + line = input_line_pointer; + + for (j = 1; j < sizeof(val); ++j) + if (!(val >> (j * 8))) + break; + + /* Trim off a prefix if present. */ + if (j > 1 && !vex && !xop && !evex) + { + uint8_t byte = val >> ((j - 1) * 8); + + switch (byte) + { + case DATA_PREFIX_OPCODE: + case REPE_PREFIX_OPCODE: + case REPNE_PREFIX_OPCODE: + if (!add_prefix (byte)) + goto bad; + val &= ((uint64_t)1 << (--j * 8)) - 1; + break; + } + } + + /* Trim off encoding space. */ + if (j > 1 && !i.tm.opcode_space && (val >> ((j - 1) * 8)) == 0x0f) + { + uint8_t byte = val >> ((--j - 1) * 8); + + i.tm.opcode_space = SPACE_0F; + switch (byte & -(j > 1)) + { + case 0x38: + i.tm.opcode_space = SPACE_0F38; + --j; + break; + case 0x3a: + i.tm.opcode_space = SPACE_0F3A; + --j; + break; + } + val &= ((uint64_t)1 << (j * 8)) - 1; + } + + if (j > 2) + { + as_bad (_("opcode residual (%#"PRIx64") too wide"), val); + goto bad; + } + i.opcode_length = j; + i.tm.base_opcode = val; + + output_insn (); + + *saved_ilp = saved_char; + input_line_pointer = line; + + demand_empty_rest_of_line (); +} + #ifdef TE_PE static void pe_directive_secrel (int dummy ATTRIBUTE_UNUSED) --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -68,6 +68,7 @@ if [gas_32_check] then { run_dump_test "intelok" run_dump_test "prefix" run_list_test "prefix32" "-al" + run_dump_test "insn-32" run_dump_test "lea" run_dump_test "lea16" run_dump_test "amd" @@ -873,6 +874,7 @@ if [gas_64_check] then { 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_dump_test "noreg64" run_list_test "noreg64" run_dump_test "noreg64-data16" --- /dev/null +++ b/gas/testsuite/gas/i386/insn-32.d @@ -0,0 +1,14 @@ +#objdump: -dw +#name: .insn (32-bit code) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 90[ ]+nop +[ ]*[a-f0-9]+: f3 90[ ]+pause +[ ]*[a-f0-9]+: f3 90[ ]+pause +[ ]*[a-f0-9]+: d9 ee[ ]+fldz +[ ]*[a-f0-9]+: f3 0f 01 e8[ ]+setssbsy +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/insn-32.s @@ -0,0 +1,14 @@ + .text +insn: + # nop + .insn 0x90 + + # pause + .insn 0xf390 + .insn repe 0x90 + + # fldz + .insn 0xd9ee + + # setssbsy + .insn 0xf30f01e8 --- /dev/null +++ b/gas/testsuite/gas/i386/insn-64.d @@ -0,0 +1,14 @@ +#objdump: -dw +#name: .insn (64-bit code) + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[a-f0-9]+: 90[ ]+nop +[ ]*[a-f0-9]+: f3 90[ ]+pause +[ ]*[a-f0-9]+: f3 90[ ]+pause +[ ]*[a-f0-9]+: d9 ee[ ]+fldz +[ ]*[a-f0-9]+: f3 0f 01 e8[ ]+setssbsy +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/insn-64.s @@ -0,0 +1,14 @@ + .text +insn: + # nop + .insn 0x90 + + # pause + .insn 0xf390 + .insn repe 0x90 + + # fldz + .insn 0xd9ee + + # setssbsy + .insn 0xf30f01e8 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1814,6 +1814,9 @@ process_i386_opcodes (FILE *table) l = l1; } + fprintf (table, " \"\\0\"\".insn\"\n"); + fprintf (fp, "#define MN__insn %#x\n", offs + 1); + fprintf (table, ";\n"); fclose (fp);