[LLVMdev] Performance regression on ARM (original) (raw)
Stephen Checkoway s at pahtak.org
Sun Oct 19 18:10:26 PDT 2014
- Previous message: [LLVMdev] Performance regression on ARM
- Next message: [LLVMdev] Performance regression on ARM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 18, 2014, at 5:25 PM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
On Sun, Oct 19, 2014 at 06:58:53AM +0700, C Bergström wrote:
On Sun, Oct 19, 2014 at 6:45 AM, Joerg Sonnenberger <joerg at britannica.bec.de
wrote:
On Sun, Oct 19, 2014 at 06:31:24AM +0700, C Bergström wrote: I apologize that I haven't been able to follow this thread entirely, but if someone gives me a Fortran testcase I can check what Fortran+llvm would do currently and maybe give more feedback.
Short version: if you multiple or divide a complex number by a real number, is it valid to just do the trivial component wise computation? What about multiplying with / dividing by a pure imaginary number?
I'll try to get a solid answer, but for clarity.. Fortran has types REAL and CMPLX. I'm not sure if you mean INT or REAL when you say "real" number.. I am using "real" in the mathematical sense, so cast/promotion from either INT or REAL would fit.
Mathematically, a*(b+ic) = ab +iac where a, b, and c are arbitrary real numbers. Division by nonzero a is identical to multiplication by 1/a. I have no idea what language specs say, however.
In general, multiplying complex numbers in rectangular form is pretty straight-forward: (a+ib)(c+id) = ac - bd + i(ad+bc).
Division is a little more of a hassle: (a+ib)/(c+id) = (a+ib)(c-id)/(c^2 + d^2) = (ac + bd)/(c^2 + d^2) + i(bc - ad)/(c^2 + d^2).
(Polar form is more convenient for multiplication and division: aexp(is) * bexp(it) = abexp(i(s+t)) and division by nonzero aexp(is) is the same as multiplication by 1/a exp(-is). Addition and subtraction become annoying though.)
-- Stephen Checkoway
- Previous message: [LLVMdev] Performance regression on ARM
- Next message: [LLVMdev] Performance regression on ARM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]