diff options
author | James Molloy <james.molloy@arm.com> | 2016-09-08 12:58:12 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2016-09-08 12:58:12 +0000 |
commit | 753c18f5c00bf64de66b584a252933961bc99df5 (patch) | |
tree | d00b91a8e6afce9431f4f60e3daed66f2f59847f /llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | |
parent | 7c7255e40b9115802987690516fb10301e22a313 (diff) | |
download | bcm5719-llvm-753c18f5c00bf64de66b584a252933961bc99df5.tar.gz bcm5719-llvm-753c18f5c00bf64de66b584a252933961bc99df5.zip |
[Thumb1] AND with a constant operand can be converted into BIC
So model the cost of materializing the constant operand C as the minimum of
C and ~C.
llvm-svn: 280929
Diffstat (limited to 'llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp index 2d44adc9951..48819335512 100644 --- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp @@ -69,6 +69,10 @@ int ARMTTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Idx == 1) return 0; + if (Opcode == Instruction::And) + // Conversion to BIC is free, and means we can use ~Imm instead. + return std::min(getIntImmCost(Imm, Ty), getIntImmCost(~Imm, Ty)); + return getIntImmCost(Imm, Ty); } |