public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function
@ 2015-02-22 16:51 olegendo at gcc dot gnu.org
  2015-02-23 10:57 ` [Bug target/65164] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-02-22 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65164
           Summary: [5 Regression][SH] missed subc in integer sign
                    function
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
            Target: sh*-*-*

These are integer sign functions taken from a book.
For some of them the code got worse after the introduction of the treg_set_expr
stuff.

int signfunc_00 (int x)
{
  return (x >> 31) | ((unsigned int)(-x) >> 31);
}


int signfunc_01 (int x)
{
  return -((unsigned int)x >> 31) | ((unsigned int)(-x) >> 31);
}


int signfunc_02 (int x)
{
  return (x > 0) - (x < 0);
}

4.9:
        cmp/pl  r4
        movt    r0
        shll    r4
        movt    r4
        rts
        sub     r4,r0

trunk:
        mov     r4,r1
        shll    r1
        movt    r1
        cmp/pl  r4
        movt    r0
        rts
        sub     r1,r0


int signfunc_03 (int x)
{
  return (x >= 0) - (x <= 0);
}

4.9:
        cmp/pz  r4
        mov     #0,r1
        movt    r0
        cmp/ge  r4,r1
        rts
        subc    r1,r0

trunk:
        mov     #0,r1
        cmp/ge  r4,r1
        movt    r1
        cmp/pz  r4
        movt    r0
        rts
        sub     r1,r0

It seems that this requires a pattern like

(set (match_operand:SI 0 "arith_reg_dest")
     (minus:SI (match_operand 1 "treg_set_expr")
               (match_operand 2 "treg_set_expr")))


For signfunc_02, combine is looking for the pattern:

Failed to match this instruction:
(set (reg:SI 169 [ D.1518 ])
    (minus:SI (gt:SI (reg/v:SI 168 [ x ])
            (const_int 0 [0]))
        (lshiftrt:SI (reg/v:SI 168 [ x ])
            (const_int 31 [0x1f]))))

For signfunc_03, combine is looking for the pattern:
(set (reg:SI 169 [ D.1522 ])
    (minus:SI (ge:SI (reg:SI 4 r4 [ x ])
            (const_int 0 [0]))
        (le:SI (reg:SI 4 r4 [ x ])
            (const_int 0 [0]))))



On SH, it seems that the insn sequence
        cmp/pz  r4
        mov     #0,r1
        movt    r0
        cmp/ge  r4,r1
        subc    r1,r0

is the best to realize an integer sign function.  So actually all the functions
above should be converted into the same sequence.


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

* [Bug target/65164] [5 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
@ 2015-02-23 10:57 ` rguenth at gcc dot gnu.org
  2015-04-22 12:01 ` [Bug target/65164] [5/6 " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-23 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |5.0


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

* [Bug target/65164] [5/6 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
  2015-02-23 10:57 ` [Bug target/65164] " rguenth at gcc dot gnu.org
@ 2015-04-22 12:01 ` jakub at gcc dot gnu.org
  2015-07-16  9:17 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


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

* [Bug target/65164] [5/6 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
  2015-02-23 10:57 ` [Bug target/65164] " rguenth at gcc dot gnu.org
  2015-04-22 12:01 ` [Bug target/65164] [5/6 " jakub at gcc dot gnu.org
@ 2015-07-16  9:17 ` rguenth at gcc dot gnu.org
  2021-05-14  9:47 ` [Bug target/65164] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug target/65164] [9/10/11/12 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-07-16  9:17 ` rguenth at gcc dot gnu.org
@ 2021-05-14  9:47 ` jakub at gcc dot gnu.org
  2021-06-01  8:06 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug target/65164] [9/10/11/12 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-14  9:47 ` [Bug target/65164] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-06-01  8:06 ` rguenth at gcc dot gnu.org
  2022-05-27  9:35 ` [Bug target/65164] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:06 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug target/65164] [10/11/12/13 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-06-01  8:06 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:35 ` rguenth at gcc dot gnu.org
  2022-06-28 10:31 ` jakub at gcc dot gnu.org
  2023-07-07 10:30 ` [Bug target/65164] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug target/65164] [10/11/12/13 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-05-27  9:35 ` [Bug target/65164] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:31 ` jakub at gcc dot gnu.org
  2023-07-07 10:30 ` [Bug target/65164] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug target/65164] [11/12/13/14 Regression][SH] missed subc in integer sign function
  2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-06-28 10:31 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:30 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-22 16:51 [Bug target/65164] New: [5 Regression][SH] missed subc in integer sign function olegendo at gcc dot gnu.org
2015-02-23 10:57 ` [Bug target/65164] " rguenth at gcc dot gnu.org
2015-04-22 12:01 ` [Bug target/65164] [5/6 " jakub at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org
2021-05-14  9:47 ` [Bug target/65164] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-05-27  9:35 ` [Bug target/65164] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug target/65164] [11/12/13/14 " 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).