mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1627618 - Part 3: Add MSub::NewWasm for MSub users in wasm code. r=jandem
Similar to the previous part, add `MSub::NewWasm` to handle the wasm-specific initialisation bits, so that `MSub(MDefinition, MDefinition, MIRType)` only sets the return type and the specialisation. Differential Revision: https://phabricator.services.mozilla.com/D69780 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3a85148fe9
commit
530df1cf02
@ -5407,21 +5407,26 @@ class MSub : public MBinaryArithInstruction {
|
||||
setResultType(MIRType::Value);
|
||||
}
|
||||
|
||||
MSub(MDefinition* left, MDefinition* right, MIRType type,
|
||||
bool mustPreserveNaN = false)
|
||||
MSub(MDefinition* left, MDefinition* right, MIRType type)
|
||||
: MSub(left, right) {
|
||||
specialization_ = type;
|
||||
setResultType(type);
|
||||
setMustPreserveNaN(mustPreserveNaN);
|
||||
if (type == MIRType::Int32) {
|
||||
setTruncateKind(Truncate);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(Sub)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
|
||||
static MSub* NewWasm(TempAllocator& alloc, MDefinition* left,
|
||||
MDefinition* right, MIRType type, bool mustPreserveNaN) {
|
||||
auto* ret = new (alloc) MSub(left, right, type);
|
||||
ret->setMustPreserveNaN(mustPreserveNaN);
|
||||
if (type == MIRType::Int32) {
|
||||
ret->setTruncateKind(Truncate);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
double getIdentity() override { return 0; }
|
||||
|
||||
bool isFloat32Commutative() const override { return true; }
|
||||
|
@ -359,7 +359,7 @@ class FunctionCompiler {
|
||||
}
|
||||
|
||||
// wasm can't fold x - 0.0 because of NaN with custom payloads.
|
||||
MSub* ins = MSub::New(alloc(), lhs, rhs, type, mustPreserveNaN(type));
|
||||
MSub* ins = MSub::NewWasm(alloc(), lhs, rhs, type, mustPreserveNaN(type));
|
||||
curBlock_->add(ins);
|
||||
return ins;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user