public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids
@ 2022-04-02 18:43 vsevolod.livinskiy at gmail dot com
  2022-04-04  7:23 ` [Bug target/105139] [12 Regression] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vsevolod.livinskiy at gmail dot com @ 2022-04-02 18:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

            Bug ID: 105139
           Summary: GCC produces vmovw instruction with an incorrect
                    argument for -O3 -march=sapphirerapids
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskiy at gmail dot com
  Target Milestone: ---

Link to the Compiler Explorer: https://godbolt.org/z/9GTPqWfn8

It looks like GCC produced vmovw instruction with an incorrect argument
(https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html)

Reproducer:
extern long c[];
extern int d[];
long a;
long e(long f) { return f < a ? f : a; }
void g() {
  for (signed b = 0; b < 4028643; b++)
    d[b] = e((char)(~c[b]));
}

Error:
>$ g++ -O3 -march=sapphirerapids -c func.cpp
/tmp/ccB2zLYr.s: Assembler messages:
/tmp/ccB2zLYr.s:92: Error: operand type mismatch for `vmovw'

gcc version 12.0.1 20220401 (git://gcc.gnu.org/git/gcc.git:master
15d683d4f0b390b27c54a7c92c6e4f33195bdc93)

P.S. I'm not sure if "tree-optimization" is the correct classification for this
fault

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
@ 2022-04-04  7:23 ` rguenth at gcc dot gnu.org
  2022-04-04  9:12 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-04  7:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2022-04-04
     Ever confirmed|0                           |1
             Target|X86_64                      |x86_64-*-*

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
it works for me, it produces

        vmovw   %xmm0, %xmm1

what assembler version are you using?  I have 2.37

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
  2022-04-04  7:23 ` [Bug target/105139] [12 Regression] " rguenth at gcc dot gnu.org
@ 2022-04-04  9:12 ` marxin at gcc dot gnu.org
  2022-04-04  9:25 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-04  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
It's rejected with 2.38:

$ as -v --64 -o a-pr105139.o a-pr105139.s
GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU Binutils;
openSUSE Tumbleweed) 2.38.20220304-3
a-pr105139.s: Assembler messages:
a-pr105139.s:92: Error: operand type mismatch for `vmovw'

Let me bisect GAS.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
  2022-04-04  7:23 ` [Bug target/105139] [12 Regression] " rguenth at gcc dot gnu.org
  2022-04-04  9:12 ` marxin at gcc dot gnu.org
@ 2022-04-04  9:25 ` marxin at gcc dot gnu.org
  2022-04-04  9:27 ` [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4 marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-04  9:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
@Richi: Are you sure about that your GAS supports that?

$ cat vmovw.s
vmovw   %xmm0, %xmm1
$ as -v --64 vmovw.s
GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU Binutils;
openSUSE Tumbleweed) 2.38.20220304-3
vmovw.s: Assembler messages:
vmovw.s:1: Error: operand type mismatch for `vmovw'

$ ./gas/as-new /home/marxin/Programming/testcases/vmovw.s -v
GNU assembler version 2.37 (x86_64-pc-linux-gnu) using BFD version (GNU
Binutils) 2.37
/home/marxin/Programming/testcases/vmovw.s: Assembler messages:
/home/marxin/Programming/testcases/vmovw.s:1: Error: no such instruction:
`vmovw %xmm0,%xmm1'

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
                   ` (2 preceding siblings ...)
  2022-04-04  9:25 ` marxin at gcc dot gnu.org
@ 2022-04-04  9:27 ` marxin at gcc dot gnu.org
  2022-04-04 10:52 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-04  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Summary|[12 Regression] GCC         |[12 Regression] GCC
                   |produces vmovw instruction  |produces vmovw instruction
                   |with an incorrect argument  |with an incorrect argument
                   |for -O3                     |for -O3
                   |-march=sapphirerapids       |-march=sapphirerapids since
                   |                            |r12-6215-g708b87dcb6e48cb4
                 CC|                            |uros at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-6215-g708b87dcb6e48cb4.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
                   ` (3 preceding siblings ...)
  2022-04-04  9:27 ` [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4 marxin at gcc dot gnu.org
@ 2022-04-04 10:52 ` rguenth at gcc dot gnu.org
  2022-04-04 11:58 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-04 10:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #3)
> @Richi: Are you sure about that your GAS supports that?
> 
> $ cat vmovw.s
> vmovw	%xmm0, %xmm1
> $ as -v --64 vmovw.s
> GNU assembler version 2.38 (x86_64-suse-linux) using BFD version (GNU
> Binutils; openSUSE Tumbleweed) 2.38.20220304-3
> vmovw.s: Assembler messages:
> vmovw.s:1: Error: operand type mismatch for `vmovw'
> 
> $ ./gas/as-new /home/marxin/Programming/testcases/vmovw.s -v
> GNU assembler version 2.37 (x86_64-pc-linux-gnu) using BFD version (GNU
> Binutils) 2.37
> /home/marxin/Programming/testcases/vmovw.s: Assembler messages:
> /home/marxin/Programming/testcases/vmovw.s:1: Error: no such instruction:
> `vmovw %xmm0,%xmm1'

oops, I forgot to actually assemble the output

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
                   ` (4 preceding siblings ...)
  2022-04-04 10:52 ` rguenth at gcc dot gnu.org
@ 2022-04-04 11:58 ` ubizjak at gmail dot com
  2022-04-05 19:04 ` cvs-commit at gcc dot gnu.org
  2022-04-05 19:07 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2022-04-04 11:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
*movv2qi_internal was not fixed in the same way as *movhi_internal, so:

diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 29d470bdef2..197f19e4b1a 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -462,7 +462,7 @@
                    (const_string "TI"))
            (eq_attr "alternative" "5")
              (cond [(match_test "TARGET_AVX512FP16")
-                      (const_string "HI")
+                      (const_string "HF")
                     (match_test "TARGET_AVX")
                       (const_string "TI")
                     (ior (not (match_test "TARGET_SSE2"))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
                   ` (5 preceding siblings ...)
  2022-04-04 11:58 ` ubizjak at gmail dot com
@ 2022-04-05 19:04 ` cvs-commit at gcc dot gnu.org
  2022-04-05 19:07 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-05 19:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

https://gcc.gnu.org/g:cbc9dd66484a51d450f78ab748a872b939c90c3f

commit r12-8004-gcbc9dd66484a51d450f78ab748a872b939c90c3f
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Tue Apr 5 21:03:18 2022 +0200

    i386: Fix movv2qi_internal xmm reg to xmm reg move for AVX512FP16
[PR105139]

    2022-04-05  Uroš Bizjak  <ubizjak@gmail.com>

    gcc/ChangeLog:

            PR target/105139
            * config/i386/mmx.md (*movv2qi_internal):
            Change insn mode of alternative 5 to HF for TARGET_AVX512FP16.

    gcc/testsuite/ChangeLog:

            PR target/105139
            * gcc.target/i386/pr105139.c: New test.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4
  2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
                   ` (6 preceding siblings ...)
  2022-04-05 19:04 ` cvs-commit at gcc dot gnu.org
@ 2022-04-05 19:07 ` ubizjak at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2022-04-05 19:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105139

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|uros at gcc dot gnu.org            |
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-05 19:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02 18:43 [Bug tree-optimization/105139] New: GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids vsevolod.livinskiy at gmail dot com
2022-04-04  7:23 ` [Bug target/105139] [12 Regression] " rguenth at gcc dot gnu.org
2022-04-04  9:12 ` marxin at gcc dot gnu.org
2022-04-04  9:25 ` marxin at gcc dot gnu.org
2022-04-04  9:27 ` [Bug target/105139] [12 Regression] GCC produces vmovw instruction with an incorrect argument for -O3 -march=sapphirerapids since r12-6215-g708b87dcb6e48cb4 marxin at gcc dot gnu.org
2022-04-04 10:52 ` rguenth at gcc dot gnu.org
2022-04-04 11:58 ` ubizjak at gmail dot com
2022-04-05 19:04 ` cvs-commit at gcc dot gnu.org
2022-04-05 19:07 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).