[PATCH] [X86] Use ADD/SUB instead of INC/DEC for Silvermont

Nadav Rotem nrotem at apple.com
Wed Jun 4 22:33:41 PDT 2014


Hi Alexey, 

Can you please reduce the size of the testcase? It is really big. 


-    if (ConstantSDNode *C =
-        dyn_cast<ConstantSDNode>(ArithOp.getNode()->getOperand(1))) {
-      // An add of one will be selected as an INC.
-      if (C->getAPIntValue() == 1) {
-        Opcode = X86ISD::INC;
-        NumOperands = 1;
-        break;
-      }
+    if (!Subtarget->slowIncDec())
+      if (ConstantSDNode *C =
+          dyn_cast<ConstantSDNode>(ArithOp.getNode()->getOperand(1))) {
+        // An add of one will be selected as an INC.
+        if (C->getAPIntValue() == 1) {
+          Opcode = X86ISD::INC;
+          NumOperands = 1;
+          break;
+        }

Can you please perform the slowIncDec check after the ‘&&’ operator inside the second if?  This will help reducing the compile time and allow you to change less code. 

Will this work?
-def : Pat<(add GR16:$src, -1), (DEC16r    GR16:$src)>, Requires<[Not64BitMode, NotSlowIncDec]>;

Everything else looks okay. 

Thanks,
Nadav


On Jun 2, 2014, at 7:28 AM, Alexey Volkov <avolkov.intel at gmail.com> wrote:

> <D3990.10015.patch>





More information about the llvm-commits mailing list