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

Graham Hunter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 02:03:22 PDT 2022


huntergr added inline comments.


================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:482
+      Op1->getOpcode() == Instruction::FAdd) {
+    Rotation = 90;
+  } else if (Op0->getOpcode() == Instruction::FAdd &&
----------------
I can't find any place where rotations are dealt with besides assignment and equality checks of 0,90,180,270 -- might an enum be preferable? Or do you anticipate doing arithmetic with them in a follow-up patch?


================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:690
+    if (auto *SVI = dyn_cast<ShuffleVectorInst>(&I)) {
+      if (isInterleaving(SVI)) {
+        if(traverseAndPopulateGraph(TL, SVI, Graph, Support)) {
----------------
I think it would be worthwhile to add a comment about what the interleaving represents -- that you're looking for a shuffle that takes separate vectors of real and imaginary parts and combines them before they are stored to memory (or returned in registers), and that this is just for matching per-lane operations instead of cross-lane (like a reduction).

Or at least that's the behaviour I've observed when testing your patch with a loop like the following:


```
#define LEN (512)
float _Complex a[ LEN ];
float _Complex b[ LEN ];
float _Complex c[ LEN ];

void foo (void) {
#pragma clang loop vectorize(enable)
  for (int i = 0; i < LEN; ++i)
    a[i] = b[i] * c[i];
}
```


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