public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/97249] New: Missing vec_select and subreg optimization
@ 2020-09-30  6:30 crazylht at gmail dot com
  2020-09-30  6:38 ` [Bug rtl-optimization/97249] " crazylht at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2020-09-30  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97249
           Summary: Missing vec_select and subreg optimization
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
                CC: hjl.tools at gmail dot com, wwwhhhyyy333 at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Cat test.c
---
void
foo (unsigned char* p1, unsigned char* p2, short* __restrict p3)
{
    for (int i = 0 ; i != 8; i++)
     p3[i] = p1[i] + p2[i];
     return;
}
---

gcc11 -Ofast -mavx2 test.c  got

---
foo:
.LFB0:
        .cfi_startproc
        vmovq   (%rdi), %xmm0
        vmovq   (%rsi), %xmm1
        vpmovzxbw       %xmm0, %xmm0
        vpmovzxbw       %xmm1, %xmm1
        vpaddw  %xmm1, %xmm0, %xmm0
        vmovdqu %xmm0, (%rdx)
        ret
        .cfi_endproc
---

memory operand doesn't propagate into *vpmovzxbw* because rtl didn't simplify
---
(insn 9 8 10 2 (set (reg:V8HI 92 [ vect__33.6 ])
        (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI (reg:V8QI 91 [
vect__40.5 ]) 0)
                (parallel [
                        (const_int 0 [0])
                        (const_int 1 [0x1])
                        (const_int 2 [0x2])
                        (const_int 3 [0x3])
                        (const_int 4 [0x4])
                        (const_int 5 [0x5])
                        (const_int 6 [0x6])
                        (const_int 7 [0x7])
                    ])))) "test.c":5:16 4638 {sse4_1_zero_extendv8qiv8hi2}
     (expr_list:REG_DEAD (reg:V8QI 91 [ vect__40.5 ])
        (nil)))
--- 

to 

---
(insn 9 8 10 2 (set (reg:V8HI 92 [ vect__33.6 ])
        (zero_extend:V8HI (reg:V8QI 91 [ vect__40.5 ])))) "test.c":5:16 4638
{sse4_1_zero_extendv8qiv8hi2}
     (expr_list:REG_DEAD (reg:V8QI 91 [ vect__40.5 ])
        (nil)))
---

Similar for other vector modes.

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

end of thread, other threads:[~2021-08-21 18:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  6:30 [Bug rtl-optimization/97249] New: Missing vec_select and subreg optimization crazylht at gmail dot com
2020-09-30  6:38 ` [Bug rtl-optimization/97249] " crazylht at gmail dot com
2020-09-30  6:39 ` crazylht at gmail dot com
2020-09-30  6:48 ` rguenth at gcc dot gnu.org
2020-10-12  2:23 ` crazylht at gmail dot com
2020-10-12 14:53 ` segher at gcc dot gnu.org
2020-10-13  1:59 ` crazylht at gmail dot com
2020-10-13  6:08 ` crazylht at gmail dot com
2020-10-22  3:38 ` cvs-commit at gcc dot gnu.org
2020-10-22  3:38 ` crazylht at gmail dot com
2021-08-21 18:28 ` pinskia at gcc dot gnu.org

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