diff options
author | Craig Topper <craig.topper@gmail.com> | 2016-08-25 04:16:10 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2016-08-25 04:16:10 +0000 |
commit | 5ef7a0f45a6d93cb74c0ff12077eae3eeaea40a2 (patch) | |
tree | 0c07f76e42206f31b328872255c490e092500439 | |
parent | 969e56a2cc4f3f9375598cbbbf8ec3d9801aad04 (diff) | |
download | bcm5719-llvm-5ef7a0f45a6d93cb74c0ff12077eae3eeaea40a2.tar.gz bcm5719-llvm-5ef7a0f45a6d93cb74c0ff12077eae3eeaea40a2.zip |
[X86] Simplify getOperandBias as a bit. NFC
There's no reason for it to return a signed type. Just return the operand bias in each if instead of starting from 0 and adding in the 'if'.
llvm-svn: 279720
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h index 6e7bdfe4da2..3f0316396e9 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h @@ -627,26 +627,25 @@ namespace X86II { /// in this instruction. /// If this is a two-address instruction,skip one of the register operands. /// FIXME: This should be handled during MCInst lowering. - inline int getOperandBias(const MCInstrDesc& Desc) + inline unsigned getOperandBias(const MCInstrDesc& Desc) { unsigned NumOps = Desc.getNumOperands(); - unsigned CurOp = 0; if (NumOps > 1 && Desc.getOperandConstraint(1, MCOI::TIED_TO) == 0) - ++CurOp; - else if (NumOps > 3 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 && - Desc.getOperandConstraint(3, MCOI::TIED_TO) == 1) + return 1; + if (NumOps > 3 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 && + Desc.getOperandConstraint(3, MCOI::TIED_TO) == 1) // Special case for AVX-512 GATHER with 2 TIED_TO operands // Skip the first 2 operands: dst, mask_wb - CurOp += 2; - else if (NumOps > 3 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 && - Desc.getOperandConstraint(NumOps - 1, MCOI::TIED_TO) == 1) + return 2; + if (NumOps > 3 && Desc.getOperandConstraint(2, MCOI::TIED_TO) == 0 && + Desc.getOperandConstraint(NumOps - 1, MCOI::TIED_TO) == 1) // Special case for GATHER with 2 TIED_TO operands // Skip the first 2 operands: dst, mask_wb - CurOp += 2; - else if (NumOps > 2 && Desc.getOperandConstraint(NumOps - 2, MCOI::TIED_TO) == 0) + return 2; + if (NumOps > 2 && Desc.getOperandConstraint(NumOps - 2, MCOI::TIED_TO) == 0) // SCATTER - ++CurOp; - return CurOp; + return 1; + return 0; } /// getMemoryOperandNo - The function returns the MCInst operand # for the |