<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks, and we are happy to pick this up as we are keen to start somewhere with this.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We might for a slightly different approach though: instead of using target independent intrinsics, we are thinking of target dependent intrinsics. I.e., in a CodeGen pass we would like to recognise complex arithmetic and emit target intrinsics for this if the
 target supports this. The output of the loop/SLP vectorisers seem good enough that we can do this matching in a CodeGen pass and by using target dependent intrinsics avoid the more controversial discussion about introducing target independent intrinsics that
 other passes then potentially must deal with. Thus, avoid canonicalisation of complex arithmetic in IR, for now. I see that as something complementary to this approach, because if a complex as first-class types/instructions initiative is kicked off that will
 be a big undertaking that will take some time. In the meantime, we are going to prototype a few things and can give an update here once we know a bit more, and expect that we can support quite a lot of cases with this approach (and we are interested in different
 targets: MVE, Neon/SVE).</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,<br>
Sjoerd.<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Florian Hahn <florian_hahn@apple.com><br>
<b>Sent:</b> 04 October 2021 11:16<br>
<b>To:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com>; llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Cc:</b> David Greene <greened@obbligato.org>; Steve (Numerics) Canon <scanon@apple.com>; Nicholas Guy <Nicholas.Guy@arm.com><br>
<b>Subject:</b> Re: [llvm-dev] Complex proposal v3 + roundtable agenda</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space"><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Sep 30, 2021, at 14:23, Sjoerd Meijer <<a href="mailto:Sjoerd.Meijer@arm.com" class="">Sjoerd.Meijer@arm.com</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Hello,</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
I would like to revive this thread.</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
We started thinking about supporting complex number support, for the same reason Florian stated in his first mail. The idea before I googled and stumbled on this thread, was the same as Florian proposed. So yes, I would like to support this approach.<span class="x_Apple-converted-space"> </span><span id="x_๐Ÿ™‚" class="">๐Ÿ™‚</span><span class="x_Apple-converted-space"> </span>I
 would like to add that GCC's approach is the same/similar: complex number patterns are recognised in the SLP vectoriser, and complex number builtins are emitted (and then matched later).<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" style="font-style:normal; font-variant-caps:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Any objections if we go for this approach? Florian, any plans to pick this up?<br class="">
</div>
</div>
</blockquote>
<br class="">
</div>
<div><br class="">
</div>
<div>I still think the intrinsics route is a good way to start and to incrementally improve support for architectures that have dedicated instructions for complex multiply & co relatively quickly. I rebased the patches sketching support for such an intrinsic
 on AArch64 (<a href="https://reviews.llvm.org/D91346" class="">https://reviews.llvm.org/D91346</a> and stacked patches). But I wonโ€™t be able to continue lobbying for this approach in the near future. Iโ€™d be more than happy if anybody would be interested in
 picking this up.</div>
<div><br class="">
</div>
<div>Cheers,</div>
<div>Florian</div>
<br class="">
</div>
</body>
</html>