Skip to content

Commit ceab462

Browse files
committed
Bug 1944011 - Part 33: Generate boilerplate for LWasmAtomicStoreI64. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D235806
1 parent aec9be6 commit ceab462

File tree

9 files changed

+24
-78
lines changed

9 files changed

+24
-78
lines changed

js/src/jit/LIROps.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4964,7 +4964,12 @@
49644964
mir_op: WasmLoad
49654965

49664966
- name: WasmAtomicStoreI64
4967-
gen_boilerplate: false
4967+
operands:
4968+
memoryBase: WordSized
4969+
ptr: WordSized
4970+
value: Int64
4971+
num_temps64: 1
4972+
mir_op: WasmStore
49684973

49694974
- name: WasmCompareExchangeI64
49704975
result_type: Int64
@@ -5078,7 +5083,12 @@
50785083
mir_op: WasmLoad
50795084

50805085
- name: WasmAtomicStoreI64
5081-
gen_boilerplate: false
5086+
operands:
5087+
ptr: WordSized
5088+
value: Int64
5089+
memoryBase: WordSized
5090+
num_temps64: 1
5091+
mir_op: WasmStore
50825092

50835093
- name: WasmCompareExchangeI64
50845094
result_type: Int64
@@ -5193,7 +5203,11 @@
51935203
mir_op: WasmLoad
51945204

51955205
- name: WasmAtomicStoreI64
5196-
gen_boilerplate: false
5206+
operands:
5207+
ptr: WordSized
5208+
value: Int64
5209+
num_temps: 1
5210+
mir_op: WasmStore
51975211

51985212
- name: WasmCompareExchangeI64
51995213
result_type: Int64

js/src/jit/arm/CodeGenerator-arm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,7 @@ void CodeGenerator::visitWasmAtomicStoreI64(LWasmAtomicStoreI64* lir) {
26492649
Register ptr = ToRegister(lir->ptr());
26502650
Register memoryBase = ToRegister(lir->memoryBase());
26512651
Register64 value = ToRegister64(lir->value());
2652-
Register64 tmp(ToRegister(lir->tmpHigh()), ToRegister(lir->tmpLow()));
2652+
Register64 tmp = ToRegister64(lir->temp0());
26532653

26542654
BaseIndex addr(memoryBase, ptr, TimesOne, lir->mir()->access().offset32());
26552655
masm.wasmAtomicExchange64(lir->mir()->access(), addr, value, tmp);

js/src/jit/arm/LIR-arm.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -267,29 +267,6 @@ class LSoftUDivOrMod : public LBinaryCallInstructionHelper<1, 0> {
267267
MInstruction* mir() { return mir_->toInstruction(); }
268268
};
269269

270-
class LWasmAtomicStoreI64 : public LInstructionHelper<0, 2 + INT64_PIECES, 2> {
271-
public:
272-
LIR_HEADER(WasmAtomicStoreI64);
273-
274-
LWasmAtomicStoreI64(const LAllocation& ptr, const LInt64Allocation& value,
275-
const LAllocation& memoryBase, const LDefinition& tmpLow,
276-
const LDefinition& tmpHigh)
277-
: LInstructionHelper(classOpcode) {
278-
setOperand(0, ptr);
279-
setInt64Operand(1, value);
280-
setOperand(3, memoryBase);
281-
setTemp(0, tmpLow);
282-
setTemp(1, tmpHigh);
283-
}
284-
285-
MWasmStore* mir() const { return mir_->toWasmStore(); }
286-
const LAllocation* ptr() { return getOperand(0); }
287-
LInt64Allocation value() { return getInt64Operand(1); }
288-
const LAllocation* memoryBase() { return getOperand(3); }
289-
const LDefinition* tmpLow() { return getTemp(0); }
290-
const LDefinition* tmpHigh() { return getTemp(1); }
291-
};
292-
293270
} // namespace jit
294271
} // namespace js
295272

js/src/jit/arm/Lowering-arm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ void LIRGenerator::visitWasmStore(MWasmStore* ins) {
711711
auto* lir = new (alloc()) LWasmAtomicStoreI64(
712712
useRegister(base),
713713
useInt64Fixed(ins->value(), Register64(IntArgReg1, IntArgReg0)),
714-
memoryBase, tempFixed(IntArgReg2), tempFixed(IntArgReg3));
714+
memoryBase, tempInt64Fixed(Register64(IntArgReg3, IntArgReg2)));
715715
add(lir, ins);
716716
return;
717717
}

js/src/jit/mips32/CodeGenerator-mips32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ void CodeGenerator::visitWasmAtomicLoadI64(LWasmAtomicLoadI64* lir) {
351351
void CodeGenerator::visitWasmAtomicStoreI64(LWasmAtomicStoreI64* lir) {
352352
Register ptr = ToRegister(lir->ptr());
353353
Register64 value = ToRegister64(lir->value());
354-
Register tmp = ToRegister(lir->tmp());
354+
Register tmp = ToRegister(lir->temp0());
355355
uint32_t offset = lir->mir()->access().offset32();
356356

357357
BaseIndex addr(HeapReg, ptr, TimesOne, offset);

js/src/jit/mips32/LIR-mips32.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,6 @@ class LUDivOrModI64
139139
}
140140
};
141141

142-
class LWasmAtomicStoreI64 : public LInstructionHelper<0, 1 + INT64_PIECES, 1> {
143-
public:
144-
LIR_HEADER(WasmAtomicStoreI64);
145-
146-
LWasmAtomicStoreI64(const LAllocation& ptr, const LInt64Allocation& value,
147-
const LDefinition& tmp)
148-
: LInstructionHelper(classOpcode) {
149-
setOperand(0, ptr);
150-
setInt64Operand(1, value);
151-
setTemp(0, tmp);
152-
}
153-
154-
const LAllocation* ptr() { return getOperand(0); }
155-
LInt64Allocation value() { return getInt64Operand(1); }
156-
const LDefinition* tmp() { return getTemp(0); }
157-
const MWasmStore* mir() const { return mir_->toWasmStore(); }
158-
};
159-
160142
} // namespace jit
161143
} // namespace js
162144

js/src/jit/x86/CodeGenerator-x86.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,7 @@ void CodeGeneratorX86::emitWasmStoreOrExchangeAtomicI64(
474474
Operand srcAddr(ToRegister(memoryBase), ToRegister(ptr), TimesOne,
475475
access.offset32());
476476

477-
DebugOnly<LInt64Allocation> value = ins->value();
478-
MOZ_ASSERT(ToRegister64(value).low == ebx);
479-
MOZ_ASSERT(ToRegister64(value).high == ecx);
477+
MOZ_ASSERT(ToRegister64(ins->value()) == Register64(ecx, ebx));
480478

481479
// eax and edx will be overwritten every time through the loop but
482480
// memoryBase and ptr must remain live for a possible second iteration.
@@ -493,15 +491,13 @@ void CodeGeneratorX86::emitWasmStoreOrExchangeAtomicI64(
493491
}
494492

495493
void CodeGenerator::visitWasmAtomicStoreI64(LWasmAtomicStoreI64* ins) {
496-
MOZ_ASSERT(ToRegister(ins->t1()) == edx);
497-
MOZ_ASSERT(ToRegister(ins->t2()) == eax);
494+
MOZ_ASSERT(ToRegister64(ins->temp0()) == Register64(edx, eax));
498495

499496
emitWasmStoreOrExchangeAtomicI64(ins, ins->mir()->access());
500497
}
501498

502499
void CodeGenerator::visitWasmAtomicExchangeI64(LWasmAtomicExchangeI64* ins) {
503-
MOZ_ASSERT(ToOutRegister64(ins).high == edx);
504-
MOZ_ASSERT(ToOutRegister64(ins).low == eax);
500+
MOZ_ASSERT(ToOutRegister64(ins) == Register64(edx, eax));
505501

506502
emitWasmStoreOrExchangeAtomicI64(ins, ins->access());
507503
}

js/src/jit/x86/LIR-x86.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -149,29 +149,6 @@ class LUDivOrModI64
149149
}
150150
};
151151

152-
class LWasmAtomicStoreI64 : public LInstructionHelper<0, 2 + INT64_PIECES, 2> {
153-
public:
154-
LIR_HEADER(WasmAtomicStoreI64);
155-
156-
LWasmAtomicStoreI64(const LAllocation& memoryBase, const LAllocation& ptr,
157-
const LInt64Allocation& value, const LDefinition& t1,
158-
const LDefinition& t2)
159-
: LInstructionHelper(classOpcode) {
160-
setOperand(0, memoryBase);
161-
setOperand(1, ptr);
162-
setInt64Operand(2, value);
163-
setTemp(0, t1);
164-
setTemp(1, t2);
165-
}
166-
167-
MWasmStore* mir() const { return mir_->toWasmStore(); }
168-
const LAllocation* memoryBase() { return getOperand(0); }
169-
const LAllocation* ptr() { return getOperand(1); }
170-
LInt64Allocation value() { return getInt64Operand(2); }
171-
const LDefinition* t1() { return getTemp(0); }
172-
const LDefinition* t2() { return getTemp(1); }
173-
};
174-
175152
} // namespace jit
176153
} // namespace js
177154

js/src/jit/x86/Lowering-x86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void LIRGenerator::visitWasmStore(MWasmStore* ins) {
431431
auto* lir = new (alloc())
432432
LWasmAtomicStoreI64(useRegister(memoryBase), useRegister(base),
433433
useInt64Fixed(ins->value(), Register64(ecx, ebx)),
434-
tempFixed(edx), tempFixed(eax));
434+
tempInt64Fixed(Register64(edx, eax)));
435435
add(lir, ins);
436436
return;
437437
}

0 commit comments

Comments
 (0)