if (ST->hasSSE2() &&
((Op2Info == TargetTransformInfo::OK_UniformConstantValue) ||
(Op2Info == TargetTransformInfo::OK_UniformValue))) {
+
+ // Handle AVX2 uniform v4i64 ISD::SRA, it's not worth a table.
+ if (ISD == ISD::SRA && LT.second == MVT::v4i64 && ST->hasAVX2())
+ return LT.first * 4; // 2*psrad + shuffle.
+
if (const auto *Entry =
CostTableLookup(SSE2UniformShiftCostTable, ISD, LT.second))
return LT.first * Entry->Cost;
; SSE2: Found an estimated cost of 8 for instruction: %shift
; SSE41: Found an estimated cost of 8 for instruction: %shift
; AVX: Found an estimated cost of 10 for instruction: %shift
-; AVX2: Found an estimated cost of 10 for instruction: %shift
+; AVX2: Found an estimated cost of 4 for instruction: %shift
; AVX512: Found an estimated cost of 1 for instruction: %shift
; XOP: Found an estimated cost of 6 for instruction: %shift
%insert = insertelement <4 x i64> undef, i64 %b, i32 0
; SSE2: Found an estimated cost of 16 for instruction: %shift
; SSE41: Found an estimated cost of 16 for instruction: %shift
; AVX: Found an estimated cost of 20 for instruction: %shift
-; AVX2: Found an estimated cost of 20 for instruction: %shift
+; AVX2: Found an estimated cost of 8 for instruction: %shift
; AVX512: Found an estimated cost of 1 for instruction: %shift
; XOP: Found an estimated cost of 12 for instruction: %shift
%insert = insertelement <8 x i64> undef, i64 %b, i32 0