summaryrefslogtreecommitdiff
path: root/src/passes/OptimizeInstructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r--src/passes/OptimizeInstructions.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 55af9a34d..dc38933a6 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -304,7 +304,7 @@ struct OptimizeInstructions
if (matches(curr,
unary(Abstract::EqZ,
binary(&inner, Abstract::RemS, any(), ival(&c)))) &&
- IsPowerOf2((uint64_t)c->value.getInteger())) {
+ Bits::isPowerOf2((uint64_t)c->value.getInteger())) {
inner->op = Abstract::getBinary(c->type, Abstract::And);
c->value = c->value.sub(Literal::makeFromInt32(1, c->type));
return curr;
@@ -407,7 +407,7 @@ struct OptimizeInstructions
// forcing them to zero like we do in the zero-extend.
int32_t constValue = c->value.geti32();
auto upperConstValue = constValue & ~Bits::lowBitMask(bits);
- uint32_t count = PopCount(upperConstValue);
+ uint32_t count = Bits::popCount(upperConstValue);
auto constSignBit = constValue & (1 << (bits - 1));
if ((count > 0 && count < 32 - bits) ||
(constSignBit && count == 0)) {
@@ -529,7 +529,7 @@ struct OptimizeInstructions
Bits::getMaxBits(binary->left, this) <= 31) {
binary->op = op;
}
- if (IsPowerOf2((uint32_t)c)) {
+ if (Bits::isPowerOf2((uint32_t)c)) {
switch (binary->op) {
case MulInt32:
return optimizePowerOf2Mul(binary, (uint32_t)c);
@@ -550,7 +550,7 @@ struct OptimizeInstructions
Bits::getMaxBits(binary->left, this) <= 63) {
binary->op = op;
}
- if (IsPowerOf2((uint64_t)c)) {
+ if (Bits::isPowerOf2((uint64_t)c)) {
switch (binary->op) {
case MulInt64:
return optimizePowerOf2Mul(binary, (uint64_t)c);
@@ -976,8 +976,8 @@ private:
continue;
} else if (binary->op == ShlInt32) {
if (auto* c = binary->right->dynCast<Const>()) {
- seekStack.emplace_back(binary->left,
- mul * Pow2(Bits::getEffectiveShifts(c)));
+ seekStack.emplace_back(
+ binary->left, mul * Bits::pow2(Bits::getEffectiveShifts(c)));
continue;
}
} else if (binary->op == MulInt32) {
@@ -1206,7 +1206,7 @@ private:
static_assert(std::is_same<T, uint32_t>::value ||
std::is_same<T, uint64_t>::value,
"type mismatch");
- auto shifts = CountTrailingZeroes<T>(c);
+ auto shifts = Bits::countTrailingZeroes(c);
binary->op = std::is_same<T, uint32_t>::value ? ShlInt32 : ShlInt64;
binary->right->cast<Const>()->value = Literal(static_cast<T>(shifts));
return binary;
@@ -1221,7 +1221,7 @@ private:
static_assert(std::is_same<T, uint32_t>::value ||
std::is_same<T, uint64_t>::value,
"type mismatch");
- auto shifts = CountTrailingZeroes<T>(c);
+ auto shifts = Bits::countTrailingZeroes(c);
binary->op = std::is_same<T, uint32_t>::value ? ShrUInt32 : ShrUInt64;
binary->right->cast<Const>()->value = Literal(static_cast<T>(shifts));
return binary;
@@ -1310,7 +1310,7 @@ private:
binary(Abstract::Ne,
binary(&inner, Abstract::RemS, any(), ival(&c)),
ival(0))) &&
- IsPowerOf2((uint64_t)c->value.getInteger())) {
+ Bits::isPowerOf2((uint64_t)c->value.getInteger())) {
inner->op = Abstract::getBinary(c->type, Abstract::And);
c->value = c->value.sub(Literal::makeFromInt32(1, c->type));
return curr;