Bug 24903 - dotprod should use __builtin_conj
Summary: dotprod should use __builtin_conj
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.1.0
: P3 minor
Target Milestone: 4.1.1
Assignee: Francois-Xavier Coudert
URL: http://gcc.gnu.org/ml/fortran/2006-02...
Keywords: patch
Depends on:
Blocks:
 
Reported: 2005-11-16 19:02 UTC by Andrew Pinski
Modified: 2006-03-04 08:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.1 4.2.0
Known to fail:
Last reconfirmed: 2006-02-06 22:16:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-11-16 19:02:54 UTC
Right now dotprod_c* does:
./generated/dotprod_c4.c:      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));
./generated/dotprod_c16.c:      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));
./generated/dotprod_c8.c:      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));
./generated/dotprod_c10.c:      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));


When it should be doing:
conjga = conj(*pa);
or
conjga = conjl(*pa);
or
conjga = conjf(*pa);

Depending on which type it is.

Or it could use the GNU extension which overrides ~ for conjugation.

conjga = ~*pa;
Comment 1 Andrew Pinski 2005-11-20 00:40:09 UTC
Confirmed.
Comment 2 Francois-Xavier Coudert 2005-11-21 09:11:00 UTC
(In reply to comment #0)
> conjga = conj(*pa);
> or
> conjga = conjl(*pa);
> or
> conjga = conjf(*pa);

I'm ready to do that, but since complex numbers in C are always a pain, I want to know: are we sure that conj/conjf/conjl are *always* available? I mean, are they part of the things gcc provides even if there is no library support for them in the runtime libm?
Comment 3 Andrew Pinski 2005-11-21 22:53:43 UTC
(In reply to comment #2)
> I'm ready to do that, but since complex numbers in C are always a pain, I 
> want to know: are we sure that conj/conjf/conjl are *always* available? I
> mean, are they part of the things gcc provides even if there is no library
> support for them in the runtime libm?

Hmm, I have to think about that but you can always use the GCC extension :) as mentioned before.

I think the builtin version of conj/conjf/conjl (__builtin_conj/__builtin_conjf/__builtin_conjl) is always expanded to CONJ_EXPR but I could be wrong.
Comment 4 Francois-Xavier Coudert 2006-02-16 07:52:27 UTC
Subject: Bug 24903

Author: fxcoudert
Date: Thu Feb 16 07:52:22 2006
New Revision: 111131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111131
Log:
	PR libfortran/24903
	* m4/dotprodc.m4: Use __builtin_conj instead of assigning real
	and imaginary parts separately.
	* generated/dotprod_c4.c: Regenerated.
	* generated/dotprod_c8.c: Regenerated.
	* generated/dotprod_c10.c: Regenerated.
	* generated/dotprod_c16.c: Regenerated.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/generated/dotprod_c10.c
    trunk/libgfortran/generated/dotprod_c16.c
    trunk/libgfortran/generated/dotprod_c4.c
    trunk/libgfortran/generated/dotprod_c8.c
    trunk/libgfortran/m4/dotprodc.m4

Comment 5 Francois-Xavier Coudert 2006-03-04 08:53:23 UTC
Subject: Bug 24903

Author: fxcoudert
Date: Sat Mar  4 08:53:18 2006
New Revision: 111708

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111708
Log:
	PR libfortran/24903
	* m4/dotprodc.m4: Use __builtin_conj instead of assigning real
	and imaginary parts separately.
	* generated/dotprod_c4.c: Regenerated.
	* generated/dotprod_c8.c: Regenerated.
	* generated/dotprod_c10.c: Regenerated.
	* generated/dotprod_c16.c: Regenerated.

Modified:
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/generated/dotprod_c10.c
    branches/gcc-4_1-branch/libgfortran/generated/dotprod_c16.c
    branches/gcc-4_1-branch/libgfortran/generated/dotprod_c4.c
    branches/gcc-4_1-branch/libgfortran/generated/dotprod_c8.c
    branches/gcc-4_1-branch/libgfortran/m4/dotprodc.m4

Comment 6 Francois-Xavier Coudert 2006-03-04 08:55:04 UTC
Fix commited to 4.1.