]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: FMA insns aren't eligible to VEX2 encoding
authorJan Beulich <jbeulich@suse.com>
Tue, 9 Jan 2024 12:49:48 +0000 (13:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 9 Jan 2024 12:49:48 +0000 (13:49 +0100)
PR gas/31178

In da0784f961d8 ("x86: fold FMA VEX and EVEX templates") I overlooked
that C aliases StaticRounding, and hence build_vex_prefix() now needs to
be aware of that aliasing. Disambiguation is easy, as StaticRounding is
only ever used together with SAE (hence why the overlaying works in the
first place).

gas/config/tc-i386.c
gas/testsuite/gas/i386/x86-64-optimize-2.d
gas/testsuite/gas/i386/x86-64-optimize-2.s
gas/testsuite/gas/i386/x86-64-optimize-2a.d
gas/testsuite/gas/i386/x86-64-optimize-2b.d
gas/testsuite/gas/i386/x86-64-optimize-2c.d
gas/testsuite/gas/i386/x86-64-optimize-5.d
gas/testsuite/gas/i386/x86-64-optimize-6.d

index 27d0742c6c88f380623954332b5aca788fa211ae..f7276c12c52cf4b1169d0f98e2fc0db5c0df5587 100644 (file)
@@ -3801,6 +3801,8 @@ build_vex_prefix (const insn_template *t)
       && i.reg_operands == i.operands - i.imm_operands
       && i.tm.opcode_modifier.vex
       && i.tm.opcode_modifier.commutative
+      /* .commutative aliases .staticrounding; disambiguate.  */
+      && !i.tm.opcode_modifier.sae
       && (i.tm.opcode_modifier.sse2avx
          || (optimize > 1 && !i.no_optimize))
       && i.rex == REX_B
index 87bf3edfbaa1d028e363a7fa86bc2edc01f36674..518b5c0b2e5b1d4ae3217d5c83cf136e879933cd 100644 (file)
@@ -222,4 +222,5 @@ Disassembly of section .text:
  +[a-f0-9]+:   66 .*   pxor   %xmm12,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
 #pass
index 1d1b8e147825d2f8f654393535001debd887d66b..b20b795809aa390642122930b2990ebd82c08322 100644 (file)
@@ -248,3 +248,6 @@ _start:
        pcmpgtq         %xmm12, %xmm12
        vpcmpgtq        %xmm2, %xmm2, %xmm8
        vpcmpgtq        %ymm12, %ymm12, %ymm1
+
+       # PR gas/31178
+       vfnmadd231sd    %xmm9, %xmm2, %xmm0
index f12507b8f55394a84c9d7fc0aa74fa58ed8bb4f4..b42b1ad4a77fceede228ae080d21c249c554adf3 100644 (file)
@@ -223,4 +223,5 @@ Disassembly of section .text:
  +[a-f0-9]+:   66 .*   pxor   %xmm12,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
 #pass
index e572491a9da733b3ab51905ad25d92f01c4a80b9..2d21eccef34d4cf2db53e3c8c9f13c7c4d302990 100644 (file)
@@ -222,4 +222,5 @@ Disassembly of section .text:
  +[a-f0-9]+:   66 .*   pxor   %xmm12,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
 #pass
index 73a50a35b74a4432d1f588f3060fd14d7df726df..7523149dbc9a713d4eb366bc4f35fc898eee1822 100644 (file)
@@ -223,4 +223,5 @@ Disassembly of section .text:
  +[a-f0-9]+:   c5 .*   vpxor  %xmm0,%xmm0,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
 #pass
index 5b272aa0945ee7d3f9e1fe27f98e720670d01dd2..837edc7699c04e213de3692d0908420cc0f8e9cb 100644 (file)
@@ -222,6 +222,7 @@ Disassembly of section .text:
  +[a-f0-9]+:   66 .*   pxor   %xmm12,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
  +[a-f0-9]+:   62 f1 f5 08 55 e9       \{evex\} vandnpd %xmm1,%xmm1,%xmm5
  +[a-f0-9]+:   62 f1 f5 08 55 e9       \{evex\} vandnpd %xmm1,%xmm1,%xmm5
  +[a-f0-9]+:   62 f1 7d 28 6f d1       vmovdqa32 %ymm1,%ymm2
index 48105c3063e42f4a7f6c05d400ed0faf0867b5dd..809717454d4f2f3e4d07ba485cc0213cd498f3d8 100644 (file)
@@ -222,6 +222,7 @@ Disassembly of section .text:
  +[a-f0-9]+:   66 .*   pxor   %xmm12,%xmm12
  +[a-f0-9]+:   c5 .*   vpxor  %xmm2,%xmm2,%xmm8
  +[a-f0-9]+:   c5 .*   vpxor  %ymm0,%ymm0,%ymm1
+ +[a-f0-9]+:   c4 .*   vfnmadd231sd %xmm9,%xmm2,%xmm0
  +[a-f0-9]+:   62 f1 f5 08 55 e9       \{evex\} vandnpd %xmm1,%xmm1,%xmm5
  +[a-f0-9]+:   62 f1 f5 08 55 e9       \{evex\} vandnpd %xmm1,%xmm1,%xmm5
  +[a-f0-9]+:   62 f1 7d 28 6f d1       vmovdqa32 %ymm1,%ymm2