]> granicus.if.org Git - llvm/commitdiff
[x86] explicitly set cost of integer add/sub
authorSanjay Patel <spatel@rotateright.com>
Sun, 6 Jan 2019 16:21:42 +0000 (16:21 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 6 Jan 2019 16:21:42 +0000 (16:21 +0000)
There are no test changes here in the existing cost model
regression tests because integer add/sub have a default
legal cost of 1 already. This would break, however, if
we custom lower those ops because the default cost model
assumes that custom-lowered ops are more expensive.

This is similar to the change in rL350403. See discussion
in D56011 for more details. When we enhance that patch to
handle integer ops, we need this cost model change to avoid
unintended diffs here from the custom lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350496 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86TargetTransformInfo.cpp

index bce3a061b8eb88ce59836156eda6b532374cc3d4..a3592565c0f267d89a6099a2d5b5ff2627d1933a 100644 (file)
@@ -853,6 +853,14 @@ int X86TTIImpl::getArithmeticInstrCost(
 
     { ISD::FSUB, MVT::f32,    1 }, // Pentium III from http://www.agner.org/
     { ISD::FSUB, MVT::v4f32,  2 }, // Pentium III from http://www.agner.org/
+
+    { ISD::ADD, MVT::i8,      1 }, // Pentium III from http://www.agner.org/
+    { ISD::ADD, MVT::i16,     1 }, // Pentium III from http://www.agner.org/
+    { ISD::ADD, MVT::i32,     1 }, // Pentium III from http://www.agner.org/
+
+    { ISD::SUB, MVT::i8,      1 }, // Pentium III from http://www.agner.org/
+    { ISD::SUB, MVT::i16,     1 }, // Pentium III from http://www.agner.org/
+    { ISD::SUB, MVT::i32,     1 }, // Pentium III from http://www.agner.org/
   };
 
   if (ST->hasSSE1())