public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Qing Zhao <qing.zhao@oracle.com>
To: David Miller <davem@davemloft.net>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/1] sparc: support for -mmisalign in the SPARC M8
Date: Thu, 03 Aug 2017 15:37:00 -0000	[thread overview]
Message-ID: <4F455D43-8D8D-41B1-A9DF-5BDBD238D04E@oracle.com> (raw)
In-Reply-To: <B127A3FC-92FA-4315-992B-2D8A3B363F02@oracle.com>

To be more specified,  when reading all the codes corresponding to “STRICT_ALIGNMENT” and “SLOW_UNALIGNMENT_ACCESS” in gcc
(NOTE, SLOW_UNALIGNMENT_ACCESS is the same as STRICT_ALIGNMENT when it is NOT defined explicitly, this is the case for SPARC)

We can get the following summary: 

all the special handling on STRICT_ALIGNMENT or SLOW_UNALIGNMENT_ACCESS in these codes have the following common logic:

if the memory access is known to be not-aligned well during compilation time, if the targeted platform does NOT support faster unaligned memory
access,  the compiler will try to make the memory access aligned well. Otherwise, if the targeted platform supports faster unaligned memory access,
 it will leave the compiler-time known not-aligned memory access as it, later the hardware support will kicked in for these unaligned memory access. 

this behavior is consistent with the high level definition of STRICT_ALIGNMENT. 

And also consistent with the M8 misaligned support:

if the target is NOT TARGET_MISALIGN,  STRICT_ALIGNMENT is 1,  all the compiler-time known misaligned memory accesses are adjusted to
aligned memory access before RTL generation;
on the other hand, if the target is TARGET_MISALIGN, STRICT_ALIGNMENT is 0,  the compiler-time known misaligned memory accesses are NOT
adjusted,  after RTL generation, we will have compiler-time known misaligned memory access, we can use the new misaligned ld/st hardware insns to 
support these compiler-time known misaligned memory access. 

hope this is clear.

thanks.

Qing


>> 
>> Why don't you read the code rather than just relying upon what
>> high level description is given by the documentation instead?
> 
> I read the codes before making the change, that’s the reason I ask you to specify clearly the bad side effect that I didn’t considered yet.
> 
> thanks.
> 
> Qing

  reply	other threads:[~2017-08-03 15:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <SPARC_MISALIGN_PATCH>
2017-08-02 15:28 ` qinzhao
2017-08-02 16:43   ` David Miller
2017-08-02 20:16     ` Qing Zhao
     [not found]     ` <A872C63E-CC39-4E10-84D7-D1CAB7E72716@oracle.com>
2017-08-02 23:17       ` David Miller
2017-08-03 13:44         ` Qing Zhao
2017-08-03 15:37           ` Qing Zhao [this message]
2017-08-03 16:41             ` David Miller
2017-08-03 18:49               ` Qing Zhao
2017-09-06 19:41                 ` Qing Zhao

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=4F455D43-8D8D-41B1-A9DF-5BDBD238D04E@oracle.com \
    --to=qing.zhao@oracle.com \
    --cc=davem@davemloft.net \
    --cc=gcc-patches@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).