public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66613] New: error in evaluationg cexp
@ 2015-06-20 12:56 ka_bena at yahoo dot fr
  2015-06-21 21:20 ` [Bug c/66613] " miyuki at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ka_bena at yahoo dot fr @ 2015-06-20 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66613
           Summary: error in evaluationg cexp
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ka_bena at yahoo dot fr
  Target Milestone: ---

#include <stdio.h> 
#include <complex.h>
#include <quadmath.h>

int main(void)
{
   printf( "\n"); 
  
printf("/**********************************************************************/\n"); 
   printf( "\n"); 

   printf( "SECTION 1 \n"); 
   printf( "\n"); 
   printf( " _Complex float zF          = 1.F + 2.Fi ;\n");   
   _Complex float zF = 1.F + 2.Fi ;
   printf( " crealf(cexpf(zF))          = %f \n" , crealf(cexpf(zF))) ;
   printf( " cimagf(cexpf(zF))          = %f \n" , cimagf(cexpf(zF))) ;
   printf( "\n"); 

   printf( " _Complex double zD         = 1.D + 2.Di ;\n");   
   _Complex double zD = 1.D + 2.Di ;
   printf( " creal(cexp(zD))            = %E \n" , creal(cexp(zD))) ;
   printf( " cimag(cexp(zD))            = %E \n" , cimag(cexp(zD))) ;
   printf( " creal(cexp(1.D + 2.Di))    = %f \n" , creal(cexp(1.D + 2.Di))) ;
   printf( " cimag(cexp(1.D + 2.Di))    = %f \n" , cimag(cexp(1.D + 2.Di))) ;
   printf( "\n"); 

   printf( " _Complex long double zL    = 1.L + 2.Li\n");   
    _Complex long double zL = 1.L + 2.Li ;
   printf( " creall(cexpl(zL))          = %lE \n" , creall(cexpl(zL))) ;
   printf( " cimagl(cexpl(zL))          = %lE \n" , cimagl(cexpl(zL))) ;
   printf( " creall(cexpl(1.L + 2.Li))  = %lf \n" , creall(cexpl(1.L + 2.Li)))
;
   printf( " cimagl(cexpl(1.L + 2.Li))  = %lf \n" , cimagl(cexpl(1.L + 2.Li)))
;
   printf( "\n");

   printf( " __complex128 zQ            = 1.Q + 2.Qi\n");
    __complex128 zQ = 1.Q + 2.Qi ;
   printf( " crealq(cexpq(zQ))          = %lf \n" , (long
double)crealq(cexpq(zQ))) ;
   printf( " cimagq(cexpq(zQ))          = %lf \n" , (long
double)cimagq(cexpq(zQ))) ;

   printf( "\n"); 
  
printf("/**********************************************************************/\n"); 
   printf( "\n"); 


   printf( "SECTION 2 \n"); 

   printf( "\n");   
   float alfa = 1.f / 3.f ;
   printf(" alfa             = %-100.80f \n" , alfa) ; 
   printf(" sizeof(alfa))    = %u        \n" , sizeof(alfa)) ; 
   printf(" 1.f/3.f          = %-100.80f \n" , 1.f/3.f) ; 
   printf(" sizeof(1.f/3.f)) = %u        \n" , sizeof(1.f/3.f)) ; 

   printf( "\n"); 
  
printf("/**********************************************************************/\n"); 
   printf( "\n"); 

  return 0;
}

//---------- Capture Output ----------
//> "E:\PAPA\test_gcc\C99\RUN_C\run_C99.bat" main_error_gcc481 
//
//D:\gfortran\include>E:\PAPA\test_gcc\exe\main_error_gcc481_C99.exe
//
///**********************************************************************/
//
//SECTION 1 
//
// _Complex float zF          = 1.F + 2.Fi ;
// crealf(cexpf(zF))          = -1.131204 
// cimagf(cexpf(zF))          = 2.471727 
//
// _Complex double zD         = 1.D + 2.Di ;
// creal(cexp(zD))            = -3.730751E-144 
// cimag(cexp(zD))            = 6.752940E+268 
// creal(cexp(1.D + 2.Di))    = -1.131204 
// cimag(cexp(1.D + 2.Di))    = 2.471727 
//
// _Complex long double zL    = 1.L + 2.Li
// creall(cexpl(zL))          = -0.000000E+000 
// cimagl(cexpl(zL))          = 1.291636E+1644 
// creall(cexpl(1.L + 2.Li))  = -1.131204 
// cimagl(cexpl(1.L + 2.Li))  = 2.471727 
//
// __complex128 zQ            = 1.Q + 2.Qi
// crealq(cexpq(zQ))          = -1.131204 
// cimagq(cexpq(zQ))          = 2.471727 
//
///**********************************************************************/
//
//SECTION 2 
//
// alfa             =
0.33333334326744079589843750000000000000000000000000000000000000000000000000000000 
// sizeof(alfa))    = 4        
// 1.f/3.f          =
0.33333333333333331482961625624739099293947219848632812500000000000000000000000000 
// sizeof(1.f/3.f)) = 4        
//
///**********************************************************************/
//
//
//> Terminated with exit code 0.


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

* [Bug c/66613] error in evaluationg cexp
  2015-06-20 12:56 [Bug c/66613] New: error in evaluationg cexp ka_bena at yahoo dot fr
@ 2015-06-21 21:20 ` miyuki at gcc dot gnu.org
  2015-07-02 13:08 ` ka_bena at yahoo dot fr
  2015-07-02 13:14 ` ka_bena at yahoo dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-06-21 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

Mikhail Maltsev <miyuki at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |miyuki at gcc dot gnu.org

--- Comment #2 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Presumably, the problem is the difference in precision. But what is
"run_C99.bat"? And what platform do you use?

With current GCC 4.8 branch (x86_64-linux) I get the following result:

$ /opt/gcc-4.8-latest/bin/gcc -std=c99 -lquadmath -lm ./test.c -o test_c99 &&
./test_c99

/**********************************************************************/

SECTION 1

 _Complex float zF          = 1.F + 2.Fi ;
 crealf(cexpf(zF))          = -1.131204
 cimagf(cexpf(zF))          = 2.471727

 _Complex double zD         = 1.D + 2.Di ;
 creal(cexp(zD))            = -1.131204E+00
 cimag(cexp(zD))            = 2.471727E+00
 creal(cexp(1.D + 2.Di))    = -1.131204
 cimag(cexp(1.D + 2.Di))    = 2.471727

 _Complex long double zL    = 1.L + 2.Li
 creall(cexpl(zL))          = -3.177877E-189
 cimagl(cexpl(zL))          = -3.177877E-189
 creall(cexpl(1.L + 2.Li))  = -0.000000
 cimagl(cexpl(1.L + 2.Li))  = -0.000000

 __complex128 zQ            = 1.Q + 2.Qi
 crealq(cexpq(zQ))          = 0.000000
 cimagq(cexpq(zQ))          = 0.000000

/**********************************************************************/

SECTION 2

 alfa             =
0.33333334326744079589843750000000000000000000000000000000000000000000000000000000 
 sizeof(alfa))    = 4
 1.f/3.f          =
0.33333334326744079589843750000000000000000000000000000000000000000000000000000000

 sizeof(1.f/3.f)) = 4

/**********************************************************************/

It is possible that the problem is specific to 4.8.1, but I don't have it
installed right now. If someone has, could you check it please.


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

* [Bug c/66613] error in evaluationg cexp
  2015-06-20 12:56 [Bug c/66613] New: error in evaluationg cexp ka_bena at yahoo dot fr
  2015-06-21 21:20 ` [Bug c/66613] " miyuki at gcc dot gnu.org
@ 2015-07-02 13:08 ` ka_bena at yahoo dot fr
  2015-07-02 13:14 ` ka_bena at yahoo dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: ka_bena at yahoo dot fr @ 2015-07-02 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from BENAÏSSA <ka_bena at yahoo dot fr> ---
Thank you for your mail.
Compile Flags:  -std=c99
-Warray-bounds
 -Wall
 -Wextra  
-Waddress
 -Wbad-function-cast
 -Wformat
 -Wformat-contains-nul
 -Wformat-extra-args
-Wformat-nonliteral
-Wformat-security
 -Wformat-zero-length
-Wmissing-format-attribute
 -Woverlength-strings
 -foptional-diags
-Woverlength-strings
 -malign-stringops-malign-stringops-lm-llquadmath
I work with windowsXP on Compaq 6720S.
I use gcc provided by gfortran.I hope that those informations can be useful.   
       Thank you A.BENAISSA.



     Le Lundi 22 juin 2015 11h50, rguenth at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> a écrit :


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

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

          What    |Removed                    |Added
----------------------------------------------------------------------------
            Status|UNCONFIRMED                |WAITING
  Last reconfirmed|                            |2015-06-22
    Ever confirmed|0                          |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue could also be in gmp/mpfr/mpc or in the C library.

How did you compile (with what flags) anyway?
>From gcc-bugs-return-491281-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 02 13:09:45 2015
Return-Path: <gcc-bugs-return-491281-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18610 invoked by alias); 2 Jul 2015 13:09:45 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18577 invoked by uid 48); 2 Jul 2015 13:09:40 -0000
From: "aldot at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/66741] loops not fused nor vectorized
Date: Thu, 02 Jul 2015 13:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: aldot at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66741-4-tJU8QLMG1O@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66741-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66741-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg00171.txt.bz2
Content-length: 3098

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf741

--- Comment #1 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
i.e. maybe something more along the lines of

$ cat <<EOF | gcc-5 -xc -S - -o - -Ofast -fomit-frame-pointer
-minline-all-stringops -mstringop-strategy=unrolled_loop  -fdump-tree-all-all
-fdump-rtl-all-all -fdump-ipa-all-all -msse4
#include <smmintrin.h>
#include <assert.h>
#include <stdint.h>

void
sse_tolower_strcpy (const char *d, const char *s)
{

  __m128i ranges     _mm_setr_epi8 ('A', 'Z', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

  __m128i *src = (__m128i *) s;
  __m128i *dst = (__m128i *) d;
  const __m128i diff = _mm_set1_epi8 (0x20);

  const uint8_t mode = _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;

  for (;; src++, dst++)
    {

      const __m128i chunk = _mm_loadu_si128 (src);
      if (_mm_cmpistrc (ranges, chunk, mode))
{

  const __m128i tmp1 = _mm_cmpistrm (ranges, chunk, mode);
  const __m128i mask = _mm_and_si128 (tmp1, diff);

  _mm_storeu_si128 (dst, _mm_xor_si128 (chunk, mask));
}

      if (_mm_cmpistrz (ranges, chunk, mode))
break;
    }
}

#ifdef MAIN
#include <unistd.h>
#include <string.h>
int main(void) {
char src[128], dest[128];
int n = read(0, &src, sizeof(src));
if (n < 1)
 1;
src[n] = 0;
sse_tolower_strcpy(dest, src);
write(2, dest, strlen(dest));
return 0;
}
#endif
EOF

        .file   ""
        .section        .text.unlikely,"ax",@progbits
.LCOLDB2:
        .text
.LHOTB2:
        .p2align 4,,15
        .globl  sse_tolower_strcpy
        .type   sse_tolower_strcpy, @function
sse_tolower_strcpy:
.LFB641:
        .cfi_startproc
        movdqa  .LC0(%rip), %xmm2
        movdqa  .LC1(%rip), %xmm3
        jmp     .L4
        .p2align 4,,10
        .p2align 3
.L2:
        pcmpistrm       $68, %xmm1, %xmm2
        je      .L1
.L9:
        addq    $16, %rsi
        addq    $16, %rdi
.L4:
        movdqu  (%rsi), %xmm1
        pcmpistrm       $68, %xmm1, %xmm2
        jnc     .L2
        pand    %xmm3, %xmm0
        pxor    %xmm1, %xmm0
        movups  %xmm0, (%rdi)
        pcmpistrm       $68, %xmm1, %xmm2
        jne     .L9
.L1:
        rep ret
        .cfi_endproc
.LFE641:
        .size   sse_tolower_strcpy, .-sse_tolower_strcpy
        .section        .text.unlikely
.LCOLDE2:
        .text
.LHOTE2:
        .section        .rodata.cst16,"aM",@progbits,16
        .align 16
.LC0:
        .byte   65
        .byte   90
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .byte   0
        .align 16
.LC1:
        .quad   2314885530818453536
        .quad   2314885530818453536
        .ident  "GCC: (Debian 5.1.1-12) 5.1.1 20150622"
        .section        .note.GNU-stack,"",@progbits


This would be *much* smaller and supposedly is also faster:
   text    data     bss     dec     hex filename
    228       0       0     228      e4 comment0.o
    153       0       0     153      99 comment1.o


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

* [Bug c/66613] error in evaluationg cexp
  2015-06-20 12:56 [Bug c/66613] New: error in evaluationg cexp ka_bena at yahoo dot fr
  2015-06-21 21:20 ` [Bug c/66613] " miyuki at gcc dot gnu.org
  2015-07-02 13:08 ` ka_bena at yahoo dot fr
@ 2015-07-02 13:14 ` ka_bena at yahoo dot fr
  2 siblings, 0 replies; 4+ messages in thread
From: ka_bena at yahoo dot fr @ 2015-07-02 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from BENAÏSSA <ka_bena at yahoo dot fr> ---
Thank you for your mail.I do not know where is the error but after execution I
do not have the good result. anyway!
Compile Flags:

  -std=c99
-Warray-bounds
 -Wall
 -Wextra 

-Waddress
 -Wbad-function-cast
 -Wformat
 -Wformat-contains-nul
 -Wformat-extra-args
-Wformat-nonliteral
-Wformat-security
 -Wformat-zero-length
-Wmissing-format-attribute
 -Woverlength-strings
 -foptional-diags
-Woverlength-strings
 -malign-stringops

-malign-stringops

-lm

-llquadmath

I work with windowsXP on Compaq 6720S.

I use gcc provided by gfortran.

I hope that those informations can be useful.
     thank you A.BENAISSA 



     Le Dimanche 21 juin 2015 12h37, "michael.lehn@uni-ulm.de"
<gcc-bugzilla@gcc.gnu.org> a écrit :


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

Michael Lehn <michael.lehn@uni-ulm.de> changed:

          What    |Removed                    |Added
----------------------------------------------------------------------------
                CC|                            |michael.lehn@uni-ulm.de

--- Comment #1 from Michael Lehn <michael.lehn@uni-ulm.de> ---
> //> Terminated with exit code 0.

So were is the error?
>From gcc-bugs-return-491283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 02 13:52:48 2015
Return-Path: <gcc-bugs-return-491283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2663 invoked by alias); 2 Jul 2015 13:52:47 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 2596 invoked by uid 48); 2 Jul 2015 13:52:40 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/66741] loops not fused nor vectorized
Date: Thu, 02 Jul 2015 13:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-66741-4-LBMNeYGVF0@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66741-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66741-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg00173.txt.bz2
Content-length: 732

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf741

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-02
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Loop fusion is not implemented also strcpy is expanded inline too late (during
RTL expansion) and thus the two loops are exposed too late for the place where
it would be implemented.

Same reason for not vectorizing __builtin_tolower - it's expanded too late.


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

end of thread, other threads:[~2015-07-02 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-20 12:56 [Bug c/66613] New: error in evaluationg cexp ka_bena at yahoo dot fr
2015-06-21 21:20 ` [Bug c/66613] " miyuki at gcc dot gnu.org
2015-07-02 13:08 ` ka_bena at yahoo dot fr
2015-07-02 13:14 ` ka_bena at yahoo dot fr

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