[PATCH] D15604: Changes in conversion cost model for X86 target

Demikhovsky, Elena via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 23:36:40 PST 2015


The getTypeLegalizationCost() shows only split-factor for vectors. It does not show promotion, sign-extend, zero-extend, widening cost.
Now, let's assume that we have vector-spilt. I take the max split-factor between source and destination. (And this is right, agree?)

In case of promotion/widening the getTypeLegalizationCost() does not help. It just show the new types after promotion.
For example v4i8  sext to v4i32, the type legalization result will be v4i32 sext to v4i32.
Or v2i8 to v2f32 - the type legalization will convert the operation to "  v2i64 to v4f32 ".
It is very difficult to describe the right cost in this mode. If you don't have any automatic engine for the cost estimation, it is easier to put the right cost for v2i8 to v2f32.

The only one thing that I, probably, forgot is
V8i16 -> v8f64 on AVX2
The result will be
V4i32 to v4f64 and I want to see v4i16 to v4f64. This way I'll be able to add SEXT cost from v4i16 to v4i32.

Why did I start to rewrite?

Because one operation
%a = sext i32 %b to i64
Does not allow to vectorize the whole loop to 16, just because the cost of "%a = sext <16 x i32>%b to <16 x 64>" is 300 instead of 2.

-  Elena


-----Original Message-----
From: Nadav Rotem [mailto:nrotem at apple.com] 
Sent: Friday, December 18, 2015 02:23
To: Demikhovsky, Elena <elena.demikhovsky at intel.com>; hfinkel at anl.gov; Andrea_DiBiagio at sn.scee.net; nrotem at apple.com; congh at google.com
Cc: llvm-commits at lists.llvm.org
Subject: Re: [PATCH] D15604: Changes in conversion cost model for X86 target

nadav added inline comments.

================
Comment at: ../lib/Target/X86/X86TargetTransformInfo.cpp:812
@@ -805,4 +811,3 @@
 
-  // The function getSimpleVT only handles simple value types.
-  if (!SrcTy.isSimple() || !DstTy.isSimple())
-    return BaseT::getCastInstrCost(Opcode, Dst, Src);
+  MVT SrcVT;
+  MVT DstVT;
----------------
Elena, I don't understand the logic below. It looks like you are re-implementing type legalization in the code model code. Why not just use getTypeLegalizationCost ?

Can you give an example where the existing logic fails?


Repository:
  rL LLVM

http://reviews.llvm.org/D15604



---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the llvm-commits mailing list