public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41019]  New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
@ 2009-08-09 20:56 m_albert137 at yahoo dot com
  2009-08-09 21:02 ` [Bug c++/41019] " m_albert137 at yahoo dot com
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-09 20:56 UTC (permalink / raw)
  To: gcc-bugs

The attached code, we compiled with "-O3", gives an incorrect sequence (and
different from the sequence without optimization or -O1 or -O2).

This problem was discovered due to incorrect statistical behavior of a Monte
Carlo calculation (not attached).


-- 
           Summary: Variate_generator with mt19937 and normal_distribution
                    produces wrong sequence for "-O3".
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: m_albert137 at yahoo dot com
  GCC host triplet: x86_64-unknown-linux-gnu  Core2 Q9550


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


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

* [Bug c++/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
@ 2009-08-09 21:02 ` m_albert137 at yahoo dot com
  2009-08-09 21:06 ` m_albert137 at yahoo dot com
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-09 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from m_albert137 at yahoo dot com  2009-08-09 21:02 -------
Created an attachment (id=18332)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18332&action=view)
Example code

When compiled below -O3 (e.g., -O2), this code gives:
0 -0.29321891723895837645
1 0.25316081895796688217
2 -0.057085487765685671846

with -O3:

0 0.31678484080597951733
1 0.27675012391718101235
2 0.14034606328371523887


-- 


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


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

* [Bug c++/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
  2009-08-09 21:02 ` [Bug c++/41019] " m_albert137 at yahoo dot com
@ 2009-08-09 21:06 ` m_albert137 at yahoo dot com
  2009-08-09 21:09 ` m_albert137 at yahoo dot com
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-09 21:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from m_albert137 at yahoo dot com  2009-08-09 21:05 -------
Created an attachment (id=18333)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18333&action=view)
Configuration information from "g++ -O3 -v --save-temps t.cpp"

Config information from "-v" compilation.


-- 


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


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

* [Bug c++/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
  2009-08-09 21:02 ` [Bug c++/41019] " m_albert137 at yahoo dot com
  2009-08-09 21:06 ` m_albert137 at yahoo dot com
@ 2009-08-09 21:09 ` m_albert137 at yahoo dot com
  2009-08-11 15:04 ` m_albert137 at yahoo dot com
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-09 21:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from m_albert137 at yahoo dot com  2009-08-09 21:09 -------
Created an attachment (id=18334)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18334&action=view)
"savetemps" file from "g++ -O3 -v --save-temps t.cpp"

The savetemps file. 


-- 


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


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

* [Bug c++/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (2 preceding siblings ...)
  2009-08-09 21:09 ` m_albert137 at yahoo dot com
@ 2009-08-11 15:04 ` m_albert137 at yahoo dot com
  2009-08-11 15:24 ` [Bug tree-optimization/41019] " rguenth at gcc dot gnu dot org
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-11 15:04 UTC (permalink / raw)
  To: gcc-bugs



-- 

m_albert137 at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major
          Component|libstdc++                   |c++


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (3 preceding siblings ...)
  2009-08-11 15:04 ` m_albert137 at yahoo dot com
@ 2009-08-11 15:24 ` rguenth at gcc dot gnu dot org
  2009-08-11 20:17 ` afoglia at gmail dot com
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-11 15:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-08-11 15:24 -------
Disabling vectorization fixes the problem (-fno-tree-vectorize), happens on
trunk as well.  4.3 doesn't like the testcase, so it's not yet a regression.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm dot com,
                   |                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |tree-optimization
     Ever Confirmed|0                           |1
   GCC host triplet|x86_64-unknown-linux-gnu    |
                   |Core2 Q9550                 |
 GCC target triplet|                            |x86-*-*
           Keywords|                            |wrong-code
      Known to fail|                            |4.4.1 4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-11 15:24:24
               date|                            |


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (4 preceding siblings ...)
  2009-08-11 15:24 ` [Bug tree-optimization/41019] " rguenth at gcc dot gnu dot org
@ 2009-08-11 20:17 ` afoglia at gmail dot com
  2009-08-12 12:14 ` irar at il dot ibm dot com
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: afoglia at gmail dot com @ 2009-08-11 20:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from afoglia at gmail dot com  2009-08-11 20:17 -------
(In reply to comment #4)
> Disabling vectorization fixes the problem (-fno-tree-vectorize), happens on
> trunk as well.  4.3 doesn't like the testcase, so it's not yet a regression.
> 

4.3 may not like the test case, but if you use Boost's variate_generator with
4.3, which can hold references to engines, you get the same results, implying
it's the use the mt19937 engine via reference that causes the problem.


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (5 preceding siblings ...)
  2009-08-11 20:17 ` afoglia at gmail dot com
@ 2009-08-12 12:14 ` irar at il dot ibm dot com
  2009-08-12 12:37 ` rguenther at suse dot de
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: irar at il dot ibm dot com @ 2009-08-12 12:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from irar at il dot ibm dot com  2009-08-12 12:14 -------
Looks like a problem in data-ref analysis:

Creating dr for this_6(D)->_M_x[__k_87]
...
        base_address: this_6(D)
        offset from base address: 0
        constant offset from base address: 0
        step: 8
        aligned to: 128
        base_object: this_6(D)->_M_x[0]

And the vectorizer creates accesses relatively to this_6(D) (base_address
above) with zero offset (instead of this_6(D)->_M_x[0] or with an offset of
_M_x).

Ira


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (6 preceding siblings ...)
  2009-08-12 12:14 ` irar at il dot ibm dot com
@ 2009-08-12 12:37 ` rguenther at suse dot de
  2009-08-13  5:41 ` irar at il dot ibm dot com
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenther at suse dot de @ 2009-08-12 12:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenther at suse dot de  2009-08-12 12:37 -------
Subject: Re:  Variate_generator with mt19937
 and normal_distribution produces wrong sequence for "-O3".

On Wed, 12 Aug 2009, irar at il dot ibm dot com wrote:

> ------- Comment #6 from irar at il dot ibm dot com  2009-08-12 12:14 -------
> Looks like a problem in data-ref analysis:
> 
> Creating dr for this_6(D)->_M_x[__k_87]
> ...
>         base_address: this_6(D)
>         offset from base address: 0
>         constant offset from base address: 0
>         step: 8
>         aligned to: 128
>         base_object: this_6(D)->_M_x[0]
> 
> And the vectorizer creates accesses relatively to this_6(D) (base_address
> above) with zero offset (instead of this_6(D)->_M_x[0] or with an offset of
> _M_x).

Oh.  Did you manage to reduce or reproduce with a smaller testcase?

Thanks,
Richard.


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (7 preceding siblings ...)
  2009-08-12 12:37 ` rguenther at suse dot de
@ 2009-08-13  5:41 ` irar at il dot ibm dot com
  2009-08-13  8:56 ` rguenth at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: irar at il dot ibm dot com @ 2009-08-13  5:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from irar at il dot ibm dot com  2009-08-13 05:40 -------
(In reply to comment #7)
> Oh.  Did you manage to reduce or reproduce with a smaller testcase?

No, I just looked at the vectorized loops. The guilty one is

bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/tr1/random.tcc:231

Ira


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (8 preceding siblings ...)
  2009-08-13  5:41 ` irar at il dot ibm dot com
@ 2009-08-13  8:56 ` rguenth at gcc dot gnu dot org
  2009-08-13 11:35 ` irar at il dot ibm dot com
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-13  8:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2009-08-13 08:56 -------
>From a look at the sources it seems that _M_x is at offset zero.


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (9 preceding siblings ...)
  2009-08-13  8:56 ` rguenth at gcc dot gnu dot org
@ 2009-08-13 11:35 ` irar at il dot ibm dot com
  2009-08-13 11:36 ` irar at il dot ibm dot com
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: irar at il dot ibm dot com @ 2009-08-13 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from irar at il dot ibm dot com  2009-08-13 11:34 -------
Reduced testcase:

#include <stdlib.h>
#include <stdio.h>

#define N 4

long int a[N];
int main ()
{
  int k;

  for (k = 0; k < N; ++k)
    a[k] = a[k] != 5 ? 12 : 10;

  for (k = 0; k < N; ++k)
    printf ("%u ", a[k]);

  printf ("\n");

  return 0;
}

%gcc -O3 t.c
% ./a.out
0 0 0 0

%gcc -O2 t.c
% ./a.out
12 12 12 12

If the type of 'a' is int, there is no problem. The vectorizer produces almost
the same code in both cases (except for number of iterations and types).
I am attaching the assembly for int and long int versions.

Ira


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (10 preceding siblings ...)
  2009-08-13 11:35 ` irar at il dot ibm dot com
@ 2009-08-13 11:36 ` irar at il dot ibm dot com
  2009-08-13 11:37 ` irar at il dot ibm dot com
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: irar at il dot ibm dot com @ 2009-08-13 11:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from irar at il dot ibm dot com  2009-08-13 11:36 -------
Created an attachment (id=18350)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18350&action=view)
The assembly for the long int version (wrong code)


-- 


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


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

* [Bug tree-optimization/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (11 preceding siblings ...)
  2009-08-13 11:36 ` irar at il dot ibm dot com
@ 2009-08-13 11:37 ` irar at il dot ibm dot com
  2009-08-13 12:25 ` [Bug target/41019] " rguenth at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: irar at il dot ibm dot com @ 2009-08-13 11:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from irar at il dot ibm dot com  2009-08-13 11:37 -------
Created an attachment (id=18351)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18351&action=view)
The assembly for the int version (correct)


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (12 preceding siblings ...)
  2009-08-13 11:37 ` irar at il dot ibm dot com
@ 2009-08-13 12:25 ` rguenth at gcc dot gnu dot org
  2009-08-13 12:32 ` rguenth at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-13 12:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from rguenth at gcc dot gnu dot org  2009-08-13 12:25 -------
Err, the expansion is already completely bogus:

;; *vect_pa.50 = [vec_cond_expr]  VEC_COND_EXPR < *vect_pa.44 != { 5, 5 } , {
12, 12 } , { 10, 10 } > ;

(insn 7 6 8 t.c:12 (set (reg:V2DI 63)
        (mem/u/c/i:V2DI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [2 S16 A128]))
-1 (expr_list:REG_EQUAL (const_vector:V2DI [
                (const_int 5 [0x5])
                (const_int 5 [0x5])
            ])
        (nil)))

(insn 8 7 9 t.c:12 (set (reg:V2DI 64)
        (mem/u/c/i:V2DI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [2 S16 A128]))
-1 (expr_list:REG_EQUAL (const_vector:V2DI [
                (const_int 12 [0xc])
                (const_int 12 [0xc])
            ])
        (nil)))

(insn 9 8 10 t.c:12 (set (reg:V2DI 65)
        (mem/u/c/i:V2DI (symbol_ref/u:DI ("*.LC2") [flags 0x2]) [2 S16 A128]))
-1 (expr_list:REG_EQUAL (const_vector:V2DI [
                (const_int 10 [0xa])
                (const_int 10 [0xa])
            ])
        (nil)))

(insn 10 9 0 t.c:12 (set (mem:V2DI (reg/f:DI 58 [ vect_pa.50 ]) [2 S16 A128])
        (reg:V2DI 62)) -1 (nil))


so - we load three constants and store the uninitialized reg 62.

Which means the optabs for this case are broken.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uros at gcc dot gnu dot org
          Component|tree-optimization           |target


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (13 preceding siblings ...)
  2009-08-13 12:25 ` [Bug target/41019] " rguenth at gcc dot gnu dot org
@ 2009-08-13 12:32 ` rguenth at gcc dot gnu dot org
  2009-08-13 13:02 ` ubizjak at gmail dot com
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-13 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from rguenth at gcc dot gnu dot org  2009-08-13 12:32 -------
ix86_expand_int_vcond fails because the operation is not supported with SSE2,
but
gen_vcondv2di doesn't handle the failure, but ignores it.

The vcond patterns are not properly reflecting the restrictions.


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (14 preceding siblings ...)
  2009-08-13 12:32 ` rguenth at gcc dot gnu dot org
@ 2009-08-13 13:02 ` ubizjak at gmail dot com
  2009-08-13 13:04 ` ubizjak at gmail dot com
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 13:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from ubizjak at gmail dot com  2009-08-13 13:02 -------
(In reply to comment #14)

> The vcond patterns are not properly reflecting the restrictions.

Are you sure?

(define_expand "vcond<mode>"
  [(set (match_operand:SSEMODEI 0 "register_operand" "")
        (if_then_else:SSEMODEI
          (match_operator 3 ""
            [(match_operand:SSEMODEI 4 "nonimmediate_operand" "")
             (match_operand:SSEMODEI 5 "nonimmediate_operand" "")])
          (match_operand:SSEMODEI 1 "general_operand" "")
          (match_operand:SSEMODEI 2 "general_operand" "")))]
  "TARGET_SSE2"
{
  if (ix86_expand_int_vcond (operands))
    DONE;
  else
    FAIL;
})


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (15 preceding siblings ...)
  2009-08-13 13:02 ` ubizjak at gmail dot com
@ 2009-08-13 13:04 ` ubizjak at gmail dot com
  2009-08-13 13:09 ` rguenther at suse dot de
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 13:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from ubizjak at gmail dot com  2009-08-13 13:04 -------
Looking into it...


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-08-11 15:24:24         |2009-08-13 13:04:39
               date|                            |


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (16 preceding siblings ...)
  2009-08-13 13:04 ` ubizjak at gmail dot com
@ 2009-08-13 13:09 ` rguenther at suse dot de
  2009-08-13 13:35 ` ubizjak at gmail dot com
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenther at suse dot de @ 2009-08-13 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from rguenther at suse dot de  2009-08-13 13:08 -------
Subject: Re:  Variate_generator with mt19937 and
 normal_distribution produces wrong sequence for "-O3".

On Thu, 13 Aug 2009, ubizjak at gmail dot com wrote:

> 
> 
> ------- Comment #15 from ubizjak at gmail dot com  2009-08-13 13:02 -------
> (In reply to comment #14)
> 
> > The vcond patterns are not properly reflecting the restrictions.
> 
> Are you sure?
> 
> (define_expand "vcond<mode>"
>   [(set (match_operand:SSEMODEI 0 "register_operand" "")
>         (if_then_else:SSEMODEI
>           (match_operator 3 ""
>             [(match_operand:SSEMODEI 4 "nonimmediate_operand" "")
>              (match_operand:SSEMODEI 5 "nonimmediate_operand" "")])
>           (match_operand:SSEMODEI 1 "general_operand" "")
>           (match_operand:SSEMODEI 2 "general_operand" "")))]
>   "TARGET_SSE2"

It says TARGET_SSE2 but vcondv2di is only available with TARGET_SSE4+

Richard.


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (17 preceding siblings ...)
  2009-08-13 13:09 ` rguenther at suse dot de
@ 2009-08-13 13:35 ` ubizjak at gmail dot com
  2009-08-13 13:40 ` ubizjak at gmail dot com
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 13:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from ubizjak at gmail dot com  2009-08-13 13:35 -------
(In reply to comment #17)

> It says TARGET_SSE2 but vcondv2di is only available with TARGET_SSE4+

Yes, but FAIL invalidates complete expansion.


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (18 preceding siblings ...)
  2009-08-13 13:35 ` ubizjak at gmail dot com
@ 2009-08-13 13:40 ` ubizjak at gmail dot com
  2009-08-13 14:27 ` m_albert137 at yahoo dot com
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from ubizjak at gmail dot com  2009-08-13 13:39 -------
(In reply to comment #18)
> (In reply to comment #17)
> 
> > It says TARGET_SSE2 but vcondv2di is only available with TARGET_SSE4+
> 
> Yes, but FAIL invalidates complete expansion.

Oh, I see the problem. Middle end doesn't handle FAIL in this case, just checks
the presence of the pattern.

Oh, well... I'll split the pattern into two parts.


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (19 preceding siblings ...)
  2009-08-13 13:40 ` ubizjak at gmail dot com
@ 2009-08-13 14:27 ` m_albert137 at yahoo dot com
  2009-08-13 15:27 ` ubizjak at gmail dot com
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: m_albert137 at yahoo dot com @ 2009-08-13 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from m_albert137 at yahoo dot com  2009-08-13 14:27 -------
Please let me say that I am deeply impressed by both the technical expertise of
those who have helped with the issue that I raised and the willingness to
respond so quickly.

I thank you and consider myself to be in debt to you.

Sincerely,
 Mike Albert


-- 


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


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

* [Bug target/41019] Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3".
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (20 preceding siblings ...)
  2009-08-13 14:27 ` m_albert137 at yahoo dot com
@ 2009-08-13 15:27 ` ubizjak at gmail dot com
  2009-08-13 16:21 ` [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3 ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 15:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from ubizjak at gmail dot com  2009-08-13 15:26 -------
Created an attachment (id=18353)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18353&action=view)
patch to fix the failure

I'm testing the attached patch.

There is a little complication w.r.t to V2DI handling. Since vcond pattern
assumes that we have full set of comparisons, we cannot enable V2DI on
TARGET_SSE4.1 because SSE4.1 handles only EQ comparison. SSE4.2 and SSE5 handle
full set, so V2DI vcond pattern can again be enabled on these targets.


-- 


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (21 preceding siblings ...)
  2009-08-13 15:27 ` ubizjak at gmail dot com
@ 2009-08-13 16:21 ` ubizjak at gmail dot com
  2009-08-13 18:28 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 16:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from ubizjak at gmail dot com  2009-08-13 16:20 -------
Also fails on 4.3.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|uros at gcc dot gnu dot org |
      Known to fail|4.4.1 4.5.0                 |4.3.4 4.4.1 4.5.0
            Summary|Variate_generator with      |[4.3/4.4/4.5 Regression]
                   |mt19937 and                 |Vector conditional move
                   |normal_distribution produces|produces wrong code with -
                   |wrong sequence for "-O3".   |O3.
   Target Milestone|---                         |4.3.5


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (22 preceding siblings ...)
  2009-08-13 16:21 ` [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3 ubizjak at gmail dot com
@ 2009-08-13 18:28 ` ubizjak at gmail dot com
  2009-08-14 10:31 ` uros at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-13 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from ubizjak at gmail dot com  2009-08-13 18:27 -------
Patch at http://gcc.gnu.org/ml/gcc-patches/2009-08/msg00700.html


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2009-
                   |                            |08/msg00700.html


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (23 preceding siblings ...)
  2009-08-13 18:28 ` ubizjak at gmail dot com
@ 2009-08-14 10:31 ` uros at gcc dot gnu dot org
  2009-08-16 19:35 ` uros at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-08-14 10:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from uros at gcc dot gnu dot org  2009-08-14 10:31 -------
Subject: Bug 41019

Author: uros
Date: Fri Aug 14 10:31:09 2009
New Revision: 150738

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150738
Log:
        PR target/41019
        * config/i386/sse.md (SSEMODE124C8): New mode iterator.
        (vcond<SSEMODEF2P:mode>): Assert that operation is supported by
        ix86_expand_fp_vcond.
        (vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
        Assert that operation is supported by ix86_expand_int_vcond.
        (vcondu<SSEMODE124C8:mode>): Ditto.

testsuite/ChangeLog:

        PR target/41019
        * gcc.target/i386/pr41019.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr41019.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/sse.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (24 preceding siblings ...)
  2009-08-14 10:31 ` uros at gcc dot gnu dot org
@ 2009-08-16 19:35 ` uros at gcc dot gnu dot org
  2009-08-16 21:06 ` uros at gcc dot gnu dot org
  2009-08-16 21:07 ` ubizjak at gmail dot com
  27 siblings, 0 replies; 29+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-08-16 19:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from uros at gcc dot gnu dot org  2009-08-16 19:35 -------
Subject: Bug 41019

Author: uros
Date: Sun Aug 16 19:34:49 2009
New Revision: 150809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150809
Log:
        Backport from mainline:
        2009-08-14  Uros Bizjak  <ubizjak@gmail.com>

        PR target/41019
        * config/i386/sse.md (SSEMODE124C8): New mode iterator.
        (vcond<SSEMODEF2P:mode>): Assert that operation is supported by
        ix86_expand_fp_vcond.
        (vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
        Assert that operation is supported by ix86_expand_int_vcond.
        (vcondu<SSEMODE124C8:mode>): Ditto.

testsuite/ChangeLog:

        Backport from mainline:
        2009-08-14  Uros Bizjak  <ubizjak@gmail.com>

        PR target/41019
        * gcc.target/i386/pr41019.c: New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr41019.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/i386/sse.md
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (25 preceding siblings ...)
  2009-08-16 19:35 ` uros at gcc dot gnu dot org
@ 2009-08-16 21:06 ` uros at gcc dot gnu dot org
  2009-08-16 21:07 ` ubizjak at gmail dot com
  27 siblings, 0 replies; 29+ messages in thread
From: uros at gcc dot gnu dot org @ 2009-08-16 21:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from uros at gcc dot gnu dot org  2009-08-16 21:06 -------
Subject: Bug 41019

Author: uros
Date: Sun Aug 16 21:05:47 2009
New Revision: 150816

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150816
Log:
        Backport from mainline:
        2009-08-14  Uros Bizjak  <ubizjak@gmail.com>

        PR target/41019
        * config/i386/sse.md (SSEMODE124C8): New mode iterator.
        (vcond<SSEMODEF2P:mode>): Assert that operation is supported by
        ix86_expand_fp_vcond.
        (vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
        Assert that operation is supported by ix86_expand_int_vcond.
        (vcondu<SSEMODE124C8:mode>): Ditto.

testsuite/ChangeLog:

        Backport from mainline:
        2009-08-14  Uros Bizjak  <ubizjak@gmail.com>

        PR target/41019
        * gcc.target/i386/pr41019.c: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr41019.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/i386/sse.md
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3.
  2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
                   ` (26 preceding siblings ...)
  2009-08-16 21:06 ` uros at gcc dot gnu dot org
@ 2009-08-16 21:07 ` ubizjak at gmail dot com
  27 siblings, 0 replies; 29+ messages in thread
From: ubizjak at gmail dot com @ 2009-08-16 21:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from ubizjak at gmail dot com  2009-08-16 21:07 -------
Fixed for x86.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|4.3.4 4.4.1 4.5.0           |4.3.4 4.4.1
      Known to work|                            |4.3.5 4.4.2 4.5.0
         Resolution|                            |FIXED


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


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

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

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-09 20:56 [Bug c++/41019] New: Variate_generator with mt19937 and normal_distribution produces wrong sequence for "-O3" m_albert137 at yahoo dot com
2009-08-09 21:02 ` [Bug c++/41019] " m_albert137 at yahoo dot com
2009-08-09 21:06 ` m_albert137 at yahoo dot com
2009-08-09 21:09 ` m_albert137 at yahoo dot com
2009-08-11 15:04 ` m_albert137 at yahoo dot com
2009-08-11 15:24 ` [Bug tree-optimization/41019] " rguenth at gcc dot gnu dot org
2009-08-11 20:17 ` afoglia at gmail dot com
2009-08-12 12:14 ` irar at il dot ibm dot com
2009-08-12 12:37 ` rguenther at suse dot de
2009-08-13  5:41 ` irar at il dot ibm dot com
2009-08-13  8:56 ` rguenth at gcc dot gnu dot org
2009-08-13 11:35 ` irar at il dot ibm dot com
2009-08-13 11:36 ` irar at il dot ibm dot com
2009-08-13 11:37 ` irar at il dot ibm dot com
2009-08-13 12:25 ` [Bug target/41019] " rguenth at gcc dot gnu dot org
2009-08-13 12:32 ` rguenth at gcc dot gnu dot org
2009-08-13 13:02 ` ubizjak at gmail dot com
2009-08-13 13:04 ` ubizjak at gmail dot com
2009-08-13 13:09 ` rguenther at suse dot de
2009-08-13 13:35 ` ubizjak at gmail dot com
2009-08-13 13:40 ` ubizjak at gmail dot com
2009-08-13 14:27 ` m_albert137 at yahoo dot com
2009-08-13 15:27 ` ubizjak at gmail dot com
2009-08-13 16:21 ` [Bug target/41019] [4.3/4.4/4.5 Regression] Vector conditional move produces wrong code with -O3 ubizjak at gmail dot com
2009-08-13 18:28 ` ubizjak at gmail dot com
2009-08-14 10:31 ` uros at gcc dot gnu dot org
2009-08-16 19:35 ` uros at gcc dot gnu dot org
2009-08-16 21:06 ` uros at gcc dot gnu dot org
2009-08-16 21:07 ` ubizjak 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).