[ARM] simplifying t2_so_imm_neg as suggested by Eli Friedman in D31242 (NFC)
authorArtyom Skrobov <Artyom.Skrobov@arm.com>
Wed, 22 Mar 2017 23:12:59 +0000 (23:12 +0000)
committerArtyom Skrobov <Artyom.Skrobov@arm.com>
Wed, 22 Mar 2017 23:12:59 +0000 (23:12 +0000)
llvm-svn: 298559

llvm/lib/Target/ARM/ARMInstrThumb2.td

index 45ab655..b52a7ce 100644 (file)
@@ -110,11 +110,8 @@ def t2_so_imm_notSext : Operand<i32>, PatLeaf<(imm), [{
 
 // t2_so_imm_neg - Match an immediate that is a negation of a t2_so_imm.
 def t2_so_imm_neg_asmoperand : AsmOperandClass { let Name = "T2SOImmNeg"; }
-def t2_so_imm_neg : Operand<i32>, PatLeaf<(imm), [{
-  int64_t Value = N->getZExtValue();
-  if (Value == 1LL<<31) return false; // INT_MIN cannot be negated
-  Value = -(int)Value;
-  return Value && ARM_AM::getT2SOImmVal(Value) != -1;
+def t2_so_imm_neg : Operand<i32>, ImmLeaf<i32, [{
+  return Imm && ARM_AM::getT2SOImmVal(-(uint32_t)Imm) != -1;
 }], t2_so_imm_neg_XFORM> {
   let ParserMatchClass = t2_so_imm_neg_asmoperand;
 }