From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 9CD613858CDA for ; Tue, 8 Nov 2022 21:21:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9CD613858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52c.google.com with SMTP id x2so24463443edd.2 for ; Tue, 08 Nov 2022 13:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TolLkT8eNQHwGxr6szUmCbfiiAZeeJ77uU0lphkBh7I=; b=DKypawI7lKWzZ1yJCFBhS3/cFjnCDlWVJE988d+6J8UQ8XEGZIDHfdwplU2ipw0HbJ H8DFQi87gOkky7PEXjqKu9DxgWJWXzHSbOjcLWnbfQ1SbQVlanxq7vQJzHzlQp11M7z8 XtdFGHYJRJBg4siwRcVtymRDbyn0J3JjOTN4R6dA2GGi344rQT/2mcgUK1m2U5XNUXYC g+UxVLqhzf7ttdbSxcUcjh4cg+ccWhCpQUKZShXVJDvWfIIg1kwFOGyVuWUui9xGepnL kCaw8wsohbMTukRKwp4ysk/AM3e0HJ/ZZZYOEtUsGdC0wlTbzNCEPxvkhiblElcxLSvX K4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TolLkT8eNQHwGxr6szUmCbfiiAZeeJ77uU0lphkBh7I=; b=SsYhM34l1SJC+VHTSxtlHVeHbrbBXhV0fanS99HF9uoMTCdm3/HcL7frIx1ENbNTXh FPzvcbplRF8bv8QttE08wll3Me5Mg+EmJ/zDCz0YHIozI8sxojuixLsqoKiGhh9F9KFu aLjsyGEwSFanZKLDRTL5G0C4xer5RiodUfWDOECkRIjTVeADJ14XEXccQramtZNhWFYN F19pyN/57o/Tu6WQNg8LR0w0ACuouR99xgvgoIYAwITQPnbjUsNle26blXjruUJ9sZmP 2IphwoBdf3RL3N05vuORvgSHmPjkmVaUtjsfBCTFFP0I0pCB6PKKpj7LGawRHJBUE09v bWsg== X-Gm-Message-State: ACrzQf3pGhEx8RYIZPx6Y94QfPRPrU4hBfoL8s8UEOBXdMjmzRRoW6gk Bu5f0w+S1HxGc4PVZgfADGwd5BLxggMXJYEqHBy8ekGg X-Google-Smtp-Source: AMsMyM59fx1UwQHljPkpYJSckDfNM64ek5jTiJ4Z8sVL+0CItMhMzqmg13JNi9X1KXRtZC/CjTHCDSzf0uXU93bOKZ0= X-Received: by 2002:a05:6402:b56:b0:461:91aa:11b7 with SMTP id bx22-20020a0564020b5600b0046191aa11b7mr58790714edb.220.1667942487547; Tue, 08 Nov 2022 13:21:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Tue, 8 Nov 2022 13:20:49 -0800 Message-ID: Subject: Re: [PATCH] x86/Intel: don't accept malformed EXTRQ / INSERTQ To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3017.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: On Tue, Nov 8, 2022 at 3:29 AM Jan Beulich wrote: > > Operand swapping was mistakenly suppressed when the first two operands > were immediate ones, not taking into account overall operand count. This > way EXTRQ / INSERTQ would have been accepted also with kind-of-AT&T > operand order. > > For the testcase being extended, in order to not move around "GAS > LISTING" expectations, suppress pagination. > > --- a/gas/config/tc-i386.c > +++ b/gas/config/tc-i386.c > @@ -4885,7 +4885,8 @@ md_assemble (char *line) > && !startswith (mnemonic, "rmp") > && (strcmp (mnemonic, "tpause") != 0) > && (strcmp (mnemonic, "umwait") != 0) > - && !(operand_type_check (i.types[0], imm) > + && !(i.operands == 2 > + && operand_type_check (i.types[0], imm) > && operand_type_check (i.types[1], imm))) > swap_operands (); > > --- a/gas/testsuite/gas/i386/i386.exp > +++ b/gas/testsuite/gas/i386/i386.exp > @@ -51,7 +51,7 @@ if [gas_32_check] then { > > run_list_test "float" "-al -mmnemonic=att" > run_list_test "general" "-al --listing-lhs-width=2" > - run_list_test "inval" "-al" > + run_list_test "inval" "-aln" > run_list_test "inval-16" "-al" > run_list_test "segment" "-al" > run_list_test "inval-seg" "-al" > --- a/gas/testsuite/gas/i386/inval.l > +++ b/gas/testsuite/gas/i386/inval.l > @@ -87,19 +87,18 @@ > .*:97: Error: .*shl.* > .*:98: Error: .*rol.* > .*:99: Error: .*rcl.* > -.*:102: Error: .* > -.*:104: Error: .* > +.*:101: Error: .*extrq.* > +.*:102: Error: .*insertq.* > .*:105: Error: .* > -.*:106: Error: .* > +.*:107: Error: .* > .*:108: Error: .* > .*:109: Error: .* > -.*:110: Error: .* > +.*:111: Error: .* > .*:112: Error: .* > .*:113: Error: .* > -.*:114: Error: .* > -GAS LISTING .* > - > - > +.*:115: Error: .* > +.*:116: Error: .* > +.*:117: Error: .* > [ ]*1[ ]+\.text > [ ]*2[ ]+\.allow_index_reg > [ ]*3[ ]+\# All the following should be illegal > @@ -157,9 +156,6 @@ GAS LISTING .* > [ ]*55[ ]+fnstsw %al > [ ]*56[ ]+fstsw %eax > [ ]*57[ ]+fstsw %al > - GAS LISTING .* > - > - > [ ]*58[ ]+ > [ ]*59[ ]+movnti %ax, \(%eax\) > [ ]*60[ ]+movntiw %ax, \(%eax\) > @@ -203,6 +199,9 @@ GAS LISTING .* > [ ]*[1-9][0-9]*[ ]+rol \[ecx\], 2 > [ ]*[1-9][0-9]*[ ]+rcl \[edx\], cl > [ ]*[1-9][0-9]*[ ]+ > +[ ]*[1-9][0-9]*[ ]+extrq 1, 2, xmm3 > +[ ]*[1-9][0-9]*[ ]+insertq 1, 2, xmm3, xmm4 > +[ ]*[1-9][0-9]*[ ]+ > [ ]*[1-9][0-9]*[ ]+\.att_syntax prefix > [ ]*[1-9][0-9]*[ ]+movsd \(%esi\), %ss:\(%edi\), %ss:\(%eax\) > [ ]*[1-9][0-9]*[ ]+ > @@ -217,6 +216,4 @@ GAS LISTING .* > [ ]*[1-9][0-9]*[ ]+inb %dx, %ax > [ ]*[1-9][0-9]*[ ]+outb %ax, %dx > [ ]*[1-9][0-9]*[ ]+movb %ax, %bx > - GAS LISTING .* > - > - > +#pass > --- a/gas/testsuite/gas/i386/inval.s > +++ b/gas/testsuite/gas/i386/inval.s > @@ -98,6 +98,9 @@ movnti word ptr [eax], ax > rol [ecx], 2 > rcl [edx], cl > > + extrq 1, 2, xmm3 > + insertq 1, 2, xmm3, xmm4 > + > .att_syntax prefix > movsd (%esi), %ss:(%edi), %ss:(%eax) > OK. Thanks. -- H.J.