[llvm-dev] RFC: Complex in LLVM

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 8 10:18:12 PDT 2019


-----Original Message-----
From: Chris Lattner <clattner at nondot.org>
Sent: Wednesday, July 3, 2019 8:06 PM
To: Krzysztof Parzyszek <kparzysz at quicinc.com>
Cc: David Greene <dag at cray.com>; llvm-dev at lists.llvm.org
Subject: [EXT] Re: [llvm-dev] RFC: Complex in LLVM

>> On Jul 3, 2019, at 4:43 PM, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> Hexagon has instructions to do complex multiplication on pairs i16 x i16 (plus variants like accumulate, conjugate, etc.).
>
> How difficult are these to pattern match on scalar code?

I can only echo what others have already written---if the complex operation is isolated, it's not too hard, but when there are other calculations involved, (such as ... + cmpy(expr1, expr2) + ...), then it becomes highly dependent on what the surrounding code looks like.  Our customers use Hexagon-specific builtins when they need these instructions to be generated.
Another issue with patterns is that complex operations really produce two values.  One approach could be to match the real and the imaginary parts separately and hope that both generate the same instruction (there will be two of them, but they will be commoned).  If that fails, we may end up with a complex instruction for only one part and a redundant calculation for the other.

-Krzysztof



More information about the llvm-dev mailing list