forked from mirrors/gecko-dev
Bug 1811809: Use non-signalling Neg instruction for MacroAssembler::neg32, neg64, and negPtr. r=jandem
The condition flags needed to be set before we had `branchNeg32`, but now that `branchNeg32` is present, the normal `neg32` operation can use `Neg` instead of `Negs`. Differential Revision: https://phabricator.services.mozilla.com/D167525
This commit is contained in:
parent
5295cbaefd
commit
2c66fa8c20
3 changed files with 12 additions and 3 deletions
|
|
@ -1062,6 +1062,11 @@ class MacroAssembler : public MacroAssemblerSpecific {
|
|||
// ===============================================================
|
||||
// Arithmetic functions
|
||||
|
||||
// Condition flags aren't guaranteed to be set by these functions, for example
|
||||
// x86 will always set condition flags, but ARM64 won't do it unless
|
||||
// explicitly requested. Instead use branch(Add|Sub|Mul|Neg) to test for
|
||||
// condition flags after performing arithmetic operations.
|
||||
|
||||
inline void add32(Register src, Register dest) PER_SHARED_ARCH;
|
||||
inline void add32(Imm32 imm, Register dest) PER_SHARED_ARCH;
|
||||
inline void add32(Imm32 imm, const Address& dest) PER_SHARED_ARCH;
|
||||
|
|
|
|||
|
|
@ -560,13 +560,13 @@ void MacroAssembler::inc64(AbsoluteAddress dest) {
|
|||
}
|
||||
|
||||
void MacroAssembler::neg32(Register reg) {
|
||||
Negs(ARMRegister(reg, 32), Operand(ARMRegister(reg, 32)));
|
||||
Neg(ARMRegister(reg, 32), Operand(ARMRegister(reg, 32)));
|
||||
}
|
||||
|
||||
void MacroAssembler::neg64(Register64 reg) { negPtr(reg.reg); }
|
||||
|
||||
void MacroAssembler::negPtr(Register reg) {
|
||||
Negs(ARMRegister(reg, 64), Operand(ARMRegister(reg, 64)));
|
||||
Neg(ARMRegister(reg, 64), Operand(ARMRegister(reg, 64)));
|
||||
}
|
||||
|
||||
void MacroAssembler::negateFloat(FloatRegister reg) {
|
||||
|
|
@ -1475,7 +1475,7 @@ void MacroAssembler::branchRshift32(Condition cond, T src, Register dest,
|
|||
|
||||
void MacroAssembler::branchNeg32(Condition cond, Register reg, Label* label) {
|
||||
MOZ_ASSERT(cond == Overflow);
|
||||
neg32(reg);
|
||||
negs32(reg);
|
||||
B(label, cond);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1274,6 +1274,10 @@ class MacroAssemblerCompat : public vixl::MacroAssembler {
|
|||
Operand(ARMRegister(src, 64)));
|
||||
}
|
||||
|
||||
void negs32(Register reg) {
|
||||
Negs(ARMRegister(reg, 32), Operand(ARMRegister(reg, 32)));
|
||||
}
|
||||
|
||||
void ret() {
|
||||
pop(lr);
|
||||
abiret();
|
||||
|
|
|
|||
Loading…
Reference in a new issue