[PATCH] D114174: [ARM][CodeGen] Add support for complex addition and multiplication

Nicholas Guy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 03:31:50 PST 2022


NickGuy added a comment.

In D114174#3307302 <https://reviews.llvm.org/D114174#3307302>, @dnsampaio wrote:

> ...
> I'm not exactly sure why to do target specific pattern matching here. We could simply add generic complex intrinsics and the different patterns could be matched at each archs ISEL, no? I do agree that it should check in the backend if it should generate a complex operation of a given vector type.
> ...
> Is there any strong reason to create target specific intrinsics instead of having generic intrinsics with polymorphism? Such as llvm.complex.add.v2f32?

I wanted to avoid adding target-independent intrinsics, as doing so might require substantial upstream consensus (Though this is being worked on in D119287 <https://reviews.llvm.org/D119287>). My thinking was that we can work on targeting our own architectures first, and then match incoming target-independent intrinsics after they are implemented. Additionally, IR intrinsics for Arm and AArch64 are already implemented, further reducing the amount of work required to enable initial support.

> These difference can't be detected at isel?

Unless I'm missing something, there aren't any differences to be detected by isel. The distinction only applies when generating the relevant IR intrinsic, whereas isel is responsible for substituting the IR intrinsic with the instruction/s (in my understanding).

> In a more global view, how do you plan to generate such input patterns detected here?

The patterns I've been focusing on are those emitted after loop vectorisation (which incidentally are also those emitted using std::complex with `-ffast-math`), because the MVE and Neon complex number instructions are vector instructions. Scalar patterns (like those in your linked snippet) are planned, but will require a bit more work to implement properly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114174/new/

https://reviews.llvm.org/D114174



More information about the llvm-commits mailing list