summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-10 09:30:29 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-10 09:30:29 +0000
commitbf66f38705dce08ea9049959e53100f2b9a8659f (patch)
tree6b7187514fdce9d96c566f6ac631ec36f1f4bd9f
parent3d4579829e85c108e729ade64d778e614b702e16 (diff)
downloadbcm5719-llvm-bf66f38705dce08ea9049959e53100f2b9a8659f.tar.gz
bcm5719-llvm-bf66f38705dce08ea9049959e53100f2b9a8659f.zip
[SystemZ] Temporarily disable high VFs with integer div/rem.
Until mischeduler is clever enough to avoid spilling in a vectorized loop with many (scalar) DLRs it is better to avoid high vectorization factors (8 and above). llvm-svn: 344129
-rw-r--r--llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp7
-rw-r--r--llvm/test/Analysis/CostModel/SystemZ/int-arith.ll67
2 files changed, 42 insertions, 32 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
index 6efd7f66303..6f553d5bed3 100644
--- a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
@@ -401,6 +401,13 @@ int SystemZTTIImpl::getArithmeticInstrCost(
if (SDivPow2)
return (NumVectors * SDivCostEstimate);
+ // Temporary hack: disable high vectorization factors with integer
+ // division/remainder, which will get scalarized and handled with GR128
+ // registers. The mischeduler is not clever enough to avoid spilling yet.
+ if ((Opcode == Instruction::UDiv || Opcode == Instruction::SDiv ||
+ Opcode == Instruction::URem || Opcode == Instruction::SRem) && VF > 4)
+ return 1000;
+
// These FP operations are supported with a single vector instruction for
// double (base implementation assumes float generally costs 2). For
// FP128, the scalar cost is 1, and there is no overhead since the values
diff --git a/llvm/test/Analysis/CostModel/SystemZ/int-arith.ll b/llvm/test/Analysis/CostModel/SystemZ/int-arith.ll
index 518c9b01e4e..3ecf4342b94 100644
--- a/llvm/test/Analysis/CostModel/SystemZ/int-arith.ll
+++ b/llvm/test/Analysis/CostModel/SystemZ/int-arith.ll
@@ -2,6 +2,9 @@
;
; Note: The scalarized vector instructions costs are not including any
; extracts, due to the undef operands.
+;
+; Note: Vectorization of division/remainder is temporarily disabled for high
+; vectorization factors by returning 1000.
define void @add() {
%res0 = add i8 undef, undef
@@ -175,14 +178,14 @@ define void @sdiv() {
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = sdiv <4 x i16> undef, undef
; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = sdiv <4 x i32> undef, undef
; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res11 = sdiv <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res12 = sdiv <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res13 = sdiv <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res14 = sdiv <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res15 = sdiv <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res16 = sdiv <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res17 = sdiv <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %res18 = sdiv <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res19 = sdiv <16 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = sdiv <8 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = sdiv <8 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = sdiv <8 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = sdiv <8 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = sdiv <16 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = sdiv <16 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = sdiv <16 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = sdiv <16 x i64> undef, undef
ret void;
}
@@ -221,14 +224,14 @@ define void @srem() {
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = srem <4 x i16> undef, undef
; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = srem <4 x i32> undef, undef
; CHECK: Cost Model: Found an estimated cost of 6 for instruction: %res11 = srem <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res12 = srem <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res13 = srem <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res14 = srem <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res15 = srem <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res16 = srem <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res17 = srem <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %res18 = srem <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res19 = srem <16 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = srem <8 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = srem <8 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = srem <8 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = srem <8 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = srem <16 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = srem <16 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = srem <16 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = srem <16 x i64> undef, undef
ret void;
}
@@ -267,14 +270,14 @@ define void @udiv() {
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = udiv <4 x i16> undef, undef
; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = udiv <4 x i32> undef, undef
; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res11 = udiv <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res12 = udiv <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res13 = udiv <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res14 = udiv <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res15 = udiv <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res16 = udiv <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res17 = udiv <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %res18 = udiv <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res19 = udiv <16 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = udiv <8 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = udiv <8 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = udiv <8 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = udiv <8 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = udiv <16 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = udiv <16 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = udiv <16 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = udiv <16 x i64> undef, undef
ret void;
}
@@ -313,14 +316,14 @@ define void @urem() {
; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res9 = urem <4 x i16> undef, undef
; CHECK: Cost Model: Found an estimated cost of 12 for instruction: %res10 = urem <4 x i32> undef, undef
; CHECK: Cost Model: Found an estimated cost of 10 for instruction: %res11 = urem <4 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res12 = urem <8 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res13 = urem <8 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 24 for instruction: %res14 = urem <8 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 20 for instruction: %res15 = urem <8 x i64> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res16 = urem <16 x i8> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 80 for instruction: %res17 = urem <16 x i16> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 48 for instruction: %res18 = urem <16 x i32> undef, undef
-; CHECK: Cost Model: Found an estimated cost of 40 for instruction: %res19 = urem <16 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res12 = urem <8 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res13 = urem <8 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res14 = urem <8 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res15 = urem <8 x i64> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res16 = urem <16 x i8> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res17 = urem <16 x i16> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res18 = urem <16 x i32> undef, undef
+; CHECK: Cost Model: Found an estimated cost of 1000 for instruction: %res19 = urem <16 x i64> undef, undef
ret void;
}
OpenPOWER on IntegriCloud