public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: RFC: Representing vector lane load/store operations
Date: Tue, 29 Mar 2011 12:50:00 -0000	[thread overview]
Message-ID: <g47hbiqens.fsf@linaro.org> (raw)
In-Reply-To: <g439mdx5l1.fsf@linaro.org> (Richard Sandiford's message of "Wed,	23 Mar 2011 14:40:58 +0000")

Richard Sandiford <richard.sandiford@linaro.org> writes:
> Richard Guenther <richard.guenther@gmail.com> writes:
>> Well, I meant if the user compiles with -msse, declares such a
>> global var (which means it gets V4SFmode and not BLKmode)
>> and then uses it in a function where he explicitly disables SSE
>> then something is wrong.  If he declares a BLKmode global
>> then generic vector support will happily trigger and make it work.
>
> Ah, OK.  I'm just not sure whether, to take a MIPS example,
> MIPS16 functions in a "-mno-mips16" compile should behave
> differently from unannotated functions in a "-mips16" compile.
>
>> If it's just three element array-of-vector types you need why not expose
>> it via attribute((mode(xyz))) only?  You could alias that mode to BLKmode
>> if neon is not enabled ...
>
> I don't think that really changes anything.  Getting the non-BLK mode
> on the array type seems like the easy part.  The difficult part is
> dealing with the fallout when the array is defined in a Neon context
> and used in a non-Neon context.

As a follow-up to this, I think the current definition of TYPE_MODE
is too restrictive even for the vector case.  Single-element structures
get the modes of their fields, and similarly for arrays.  So if we modify
the original 38240 testcase a bit, we still get a difference:

-------------------------------------------------------------------------
#if STRUCT
typedef struct {
  float x __attribute__ ((__vector_size__ (16), __may_alias__));
} V;
#else
typedef float V __attribute__ ((__vector_size__ (16), __may_alias__));
#endif

V __attribute__((target("sse"))) f(const V *ptr) { return *ptr; }
-------------------------------------------------------------------------

Without -DSTRUCT, this generates the same code regardless of whether
you compile with -msse.  But with -DSTRUCT, you get:

        movaps  (%rdi), %xmm0
        ret

with -msse and:

        movq    (%rdi), %rax
        movq    %rax, -24(%rsp)
        movq    8(%rdi), %rax
        movq    %rax, -16(%rsp)
        movdqa  -24(%rsp), %xmm0
        ret

with -mno-sse.

I think your argument is that most/all uses of TYPE_MODE are a mistake.
But I still think it makes sense to say that types have a natural mode
_in a given context_, just not globally.  So how about replacing it with
a current_mode_of_type function?  That makes it obvious that TYPE_MODE is
not a global property, and that it isn't really a simple accessor any more.
We could then make it recompute the mode for all types, possibly with a
cache if that's necessary for performance reasons.

Richard

  reply	other threads:[~2011-03-29 12:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 16:52 Richard Sandiford
2011-03-22 17:10 ` Richard Guenther
2011-03-22 19:43   ` Richard Sandiford
2011-03-23  9:23     ` Richard Guenther
2011-03-23 10:38       ` Richard Sandiford
2011-03-23 11:52         ` Richard Guenther
2011-03-23 12:18           ` Richard Sandiford
2011-03-23 12:37             ` Richard Guenther
2011-03-23 13:01               ` Richard Sandiford
2011-03-23 13:14                 ` Richard Guenther
2011-03-23 14:14                   ` Richard Sandiford
2011-03-23 14:28                     ` Richard Guenther
2011-03-23 14:41                       ` Richard Sandiford
2011-03-29 12:50                         ` Richard Sandiford [this message]
2011-03-29 14:05                           ` Richard Guenther

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=g47hbiqens.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).