mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-21 12:51:20 +00:00
[FastISel] update to use intrinsic's isCommutative(); NFC
This requires adding a missing 'const' to the definition because the callers are using const args, but there should be no change in behavior. The intrinsic method was added with D86798 / rG096527214033
This commit is contained in:
parent
5b3abe923f
commit
d6a2f460c7
@ -510,18 +510,6 @@ protected:
|
|||||||
unsigned NumArgs);
|
unsigned NumArgs);
|
||||||
bool lowerCallTo(CallLoweringInfo &CLI);
|
bool lowerCallTo(CallLoweringInfo &CLI);
|
||||||
|
|
||||||
bool isCommutativeIntrinsic(IntrinsicInst const *II) {
|
|
||||||
switch (II->getIntrinsicID()) {
|
|
||||||
case Intrinsic::sadd_with_overflow:
|
|
||||||
case Intrinsic::uadd_with_overflow:
|
|
||||||
case Intrinsic::smul_with_overflow:
|
|
||||||
case Intrinsic::umul_with_overflow:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool lowerCall(const CallInst *I);
|
bool lowerCall(const CallInst *I);
|
||||||
/// Select and emit code for a binary operator instruction, which has
|
/// Select and emit code for a binary operator instruction, which has
|
||||||
/// an opcode which directly corresponds to the given ISD opcode.
|
/// an opcode which directly corresponds to the given ISD opcode.
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
/// Return true if swapping the first two arguments to the intrinsic produces
|
/// Return true if swapping the first two arguments to the intrinsic produces
|
||||||
/// the same result.
|
/// the same result.
|
||||||
bool isCommutative() {
|
bool isCommutative() const {
|
||||||
switch (getIntrinsicID()) {
|
switch (getIntrinsicID()) {
|
||||||
case Intrinsic::maxnum:
|
case Intrinsic::maxnum:
|
||||||
case Intrinsic::minnum:
|
case Intrinsic::minnum:
|
||||||
|
@ -3409,8 +3409,7 @@ bool AArch64FastISel::foldXALUIntrinsic(AArch64CC::CondCode &CC,
|
|||||||
const Value *RHS = II->getArgOperand(1);
|
const Value *RHS = II->getArgOperand(1);
|
||||||
|
|
||||||
// Canonicalize immediate to the RHS.
|
// Canonicalize immediate to the RHS.
|
||||||
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) &&
|
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) && II->isCommutative())
|
||||||
isCommutativeIntrinsic(II))
|
|
||||||
std::swap(LHS, RHS);
|
std::swap(LHS, RHS);
|
||||||
|
|
||||||
// Simplify multiplies.
|
// Simplify multiplies.
|
||||||
@ -3697,8 +3696,7 @@ bool AArch64FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
const Value *LHS = II->getArgOperand(0);
|
const Value *LHS = II->getArgOperand(0);
|
||||||
const Value *RHS = II->getArgOperand(1);
|
const Value *RHS = II->getArgOperand(1);
|
||||||
// Canonicalize immediate to the RHS.
|
// Canonicalize immediate to the RHS.
|
||||||
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) &&
|
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) && II->isCommutative())
|
||||||
isCommutativeIntrinsic(II))
|
|
||||||
std::swap(LHS, RHS);
|
std::swap(LHS, RHS);
|
||||||
|
|
||||||
// Simplify multiplies.
|
// Simplify multiplies.
|
||||||
|
@ -2879,8 +2879,7 @@ bool X86FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
|
|||||||
const Value *RHS = II->getArgOperand(1);
|
const Value *RHS = II->getArgOperand(1);
|
||||||
|
|
||||||
// Canonicalize immediate to the RHS.
|
// Canonicalize immediate to the RHS.
|
||||||
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) &&
|
if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS) && II->isCommutative())
|
||||||
isCommutativeIntrinsic(II))
|
|
||||||
std::swap(LHS, RHS);
|
std::swap(LHS, RHS);
|
||||||
|
|
||||||
unsigned BaseOpc, CondCode;
|
unsigned BaseOpc, CondCode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user