public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction.
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-28 17:01 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustraded.  The recording form of an instruction could be used allowing for the elimination of a compare.  Duplicate using gcc 3.5 and command line:

gcc -O3 -m64 -c test.c


Testcase:
long int i, j;
int foo ()
{

  j = (i>>52);

  if (j< 0) {
    i = 10;
  } else {
    i = 20;
  };

  return i;

}

Assembly:
.foo:
	ld 11,.LC0@toc(2)
	ld 9,.LC1@toc(2)
	ld 0,0(11)
	sradi 0,0,52 <-- Use the recording form of sradi
	cmpdi 7,0,0  <-- and eliminate this compare.
	std 0,0(9)
	blt- 7,.L7
	li 0,20
	std 0,0(11)
	lwa 3,4(11)
	blr
.L7:
	li 0,10
	std 0,0(11)
	lwa 3,4(11)
	blr



-- 
           Summary: PowerPC - Opportunity to use recording form instruction.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
  2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-28 17:36 ` bangerth at dealii dot org
  2004-08-01  0:54 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28 17:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|other                       |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
  2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
@ 2004-08-01  0:54 ` pinskia at gcc dot gnu dot org
  2004-10-31  4:58 ` pinskia at gcc dot gnu dot org
  2004-11-09 12:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-01  0:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-01 00:54 -------
Note IIRC this is really only a size win rather than a performance win but I could be wrong.
Confirmed but I cannot understand why not:
(define_insn "*ashrdi3_internal1" 
  [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
        (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r")
                     (match_operand:SI 2 "reg_or_cint_operand" "ri")))]
  "TARGET_POWERPC64"
  "srad%I2 %0,%1,%H2") 
....
(define_insn "*ashrdi3_internal3"
  [(set (match_operand:CC 3 "cc_reg_operand" "=x,?y")
        (compare:CC (ashiftrt:DI (match_operand:DI 1 "gpc_reg_operand" "r,r")
                                 (match_operand:SI 2 "reg_or_cint_operand" "ri,ri"))
                    (const_int 0)))
   (set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
        (ashiftrt:DI (match_dup 1) (match_dup 2)))]
  "TARGET_64BIT"
  "@
   srad%I2. %0,%1,%H2
   #"
  [(set_attr "type" "delayed_compare")
   (set_attr "length" "4,8")])

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-01 00:54:58
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
  2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
  2004-08-01  0:54 ` pinskia at gcc dot gnu dot org
@ 2004-10-31  4:58 ` pinskia at gcc dot gnu dot org
  2004-11-09 12:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-31  4:58 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
   Last reconfirmed|2004-08-01 00:54:58         |2004-10-31 04:58:03
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
  2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-10-31  4:58 ` pinskia at gcc dot gnu dot org
@ 2004-11-09 12:26 ` nathan at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-09 12:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2004-11-09 12:25 -------
The problem here is that combine only combines chains of instructions that have
no other uses of the intermediate results.  In this case, the intermediate
result is stored into a global variable.

One solution would be to add a peephole, but that would only trigger when (a)
the shift and compare were adjacent, and (b) the compare used CR0.  You'd also
need peepholers for all the instructions that can implicitly set CR0.

Really combine, which is a generic peepholer, needs some kind of templatizing on
the target machine.  It currently functions by generating promising patterns and
 then seeing if they exist.  This is wasteful, in that it generates many
patterns  that don't exist on the particular target, and it is blind in that it
doesn't spot any special cases the target might have (like this case).  What's
needed is something like pre-reg-alloc peepholes.  That of course would be a
large amount of work.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
       [not found] <bug-16798-8614@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-04-08  2:20 ` pinskia at gcc dot gnu dot org
@ 2009-05-14  3:04 ` bje at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-14  3:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bje at gcc dot gnu dot org  2009-05-14 03:04 -------
Still present in GCC (GNU) 4.5.0 20090513 (experimental) [trunk revision
147498].


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
       [not found] <bug-16798-8614@http.gcc.gnu.org/bugzilla/>
  2005-11-02 17:16 ` pinskia at gcc dot gnu dot org
  2006-02-06 14:06 ` bonzini at gnu dot org
@ 2006-04-08  2:20 ` pinskia at gcc dot gnu dot org
  2009-05-14  3:04 ` bje at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-08  2:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-04-08 02:20 -------
I should note that there are some PPC cores where most recording are
microcoded.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  GCC build triplet|powerpc64-linux             |
   GCC host triplet|powerpc64-linux             |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
       [not found] <bug-16798-8614@http.gcc.gnu.org/bugzilla/>
  2005-11-02 17:16 ` pinskia at gcc dot gnu dot org
@ 2006-02-06 14:06 ` bonzini at gnu dot org
  2006-04-08  2:20 ` pinskia at gcc dot gnu dot org
  2009-05-14  3:04 ` bje at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: bonzini at gnu dot org @ 2006-02-06 14:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bonzini at gnu dot org  2006-02-06 14:06 -------
More precisely, combine is attempting to do instruction selection, and in the
case of this bug it cannot.

A similar ARM test case is

  int f (int a, int b)
  {
    int s = a - b;
    int t = a < b ? a : s;
    x = s;
    y = t;
  }

which should be something like (pseudo-assembly)

  rsbs  s, b, a
  str   [x], s
  movlt s, a
  str   [y], t

it is possible to teach the combiner about this reduced testcase, but it won't
match in the full testcase from which this was extracted, because s is used
between its definition and the definition of t.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

* [Bug target/16798] PowerPC - Opportunity to use recording form instruction.
       [not found] <bug-16798-8614@http.gcc.gnu.org/bugzilla/>
@ 2005-11-02 17:16 ` pinskia at gcc dot gnu dot org
  2006-02-06 14:06 ` bonzini at gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-02 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-11-02 17:16 -------
All P1 enhancements not targeted towards 4.1, moving to P5.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16798


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

end of thread, other threads:[~2009-05-14  3:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 17:01 [Bug other/16798] New: PowerPC - Opportunity to use recording form instruction gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:36 ` [Bug target/16798] " bangerth at dealii dot org
2004-08-01  0:54 ` pinskia at gcc dot gnu dot org
2004-10-31  4:58 ` pinskia at gcc dot gnu dot org
2004-11-09 12:26 ` nathan at gcc dot gnu dot org
     [not found] <bug-16798-8614@http.gcc.gnu.org/bugzilla/>
2005-11-02 17:16 ` pinskia at gcc dot gnu dot org
2006-02-06 14:06 ` bonzini at gnu dot org
2006-04-08  2:20 ` pinskia at gcc dot gnu dot org
2009-05-14  3:04 ` bje at gcc dot gnu dot 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).