public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* subreg vs vec_select
@ 2020-09-09  9:50 Ilya Leoshkevich
  2020-09-09 21:09 ` Segher Boessenkool
  0 siblings, 1 reply; 9+ messages in thread
From: Ilya Leoshkevich @ 2020-09-09  9:50 UTC (permalink / raw)
  To: gcc

Hi!

I have a vector pseudo containing a single 128-bit value (V1TFmode) and
I need to access its last 64 bits (DFmode). Which of the two options
is better?

(subreg:DF (reg:V1TF) 8)

or

(vec_select:DF (subreg:V2DF (reg:V1TF) 0) (parallel [(const_int 1)]))

If I use the first one, I run into a problem with set_noop_p (): it
thinks that

(set (subreg:DF (reg:TF %f0) 8) (subreg:DF (reg:V1TF %f0) 8))

is a no-op, because it doesn't check the mode after stripping the
subreg:

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/rtlanal.c;h=5ae38b79#l1616

However this is not correct, because SET_DEST is the second register in
a register pair, and SET_SRC is half of a vector register that overlaps
the first register in the corresponding pair. So it looks as if mode
needs to be considered there.

This helps:

--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1619,6 +1619,8 @@ set_noop_p (const_rtx set)
        return 0;
       src = SUBREG_REG (src);
       dst = SUBREG_REG (dst);
+      if (GET_MODE (src) != GET_MODE (dst))
+       return 0;
     }

but I'm not sure whether I'm not missing something about subreg
semantics in the first place.

Best regards,
Ilya


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

end of thread, other threads:[~2020-09-11 14:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  9:50 subreg vs vec_select Ilya Leoshkevich
2020-09-09 21:09 ` Segher Boessenkool
2020-09-10 10:21   ` Ilya Leoshkevich
2020-09-10 22:30     ` Segher Boessenkool
2020-09-11  9:46     ` Richard Sandiford
2020-09-11 10:17       ` Ilya Leoshkevich
2020-09-11 10:22         ` Ilya Leoshkevich
2020-09-11 11:14           ` Richard Sandiford
2020-09-11 14:27             ` Ilya Leoshkevich

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