public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/22077] New: vec_all_eq does not produce good result
@ 2005-06-15 14:10 pinskia at gcc dot gnu dot org
  2005-06-15 14:14 ` [Bug target/22077] " pinskia at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 14:10 UTC (permalink / raw)
  To: gcc-bugs

int foo(vector float x, vector float y) {
        if (vec_all_eq(x,y)) return 3245; 
        else return 12;
}

Right now we produce:
        vcmpeqfp. v3,v2,v3
        li r3,3245
        mfcr r0
        rlwinm r0,r0,25,1
        cmpwi cr7,r0,0
        bnelr+ cr7
        li r3,12
        blr

But we should be able to produce something like the following:
        vcmpeqfp. v3,v2,v3
        cmpwi cr6,r0,0
        li r3,3245
        bnelr+ cr7
        li r3,12
        blr

This might be because of there is no such thing as BI modes on powerpc but I don't know for sure.

-- 
           Summary: vec_all_eq does not produce good result
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: minor
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc*-*


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


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

* [Bug target/22077] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
@ 2005-06-15 14:14 ` pinskia at gcc dot gnu dot org
  2005-06-15 16:01 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 14:14 -------
Note it is even worse in 64bit mode:
_foo:
        vcmpeqfp. v3,v2,v3
        mfcr r0
        rlwinm r0,r0,25,1
        xori r2,r0,1
        li r0,-3233
        neg r2,r2
        and r2,r2,r0
        addi r3,r2,3245
        blr

-- 


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


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

* [Bug target/22077] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
  2005-06-15 14:14 ` [Bug target/22077] " pinskia at gcc dot gnu dot org
@ 2005-06-15 16:01 ` pinskia at gcc dot gnu dot org
  2005-06-15 22:11 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 16:01 -------
Assigning to Aldy so he could look at it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aldyh at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-15 16:01:47
               date|                            |


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


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

* [Bug target/22077] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
  2005-06-15 14:14 ` [Bug target/22077] " pinskia at gcc dot gnu dot org
  2005-06-15 16:01 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 22:11 ` pinskia at gcc dot gnu dot org
  2005-06-15 22:21 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 22:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 22:11 -------
I should have written we want the following code gen:
        vcmpeqfp. v3,v2,v3
        li r3,3245
        bnelr+ cr6
        li r3,12
        blr

-- 


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


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

* [Bug target/22077] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-06-15 22:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 22:21 ` pinskia at gcc dot gnu dot org
  2005-06-15 22:39 ` [Bug target/22077] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 22:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 22:21 -------
Hmm, Apple's 3.3 compiler gets it right:
        vcmpeqfp. v3,v2,v3
        li r3,3245
        bltlr- cr6
        li r3,12
        blr

-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-06-15 22:21 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 22:39 ` pinskia at gcc dot gnu dot org
  2005-06-15 22:42 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 22:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 22:38 -------
3.4.4 on powerpc-darwin gives:
        vcmpeqfp. v3,v2,v3
        li r3,3245
        crnot 26,24
        bnelr- cr6
        li r3,12
        blr

so this is a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|vec_all_eq does not produce |[4.0/4.1 Regression]
                   |good result                 |vec_all_eq does not produce
                   |                            |good result
   Target Milestone|---                         |4.0.2


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-06-15 22:39 ` [Bug target/22077] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-15 22:42 ` pinskia at gcc dot gnu dot org
  2005-06-15 22:53 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 22:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 22:42 -------
There is an extra RTL in .expand:
(insn 15 14 16 1 (set (reg:SI 119 [ D.1317 ])
        (reg:SI 123)) -1 (nil)
    (nil))

So this might not be a target bug after all.

-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-06-15 22:42 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 22:53 ` pinskia at gcc dot gnu dot org
  2005-06-15 23:07 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 22:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 22:53 -------
This does not look like target bug after all.  The extra move does not matter as it is removed in the 3.4/
4.0 case before getting to .combine:
int foo(vector float x, vector float y) {
int t = vec_all_eq(x,y);
        if (t) return 3245; 
        else return 12;
}


it looks like .combine is not doing its job and we reject now the combine of the following RTL:
(insn 11 10 12 0 (set (reg:SI 121)
        (lt:SI (reg:CC 74 cr6)
            (const_int 0 [0x0]))) 424 {*rs6000.md:11313} (insn_list 10 (nil))
    (expr_list:REG_DEAD (reg:CC 74 cr6)
        (nil)))

(insn 12 11 13 0 (set (reg:CC 123)
        (compare:CC (reg:SI 121)
            (const_int 0 [0x0]))) 415 {*cmpsi_internal1} (insn_list 11 (nil))
    (expr_list:REG_DEAD (reg:SI 121)
        (nil)))

(jump_insn 13 12 40 0 (set (pc)
        (if_then_else (eq (reg:CC 123)
                (const_int 0 [0x0]))
            (label_ref 22)
            (pc))) 521 {*rs6000.md:13595} (insn_list 12 (nil))
    (expr_list:REG_DEAD (reg:CC 123)
        (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
            (nil))))

Into:
(insn 12 11 13 0 (set (reg:CCEQ 123)
        (compare:CCEQ (lt:SI (reg:CC 74 cr6)
                (const_int 0 [0x0]))
            (const_int 0 [0x0]))) 527 {*cceq_rev_compare} (insn_list 10 (nil))
    (expr_list:REG_DEAD (reg:CC 74 cr6)
        (nil)))

(jump_insn 13 12 40 0 (set (pc)
        (if_then_else (eq (reg:CCEQ 123)
                (const_int 0 [0x0]))
            (label_ref 22)
            (pc))) 521 {*rs6000.md:13595} (insn_list 12 (nil))
    (expr_list:REG_DEAD (reg:CC 123)
        (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
            (nil))))

This might be due to the changes in taking into account the cost.

Maybe combine should combine it even further to the correct thing.

-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-06-15 22:53 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 23:07 ` pinskia at gcc dot gnu dot org
  2005-06-15 23:10 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 23:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 23:07 -------
The preprocessing source for the mainline is:
int foo(__attribute__((altivec(vector__))) float x, __attribute__((altivec(vector__))) float y)
{
        if (__builtin_vec_vcmpeq_p (2, (x), (y))) return 3245;
        else return 12;
}

-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-06-15 23:07 ` pinskia at gcc dot gnu dot org
@ 2005-06-15 23:10 ` pinskia at gcc dot gnu dot org
  2005-06-18 23:26 ` roger at eyesopen dot com
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 23:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 23:10 -------
(In reply to comment #8)
> The preprocessing source for the mainline is:

Note don't use -fpreprocessed because there is a bug which causing that fail, see PR 22085.

-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-06-15 23:10 ` pinskia at gcc dot gnu dot org
@ 2005-06-18 23:26 ` roger at eyesopen dot com
  2005-06-20 17:43 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: roger at eyesopen dot com @ 2005-06-18 23:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2005-06-18 23:26 -------
My apologies for not knowing this had a PR.  Here's the proposed solution
that I sent to Fariborz and Dale for testing.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.487
diff -c -3 -p -r1.487 combine.c
*** combine.c   15 Apr 2005 03:16:20 -0000      1.487
--- combine.c   17 Jun 2005 00:14:29 -0000
*************** simplify_set (rtx x)
*** 5272,5277 ****
--- 5272,5282 ----
          SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
          src = SET_SRC (x);
        }
+       else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
+         {
+           SUBST(SET_SRC (x), op0);
+           src = SET_SRC (x);
+         }
        else
        {
          /* Otherwise, update the COMPARE if needed.  */


-- 


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-06-18 23:26 ` roger at eyesopen dot com
@ 2005-06-20 17:43 ` pinskia at gcc dot gnu dot org
  2005-06-20 18:00 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-20 17:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-20 17:43 -------
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01685.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |06/msg01685.html
           Keywords|                            |patch


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


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

* [Bug target/22077] [4.0/4.1 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-06-20 17:43 ` pinskia at gcc dot gnu dot org
@ 2005-06-20 18:00 ` cvs-commit at gcc dot gnu dot org
  2005-06-20 18:03 ` [Bug target/22077] [4.0 " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-20 18:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-20 18:00 -------
Subject: Bug 22077

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	fjahanian@gcc.gnu.org	2005-06-20 17:59:36

Modified files:
	gcc            : ChangeLog combine.c 
Added files:
	gcc/testsuite/gcc.dg: altivec-nomfcr.c 

Log message:
	PR 22077.
	Oked by Roger Sayle.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9202&r2=2.9203
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&r1=1.493&r2=1.494
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/altivec-nomfcr.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug target/22077] [4.0 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2005-06-20 18:00 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-20 18:03 ` pinskia at gcc dot gnu dot org
  2005-08-29 15:10 ` bonzini at gcc dot gnu dot org
  2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-20 18:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-20 18:02 -------
Fixed on the mainline at least.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aldyh at gcc dot gnu dot org|fjahanian at apple dot com
            Summary|[4.0/4.1 Regression]        |[4.0 Regression] vec_all_eq
                   |vec_all_eq does not produce |does not produce good result
                   |good result                 |


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


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

* [Bug target/22077] [4.0 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2005-06-20 18:03 ` [Bug target/22077] [4.0 " pinskia at gcc dot gnu dot org
@ 2005-08-29 15:10 ` bonzini at gcc dot gnu dot org
  2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-08-29 15:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-08-29 15:02 -------
Maybe the patch could be backported to 4.0?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu dot org


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


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

* [Bug target/22077] [4.0 Regression] vec_all_eq does not produce good result
  2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2005-08-29 15:10 ` bonzini at gcc dot gnu dot org
@ 2005-09-27 16:23 ` mmitchel at gcc dot gnu dot org
  14 siblings, 0 replies; 16+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:23 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 14:10 [Bug target/22077] New: vec_all_eq does not produce good result pinskia at gcc dot gnu dot org
2005-06-15 14:14 ` [Bug target/22077] " pinskia at gcc dot gnu dot org
2005-06-15 16:01 ` pinskia at gcc dot gnu dot org
2005-06-15 22:11 ` pinskia at gcc dot gnu dot org
2005-06-15 22:21 ` pinskia at gcc dot gnu dot org
2005-06-15 22:39 ` [Bug target/22077] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-06-15 22:42 ` pinskia at gcc dot gnu dot org
2005-06-15 22:53 ` pinskia at gcc dot gnu dot org
2005-06-15 23:07 ` pinskia at gcc dot gnu dot org
2005-06-15 23:10 ` pinskia at gcc dot gnu dot org
2005-06-18 23:26 ` roger at eyesopen dot com
2005-06-20 17:43 ` pinskia at gcc dot gnu dot org
2005-06-20 18:00 ` cvs-commit at gcc dot gnu dot org
2005-06-20 18:03 ` [Bug target/22077] [4.0 " pinskia at gcc dot gnu dot org
2005-08-29 15:10 ` bonzini at gcc dot gnu dot org
2005-09-27 16:23 ` mmitchel 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).