<div dir="ltr">Hi Silviu,<div><br></div><div>I agree that we're no longer pessimizing select patterns on ARM or AArch64 with oversize vectors (although I haven't checked i64's, so I'll take your advice there), so this LGTM.</div><div><br></div><div>But please wait for any objections from Nadav/Arnold/Gerolf as it was Nadav and Arnold who added this change in the first place (copied from ARM).</div><div><br></div><div>James</div><br><div class="gmail_quote"><div dir="ltr">On Wed, 9 Sep 2015 at 12:44 <a href="mailto:silviu.baranga@arm.com">silviu.baranga@arm.com</a> via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">sbaranga created this revision.<br>
sbaranga added a subscriber: llvm-commits.<br>
Herald added subscribers: rengolin, aemerson.<br>
<br>
We are not scalarizing the wide selects in codegen for i16 and i32 and<br>
therefore we can remove the amortization factor. We still have issues<br>
with i64 vectors in codegen though.<br>
<br>
<a href="http://reviews.llvm.org/D12724" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12724</a><br>
<br>
Files:<br>
  lib/Target/AArch64/AArch64TargetTransformInfo.cpp<br>
  test/Analysis/CostModel/AArch64/select.ll<br>
<br>
Index: lib/Target/AArch64/AArch64TargetTransformInfo.cpp<br>
===================================================================<br>
--- lib/Target/AArch64/AArch64TargetTransformInfo.cpp<br>
+++ lib/Target/AArch64/AArch64TargetTransformInfo.cpp<br>
@@ -380,15 +380,16 @@<br>
                                        Type *CondTy) {<br>
<br>
   int ISD = TLI->InstructionOpcodeToISD(Opcode);<br>
-  // We don't lower vector selects well that are wider than the register width.<br>
+  // We don't lower some vector selects well that are wider than the register<br>
+  // width.<br>
   if (ValTy->isVectorTy() && ISD == ISD::SELECT) {<br>
     // We would need this many instructions to hide the scalarization happening.<br>
     const int AmortizationCost = 20;<br>
     static const TypeConversionCostTblEntry<MVT::SimpleValueType><br>
     VectorSelectTbl[] = {<br>
-      { ISD::SELECT, MVT::v16i1, MVT::v16i16, 16 * AmortizationCost },<br>
-      { ISD::SELECT, MVT::v8i1, MVT::v8i32, 8 * AmortizationCost },<br>
-      { ISD::SELECT, MVT::v16i1, MVT::v16i32, 16 * AmortizationCost },<br>
+      { ISD::SELECT, MVT::v16i1, MVT::v16i16, 16 },<br>
+      { ISD::SELECT, MVT::v8i1, MVT::v8i32, 8 },<br>
+      { ISD::SELECT, MVT::v16i1, MVT::v16i32, 16 },<br>
       { ISD::SELECT, MVT::v4i1, MVT::v4i64, 4 * AmortizationCost },<br>
       { ISD::SELECT, MVT::v8i1, MVT::v8i64, 8 * AmortizationCost },<br>
       { ISD::SELECT, MVT::v16i1, MVT::v16i64, 16 * AmortizationCost }<br>
Index: test/Analysis/CostModel/AArch64/select.ll<br>
===================================================================<br>
--- test/Analysis/CostModel/AArch64/select.ll<br>
+++ test/Analysis/CostModel/AArch64/select.ll<br>
@@ -17,22 +17,22 @@<br>
   ; CHECK: cost of 1 {{.*}} select<br>
   %v6 = select i1 undef, double undef, double undef<br>
<br>
-  ; Vector values - check for vectors that have a high cost because they end up<br>
-  ; scalarized.<br>
-  ; CHECK: cost of 320 {{.*}} select<br>
+  ; CHECK: cost of 16 {{.*}} select<br>
   %v13b = select <16 x i1>  undef, <16 x i16> undef, <16 x i16> undef<br>
<br>
-  ; CHECK: cost of 160 {{.*}} select<br>
+  ; CHECK: cost of 8 {{.*}} select<br>
   %v15b = select <8 x i1>  undef, <8 x i32> undef, <8 x i32> undef<br>
-  ; CHECK: cost of 320 {{.*}} select<br>
+  ; CHECK: cost of 16 {{.*}} select<br>
   %v15c = select <16 x i1>  undef, <16 x i32> undef, <16 x i32> undef<br>
<br>
+  ; Vector values - check for vectors of i64s that have a high cost because<br>
+  ; they end up scalarized.<br>
   ; CHECK: cost of 80 {{.*}} select<br>
   %v16a = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef<br>
   ; CHECK: cost of 160 {{.*}} select<br>
   %v16b = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef<br>
   ; CHECK: cost of 320 {{.*}} select<br>
   %v16c = select <16 x i1> undef, <16 x i64> undef, <16 x i64> undef<br>
<br>
-    ret void<br>
+  ret void<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>