public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/98172] Update -mtune=generic for the current Intel and AMD processors
Date: Thu, 21 Jan 2021 01:55:23 +0000	[thread overview]
Message-ID: <bug-98172-4-feJGUcZijl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98172-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Hongtao.liu from comment #9)
> > .L3:
> > 	vmovupd	(%rcx,%rax), %xmm3
> > 	vmovupd	(%rsi,%rax), %xmm4
> > 	vinsertf128	$0x1, 16(%rcx,%rax), %ymm3, %ymm0
> > 	vinsertf128	$0x1, 16(%rsi,%rax), %ymm4, %ymm2
> > 	vmovupd	(%rdi,%rax), %xmm5
> > 	vinsertf128	$0x1, 16(%rdi,%rax), %ymm5, %ymm1
> > 	vfmadd132pd	%ymm2, %ymm1, %ymm0
> > 	vmovupd	%xmm0, (%rdx,%rax)
> > 	vextractf128	$0x1, %ymm0, 16(%rdx,%rax)
> > 	addq	$32, %rax
> > 	cmpq	$2048, %rax
> > 	jne	.L3
> > 	vzeroupper
> > 	ret
> 
> The kernel loop could be better as
>  
> .L3:
> 	vmovupd	(%rcx,%rax), %ymm0
> 	vmovupd	(%rdi,%rax), %ymm1
> 	vfmadd132pd	(%rsi,%rax), %ymm1, %ymm0
> 	vmovupd	%ymm0, (%rdx,%rax)
> 	addq	$32, %rax
> 	cmpq	$2048, %rax
> 	jne	.L3

It went into movmisalign<mode>, and finally be splitted into parts by
ix86_avx256_split_vector_move_misalign, and the differences between
-mtune=generic and -mtune=haswell matters here is
X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL and
X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL

-------
/* X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL: if false, unaligned loads are
   split.  */
DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL, "256_unaligned_load_optimal",
          ~(m_NEHALEM | m_SANDYBRIDGE | m_GENERIC))

/* X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL: if false, unaligned stores are
   split.  */
DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL,
"256_unaligned_store_optimal",
          ~(m_NEHALEM | m_SANDYBRIDGE | m_BDVER | m_ZNVER1 | m_GENERIC))
--------

manually adding two tunes to generic
gcc -S -O3 y.c -mavx2 -mfma
-mtune-ctrl="256_unaligned_load_optimal,256_unaligned_store_optimal"
successfully generate optimial codes.

.L3:
        vmovupd (%rcx,%rax), %ymm0
        vmovupd (%rdi,%rax), %ymm1
        vfmadd132pd     (%rsi,%rax), %ymm1, %ymm0
        vmovupd %ymm0, (%rdx,%rax)
        addq    $32, %rax
        cmpq    $2048, %rax
        jne     .L3
        vzeroupper
        ret
.L5:

  parent reply	other threads:[~2021-01-21  1:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 13:01 [Bug target/98172] New: " hjl.tools at gmail dot com
2020-12-07 13:03 ` [Bug target/98172] " hubicka at gcc dot gnu.org
2020-12-07 13:12 ` hjl.tools at gmail dot com
2020-12-07 14:08 ` rguenth at gcc dot gnu.org
2020-12-07 14:08 ` hubicka at ucw dot cz
2020-12-07 14:10 ` hubicka at ucw dot cz
2020-12-07 14:44 ` hjl.tools at gmail dot com
2020-12-07 14:50 ` hjl.tools at gmail dot com
2021-01-20 23:09 ` hjl.tools at gmail dot com
2021-01-21  1:38 ` crazylht at gmail dot com
2021-01-21  1:55 ` crazylht at gmail dot com [this message]
2021-02-05  1:58 ` cvs-commit at gcc dot gnu.org
2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2022-04-21  7:48 ` rguenth at gcc dot gnu.org
2023-05-29 10:03 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98172-4-feJGUcZijl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).