public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/107546] New: simd, redundant pcmpeqb and pxor
@ 2022-11-07  6:39 i.nixman at autistici dot org
  2022-11-07  6:51 ` [Bug target/107546] " pinskia at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: i.nixman at autistici dot org @ 2022-11-07  6:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107546
           Summary: simd, redundant pcmpeqb and pxor
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i.nixman at autistici dot org
  Target Milestone: ---

Hello,

this code sample(https://godbolt.org/z/TnGMsfMs6):
```
#include <x86intrin.h>

auto foo(const char *p) {
    const auto substr = _mm_loadu_si128((const __m128i *)p);
    return _mm_cmplt_epi8(substr, _mm_set1_epi8('0'));
}

```
produces the following ASM code:
```
1: foo(char const*):
2:    movdqu  xmm0, XMMWORD PTR [rdi]
3:    pxor    xmm1, xmm1
4:    pcmpgtb xmm0, XMMWORD PTR .LC0[rip]
5:    pcmpeqb xmm0, xmm1
6:    ret
```
please look at line 5.
is there any reason for `pcmpeqb` and `pxor` instruction?

just for info, clang's output(https://godbolt.org/z/MPnvEMdhr):
```
1: foo(char const*):
2:    movdqu  xmm1, xmmword ptr [rdi]
3:    movdqa  xmm0, xmmword ptr [rip + .LCPI0_0]
4:    pcmpgtb xmm0, xmm1
5:    ret
```

it looks like the issue started at version 9 and up to the current trunk.

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

end of thread, other threads:[~2023-07-07 10:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07  6:39 [Bug rtl-optimization/107546] New: simd, redundant pcmpeqb and pxor i.nixman at autistici dot org
2022-11-07  6:51 ` [Bug target/107546] " pinskia at gcc dot gnu.org
2022-11-07  6:58 ` [Bug target/107546] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-11-07  7:07 ` rguenth at gcc dot gnu.org
2022-11-07  7:07 ` crazylht at gmail dot com
2022-11-07  7:14 ` crazylht at gmail dot com
2022-11-07  7:16 ` glisse at gcc dot gnu.org
2022-11-07  7:20 ` pinskia at gcc dot gnu.org
2022-11-07  8:27 ` crazylht at gmail dot com
2022-11-07 10:22 ` jakub at gcc dot gnu.org
2022-11-07 12:02 ` jakub at gcc dot gnu.org
2022-11-07 12:05 ` i.nixman at autistici dot org
2022-11-07 13:47 ` i.nixman at autistici dot org
2022-11-08 11:24 ` cvs-commit at gcc dot gnu.org
2022-11-08 11:59 ` [Bug target/107546] [10/11/12 " jakub at gcc dot gnu.org
2022-11-10 10:48 ` cvs-commit at gcc dot gnu.org
2023-07-07 10:44 ` [Bug target/107546] [11/12 " rguenth 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).