public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386] Fix wrong instruction vpcmpeqd generation
@ 2017-11-24 16:15 Shalnov, Sergey
  2017-12-01  6:25 ` Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: Shalnov, Sergey @ 2017-11-24 16:15 UTC (permalink / raw)
  To: 'gcc-patches@gcc.gnu.org'
  Cc: 'kirill.yukhin@gmail.com',
	Koval, Julia, Senkevich, Andrew, Peryt, Sebastian, Ivchenko,
	Alexander, 'Uros Bizjak'

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Hi,
I found wrong vpcmpeqd instruction form generated in case of
"-march=skylake-avx512 -mprefer-vector-width=128" options set

The compiler emits following error at compile stage:
	Error: invalid register operand for `vpcmpeqd'

Because following was generated:
	vpcmpeqd %xmm16, %xmm16, %xmm16

In this form the instruction can use zmm0-xmm15 registers only.


2017-11-24  Sergey Shalnov  <Sergey.Shalnov@intel.com>
gcc/
	* config/i386/i386.c (standard_sse_constant_opcode):
	Fix wrong form for vpcmpeqd instruction


[-- Attachment #2: 0008-Wrong-instruction-vpcmpeqd-generation.patch --]
[-- Type: application/octet-stream, Size: 895 bytes --]

From 536010a8b75f1b529ea2cd17ca1f54ff1e41fd9e Mon Sep 17 00:00:00 2001
From: Sergey Shalnov <Sergey.Shalnov@intel.com>
Date: Fri, 24 Nov 2017 18:26:03 +0300
Subject: [PATCH 1/1] Wrong instruction vpcmpeqd generation

---
 gcc/config/i386/i386.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7bd518b..011a8be 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10443,9 +10443,11 @@ standard_sse_constant_opcode (rtx_insn *insn, rtx x)
 	case MODE_V2DF:
 	case MODE_V4SF:
 	  gcc_assert (TARGET_SSE2);
-	  return (TARGET_AVX
-		  ? "vpcmpeqd\t%0, %0, %0"
-		  : "pcmpeqd\t%0, %0");
+	  return (TARGET_AVX512F
+		  ? "vpternlogd\t{$0xFF, %0, %0, %0|%0, %0, %0, 0xFF}"
+		  : TARGET_AVX
+		    ? "vpcmpeqd\t%0, %0, %0"
+		    : "pcmpeqd\t%0, %0");
 
 	default:
 	  gcc_unreachable ();
-- 
1.8.3.1


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

* Re: [PATCH, i386] Fix wrong instruction vpcmpeqd generation
  2017-11-24 16:15 [PATCH, i386] Fix wrong instruction vpcmpeqd generation Shalnov, Sergey
@ 2017-12-01  6:25 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2017-12-01  6:25 UTC (permalink / raw)
  To: Shalnov, Sergey
  Cc: 'gcc-patches@gcc.gnu.org',
	Koval, Julia, Senkevich, Andrew, Peryt, Sebastian, Ivchenko,
	Alexander, 'Uros Bizjak'

Hello Sergey,
On 24 Nov 15:44, Shalnov, Sergey wrote:
> Hi,
> I found wrong vpcmpeqd instruction form generated in case of
> "-march=skylake-avx512 -mprefer-vector-width=128" options set
> 
> The compiler emits following error at compile stage:
> 	Error: invalid register operand for `vpcmpeqd'
> 
> Because following was generated:
> 	vpcmpeqd %xmm16, %xmm16, %xmm16
> 
> In this form the instruction can use zmm0-xmm15 registers only.
> 
> 
> 2017-11-24  Sergey Shalnov  <Sergey.Shalnov@intel.com>
> gcc/
> 	* config/i386/i386.c (standard_sse_constant_opcode):
> 	Fix wrong form for vpcmpeqd instruction
Patch is OK. I've checked it into main trunk.

--
Thanks, K

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

end of thread, other threads:[~2017-12-01  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 16:15 [PATCH, i386] Fix wrong instruction vpcmpeqd generation Shalnov, Sergey
2017-12-01  6:25 ` Kirill Yukhin

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).