public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95443] New: cmpstrnqi patterns update string length
@ 2020-05-30 21:58 hjl.tools at gmail dot com
  2020-07-13 17:34 ` [Bug target/95443] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-30 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95443
           Summary: cmpstrnqi patterns update string length
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: crazylht at gmail dot com, hubicka at ucw dot cz, ubizjak at gmail dot com
  Target Milestone: ---
            Target: i386,x86-64

We have

 countreg = ix86_zero_extend_to_Pmode (operands[3]);

  /* %%% Iff we are testing strict equality, we can use known alignment
     to good advantage.  This may be possible with combine, particularly
     once cc0 is dead.  */
  align = operands[4]; 

  if (CONST_INT_P (operands[3]))
    {
      if (operands[3] == const0_rtx)
        {   
          emit_move_insn (operands[0], const0_rtx);
          DONE;
        }
      emit_insn (gen_cmpstrnqi_nz_1 (addr1, addr2, countreg, align,
                                     operands[1], operands[2]));
    }
  else    
    {
      emit_insn (gen_cmp_1 (Pmode, countreg, countreg));
      emit_insn (gen_cmpstrnqi_1 (addr1, addr2, countreg, align,
                                  operands[1], operands[2]));
    }

cmpstrnqi patterns updates countreg to 0, wich can lead to wrong codes.

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

* [Bug target/95443] cmpstrnqi patterns update string length
  2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
@ 2020-07-13 17:34 ` cvs-commit at gcc dot gnu.org
  2020-07-13 17:35 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-13 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:9cba898481368ce16c6a2d30ef781a82dce27c55

commit r11-2068-g9cba898481368ce16c6a2d30ef781a82dce27c55
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 13 10:33:47 2020 -0700

    x86: Pass a copy of the string length to cmpstrnqi

    cmpstrnsi expander may pass the actual string length directly to cmpstrnqi
    patterns.  For cmpstrnsi, one of the strings must be a constant and
    expand_builtin_strncmp rewrites the length argument to be the minimum of
    the const string length and the actual string length.  But it is not the
    case for cmpmemsi.  Pass a copy of the string length to cmpstrnqi patterns
    to avoid changing the actual string length by cmpstrnqi patterns.

    gcc/

            PR target/95443
            * config/i386/i386.md (cmpstrnsi): Pass a copy of the string
            length to cmpstrnqi patterns.

    gcc/testsuite/

            PR target/95443
            * gcc.target/i386/pr95443-1.c: New test.
            * gcc.target/i386/pr95443-2.c: Likewise.

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

* [Bug target/95443] cmpstrnqi patterns update string length
  2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
  2020-07-13 17:34 ` [Bug target/95443] " cvs-commit at gcc dot gnu.org
@ 2020-07-13 17:35 ` hjl.tools at gmail dot com
  2020-07-14 19:10 ` ro at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-07-13 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11.

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

* [Bug target/95443] cmpstrnqi patterns update string length
  2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
  2020-07-13 17:34 ` [Bug target/95443] " cvs-commit at gcc dot gnu.org
  2020-07-13 17:35 ` hjl.tools at gmail dot com
@ 2020-07-14 19:10 ` ro at gcc dot gnu.org
  2020-07-14 21:04 ` cvs-commit at gcc dot gnu.org
  2020-07-14 21:08 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ro at gcc dot gnu.org @ 2020-07-14 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-07-14
             Status|RESOLVED                    |REOPENED
     Ever confirmed|0                           |1
                 CC|                            |ro at gcc dot gnu.org
         Resolution|FIXED                       |---

--- Comment #3 from Rainer Orth <ro at gcc dot gnu.org> ---
One of the new tests FAILs on Solaris/x86 (and most likely all non-glibc
targets):

+FAIL: gcc.target/i386/pr95443-1.c (test for excess errors)
+UNRESOLVED: gcc.target/i386/pr95443-1.c compilation failed to produce
executable

Excess errors:
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr95443-1.c:52:11:
warning: implicit declaration of function '__glibc_unlikely'
[-Wimplicit-function-declaration]
Undefined                       first referenced
 symbol                             in file
__glibc_unlikely                    /var/tmp//ccMfX1cc.o
ld: fatal: symbol referencing errors

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

* [Bug target/95443] cmpstrnqi patterns update string length
  2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2020-07-14 19:10 ` ro at gcc dot gnu.org
@ 2020-07-14 21:04 ` cvs-commit at gcc dot gnu.org
  2020-07-14 21:08 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-14 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:b2984e5ada65f417e8704d2e1e81ccd0272b5eb3

commit r11-2098-gb2984e5ada65f417e8704d2e1e81ccd0272b5eb3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 14 14:01:51 2020 -0700

    x86: Replace __glibc_unlikely with __builtin_expect

    Replace glibc specific __glibc_unlikely with __builtin_expect.

            PR target/95443
            * gcc.target/i386/pr95443-1.c (simple_strstr): Replace
            __glibc_unlikely with __builtin_expect.

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

* [Bug target/95443] cmpstrnqi patterns update string length
  2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2020-07-14 21:04 ` cvs-commit at gcc dot gnu.org
@ 2020-07-14 21:08 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-07-14 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

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

end of thread, other threads:[~2020-07-14 21:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 21:58 [Bug target/95443] New: cmpstrnqi patterns update string length hjl.tools at gmail dot com
2020-07-13 17:34 ` [Bug target/95443] " cvs-commit at gcc dot gnu.org
2020-07-13 17:35 ` hjl.tools at gmail dot com
2020-07-14 19:10 ` ro at gcc dot gnu.org
2020-07-14 21:04 ` cvs-commit at gcc dot gnu.org
2020-07-14 21:08 ` hjl.tools at gmail dot com

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