------- Comment #2 from fxcoudert at gcc dot gnu dot org  2006-10-22 23:14 
-------
I've been thinking a bit about this. It's a common case, and it would probably
be worth optimizing it.

We could detect in iresolve.c (gfc_resolve_matmul) that one (or both) of the
arguments to MATMUL is a call to CONJ, and then rewrite the code to be
MATMUL(A,B,2) instead of MATMUL(A,CONJG(B)), where the 2 is an extra "hidden"
integer argument that means here that the second MATMUL arg is to be conjugated
during the matrix multiplication.

After that, we could also detect in iresolve.c (gfc_resolve_conjg) when the
result of a matmul call is conjugated (C = CONJG(MATMUL(A,B))) and optimize
this as well.

Notes for a wannabe coder: that argument a (or b) is the conjg function can be
identified by (a->expr_type == EXPR_FUNCTION &&
a->value.function->isym->generic_id == GFC_ISYM_CONJG). Rewriting the
expressions might be a bit subtle, but not so hard; for the extra argument, see
how the rrspacing and spacing intrinsics are implemented.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2006-10-22 18:45:29         |2006-10-22 23:14:54
               date|                            |
            Summary|Optimize -fexternal-blas    |Optimize -fexternal-blas
                   |calls for conj()            |calls for conjg()


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

Reply via email to