From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 627F238582B6 for ; Tue, 11 Oct 2022 17:50:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 627F238582B6 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-qv1-xf2f.google.com with SMTP id o67so8980500qvo.13 for ; Tue, 11 Oct 2022 10:50:41 -0700 (PDT) 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=qSjbUfDBNcMN8KGcxnnJPVJqm/nx08eBtSq6xU2TRxQ=; b=N9ra8e8Ctypj9qrmCeRS3NjkBrryUSoEdHJedhFNaxvV3tG7jNl+LMi8pjB7a514Ip vNzf5xVA8zVPHchgB0XFoE3MfI3Sv8iI8y7j80pskzI5DgW8vrgfuZ1HrVMG1EHFqkAN 65yVIefesssZBAvIjO6gowPEhdxN3SEoV/ZpKYZ2A1HEgDOGQYxoO4tB0cRTj6sHZbP7 wBXlDlszD3Ire2dUC0kS9rlyUfFcDFfeo/kKVjAz0AjceSr07OUGGUrwb9qPW5C+ljxm rHO7uZ8rFrTspGIm5imsder1ZTHNzESUQHty9yu1344IX3weCVKfICfbApk098CxkTQr 9ZEg== 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=qSjbUfDBNcMN8KGcxnnJPVJqm/nx08eBtSq6xU2TRxQ=; b=0NoyfJ0Gkv0MXE23EEZB4KScv0T3WJB6JYPPceaC2BxWZnLN45wmk4qBmbacXPfQ4X jvA195cDotFg1slWQF0Bt0gnXG309xi9kPq+CRa5GRL7gR2B5HLO08VWrONg36n51F4K pzbxZx3Cf8EwV+NfjEGiEvGVExBIdzmlwbjRmxpvxOWMNDk5DuEKO/utQTTpVl4tPA8R 5iE+G7TmkacJ1ouqDuvdD43OPL3hfzcVXmJZ2DLmMhFUNTJ9EXRiw7C5et/LC4YMPgWt CqJc/xvoD/mFP/l+kOkX6sAxbhrvqzwm5deA+IqUydA4YVO6b5QpIiF+99ZkqizmmVg0 17rQ== X-Gm-Message-State: ACrzQf2NE1U9/Qgu1Zu1ACdv/7Yn62RTB+rWpLZvZbm4ZEezTjl3sfZe NbqSo+b11T2FSrnyVoNNIdVG+HaRS9daZfvqzZHpEkH+ X-Google-Smtp-Source: AMsMyM5ClLEOgWwqi8G+xcEubQhMndkXLd02kWA5RKjc0o8GeaLp3tZbyhphfsb+cB3Nt9fMOkfmz/OcgoUkElayCGk= X-Received: by 2002:a05:6214:d6b:b0:4b1:c4de:5b3e with SMTP id 11-20020a0562140d6b00b004b1c4de5b3emr20394861qvs.128.1665510640752; Tue, 11 Oct 2022 10:50:40 -0700 (PDT) MIME-Version: 1.0 References: <20e2773a-2e47-869b-1900-709f8ad4cd6b@suse.com> In-Reply-To: From: "H.J. Lu" Date: Tue, 11 Oct 2022 10:50:04 -0700 Message-ID: Subject: Re: [PATCH v3 6/7] x86-64: allow HLE store of accumulator to absolute 32-bit address To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3017.6 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 Wed, Oct 5, 2022 at 12:25 AM Jan Beulich wrote: > > In commit 1212781b35c9 ("ix86: allow HLE store of accumulator to > absolute address") I was wrong to exclude 64-bit code. Dropping the > check also leads to better diagnostics in 64-bit code ("MOV", after > all, isn't invalid with "XRELEASE"). > > While there also limit the amount of further checks done: The operand > type checks that were there were effectively redundant with other ones > anyway, plus it's quite fine to also have "xrelease mov , %eax" > look for the next MOV template (in fact again also improving > diagnostics). > --- > v2: New. > > --- a/gas/config/tc-i386.c > +++ b/gas/config/tc-i386.c > @@ -6819,12 +6819,9 @@ match_template (char mnem_suffix) > continue; > /* xrelease mov %eax, is another special case. It must not > match the accumulator-only encoding of mov. */ > - if (flag_code != CODE_64BIT > - && i.hle_prefix > + if (i.hle_prefix > && t->base_opcode == 0xa0 > - && t->opcode_modifier.opcodespace == SPACE_BASE > - && i.types[0].bitfield.instance == Accum > - && (i.flags[1] & Operand_Mem)) > + && t->opcode_modifier.opcodespace == SPACE_BASE) > continue; > /* Fall through. */ > > --- a/gas/testsuite/gas/i386/x86-64-hle-intel.d > +++ b/gas/testsuite/gas/i386/x86-64-hle-intel.d > @@ -425,6 +425,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and BYTE PTR \[rcx\],al > [ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and BYTE PTR \[rcx\],al > [ ]*[a-f0-9]+: f3 88 01 xrelease mov BYTE PTR \[rcx\],al > +[ ]*[a-f0-9]+: f3 88 04 25 78 56 34 12 xrelease mov BYTE PTR (ds:)?0x12345678,al > +[ ]*[a-f0-9]+: 67 f3 88 04 25 21 43 65 87 xrelease mov BYTE PTR \[eiz\*1\+0x87654321\],al > [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[rcx\],al > [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[rcx\],al > [ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or BYTE PTR \[rcx\],al > @@ -476,6 +478,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and WORD PTR \[rcx\],ax > [ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and WORD PTR \[rcx\],ax > [ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov WORD PTR \[rcx\],ax > +[ ]*[a-f0-9]+: 66 f3 89 04 25 78 56 34 12 xrelease mov WORD PTR (ds:)?0x12345678,ax > +[ ]*[a-f0-9]+: 67 66 f3 89 04 25 21 43 65 87 xrelease mov WORD PTR \[eiz\*1\+0x87654321\],ax > [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[rcx\],ax > [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[rcx\],ax > [ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or WORD PTR \[rcx\],ax > @@ -527,6 +531,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and DWORD PTR \[rcx\],eax > [ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and DWORD PTR \[rcx\],eax > [ ]*[a-f0-9]+: f3 89 01 xrelease mov DWORD PTR \[rcx\],eax > +[ ]*[a-f0-9]+: f3 89 04 25 78 56 34 12 xrelease mov DWORD PTR (ds:)?0x12345678,eax > +[ ]*[a-f0-9]+: 67 f3 89 04 25 21 43 65 87 xrelease mov DWORD PTR \[eiz\*1\+0x87654321\],eax > [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[rcx\],eax > [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[rcx\],eax > [ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or DWORD PTR \[rcx\],eax > @@ -578,6 +584,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 48 21 01 lock xacquire and QWORD PTR \[rcx\],rax > [ ]*[a-f0-9]+: f0 f3 48 21 01 lock xrelease and QWORD PTR \[rcx\],rax > [ ]*[a-f0-9]+: f3 48 89 01 xrelease mov QWORD PTR \[rcx\],rax > +[ ]*[a-f0-9]+: f3 48 89 04 25 78 56 34 12 xrelease mov QWORD PTR (ds:)?0x12345678,rax > +[ ]*[a-f0-9]+: 67 f3 48 89 04 25 21 43 65 87 xrelease mov QWORD PTR \[eiz\*1\+0x87654321\],rax > [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or QWORD PTR \[rcx\],rax > [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or QWORD PTR \[rcx\],rax > [ ]*[a-f0-9]+: f3 f0 48 09 01 xrelease lock or QWORD PTR \[rcx\],rax > --- a/gas/testsuite/gas/i386/x86-64-hle.d > +++ b/gas/testsuite/gas/i386/x86-64-hle.d > @@ -424,6 +424,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and %al,\(%rcx\) > [ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and %al,\(%rcx\) > [ ]*[a-f0-9]+: f3 88 01 xrelease mov %al,\(%rcx\) > +[ ]*[a-f0-9]+: f3 88 04 25 78 56 34 12 xrelease mov %al,0x12345678 > +[ ]*[a-f0-9]+: 67 f3 88 04 25 21 43 65 87 xrelease mov %al,0x87654321\(,%eiz,1\) > [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%rcx\) > [ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%rcx\) > [ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or %al,\(%rcx\) > @@ -475,6 +477,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and %ax,\(%rcx\) > [ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and %ax,\(%rcx\) > [ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov %ax,\(%rcx\) > +[ ]*[a-f0-9]+: 66 f3 89 04 25 78 56 34 12 xrelease mov %ax,0x12345678 > +[ ]*[a-f0-9]+: 67 66 f3 89 04 25 21 43 65 87 xrelease mov %ax,0x87654321\(,%eiz,1\) > [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%rcx\) > [ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%rcx\) > [ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or %ax,\(%rcx\) > @@ -526,6 +530,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and %eax,\(%rcx\) > [ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and %eax,\(%rcx\) > [ ]*[a-f0-9]+: f3 89 01 xrelease mov %eax,\(%rcx\) > +[ ]*[a-f0-9]+: f3 89 04 25 78 56 34 12 xrelease mov %eax,0x12345678 > +[ ]*[a-f0-9]+: 67 f3 89 04 25 21 43 65 87 xrelease mov %eax,0x87654321\(,%eiz,1\) > [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%rcx\) > [ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%rcx\) > [ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or %eax,\(%rcx\) > @@ -577,6 +583,8 @@ Disassembly of section .text: > [ ]*[a-f0-9]+: f0 f2 48 21 01 lock xacquire and %rax,\(%rcx\) > [ ]*[a-f0-9]+: f0 f3 48 21 01 lock xrelease and %rax,\(%rcx\) > [ ]*[a-f0-9]+: f3 48 89 01 xrelease mov %rax,\(%rcx\) > +[ ]*[a-f0-9]+: f3 48 89 04 25 78 56 34 12 xrelease mov %rax,0x12345678 > +[ ]*[a-f0-9]+: 67 f3 48 89 04 25 21 43 65 87 xrelease mov %rax,0x87654321\(,%eiz,1\) > [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or %rax,\(%rcx\) > [ ]*[a-f0-9]+: f2 f0 48 09 01 xacquire lock or %rax,\(%rcx\) > [ ]*[a-f0-9]+: f3 f0 48 09 01 xrelease lock or %rax,\(%rcx\) > --- a/gas/testsuite/gas/i386/x86-64-hle.s > +++ b/gas/testsuite/gas/i386/x86-64-hle.s > @@ -442,6 +442,8 @@ _start: > .byte 0xf0; .byte 0xf2; andb %al,(%rcx) > .byte 0xf0; .byte 0xf3; andb %al,(%rcx) > xrelease movb %al,(%rcx) > + xrelease movb %al,0x12345678 > + xrelease addr32 movb %al,0x87654321 > xacquire lock orb %al,(%rcx) > lock xacquire orb %al,(%rcx) > xrelease lock orb %al,(%rcx) > @@ -496,6 +498,8 @@ _start: > .byte 0xf0; .byte 0xf2; andw %ax,(%rcx) > .byte 0xf0; .byte 0xf3; andw %ax,(%rcx) > xrelease movw %ax,(%rcx) > + xrelease movw %ax,0x12345678 > + xrelease addr32 movw %ax,0x87654321 > xacquire lock orw %ax,(%rcx) > lock xacquire orw %ax,(%rcx) > xrelease lock orw %ax,(%rcx) > @@ -550,6 +554,8 @@ _start: > .byte 0xf0; .byte 0xf2; andl %eax,(%rcx) > .byte 0xf0; .byte 0xf3; andl %eax,(%rcx) > xrelease movl %eax,(%rcx) > + xrelease movl %eax,0x12345678 > + xrelease addr32 movl %eax,0x87654321 > xacquire lock orl %eax,(%rcx) > lock xacquire orl %eax,(%rcx) > xrelease lock orl %eax,(%rcx) > @@ -604,6 +610,8 @@ _start: > .byte 0xf0; .byte 0xf2; andq %rax,(%rcx) > .byte 0xf0; .byte 0xf3; andq %rax,(%rcx) > xrelease movq %rax,(%rcx) > + xrelease movq %rax,0x12345678 > + xrelease addr32 movq %rax,0x87654321 > xacquire lock orq %rax,(%rcx) > lock xacquire orq %rax,(%rcx) > xrelease lock orq %rax,(%rcx) > OK. Thanks. -- H.J.