<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>I don't have a strong preference, though it is clear we should
pick one. I'd mildly prefer the select form for readability.
From an optimization standpoint, I see reasonable arguments for
either. <br>
</p>
<p>Philip<br>
</p>
<br>
<div class="moz-cite-prefix">On 08/28/2016 12:37 PM, Sanjay Patel
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CA+wODiuW3sgJx_esPSaf28H+HaYkBXq0xxRUKFVGeMKkxqoWPw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>A vector select with a constant vector condition operand:<br>
<br>
define <4 x i32> @foo(<4 x i32> %a, <4 x
i32> %b) {<br>
%sel = select <4 x i1> <i1 true, i1 false, i1
false, i1 true>, <4 x i32> %a, <4 x i32> %b<br>
ret <4 x i32> %sel<br>
}<br>
<br>
<br>
...is equivalent to a shufflevector:<br>
<br>
define <4 x i32> @goo(<4 x i32> %a, <4 x
i32> %b) {<br>
%shuf = shufflevector <4 x i32> %a, <4 x i32>
%b, <4 x i32> <i32 0, i32 5, i32 6, i32 3><br>
ret <4 x i32> %shuf<br>
}<br>
<br>
<br>
For the goal of canonicalization in IR, which of these should
we prefer? Some backend / lowering differences for AArch64 and
PPC are noted in:<br>
<a moz-do-not-send="true"
href="https://llvm.org/bugs/show_bug.cgi?id=28530">https://llvm.org/bugs/show_bug.cgi?id=28530</a><br>
<a moz-do-not-send="true"
href="https://llvm.org/bugs/show_bug.cgi?id=28531">https://llvm.org/bugs/show_bug.cgi?id=28531</a><br>
<br>
</div>
x86 converts either form optimally in all cases I've looked at.<br>
<div><br>
This question first came up in D22114 ( <a
moz-do-not-send="true"
href="https://reviews.llvm.org/D22114">https://reviews.llvm.org/D22114</a>
) and is extended in D23886 ( <a moz-do-not-send="true"
href="https://reviews.llvm.org/D23886">https://reviews.llvm.org/D23886</a>
) with a constant value example.<br>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>