Skip to content

Commit e1bb691

Browse files
committed
Bug 1944011 - Part 26: Generate boilerplate for Int64ToFloatingPoint. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D235799
1 parent b9ee06b commit e1bb691

File tree

10 files changed

+42
-123
lines changed

10 files changed

+42
-123
lines changed

js/src/jit/LIROps.yaml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,7 +4933,11 @@
49334933
gen_boilerplate: false
49344934

49354935
- name: Int64ToFloatingPoint
4936-
gen_boilerplate: false
4936+
result_type: WordSized
4937+
operands:
4938+
input: Int64
4939+
num_temps: 1
4940+
mir_op: true
49374941

49384942
- name: WasmAtomicLoadI64
49394943
gen_boilerplate: false
@@ -4971,7 +4975,11 @@
49714975
gen_boilerplate: false
49724976

49734977
- name: Int64ToFloatingPoint
4974-
gen_boilerplate: false
4978+
result_type: WordSized
4979+
operands:
4980+
input: Int64
4981+
num_temps: 1
4982+
mir_op: true
49754983
#endif
49764984

49774985
#ifdef JS_CODEGEN_ARM
@@ -5003,7 +5011,12 @@
50035011
gen_boilerplate: false
50045012

50055013
- name: Int64ToFloatingPointCall
5006-
gen_boilerplate: false
5014+
result_type: WordSized
5015+
operands:
5016+
input: Int64
5017+
instance: WordSized
5018+
call_instruction: true
5019+
mir_op: BuiltinInt64ToFloatingPoint
50075020

50085021
- name: WasmTruncateToInt64
50095022
gen_boilerplate: false
@@ -5050,7 +5063,10 @@
50505063
gen_boilerplate: false
50515064

50525065
- name: Int64ToFloatingPoint
5053-
gen_boilerplate: false
5066+
result_type: WordSized
5067+
operands:
5068+
input: Int64
5069+
mir_op: true
50545070
#endif
50555071

50565072
#ifdef JS_CODEGEN_MIPS32
@@ -5073,7 +5089,11 @@
50735089
gen_boilerplate: false
50745090

50755091
- name: Int64ToFloatingPoint
5076-
gen_boilerplate: false
5092+
result_type: WordSized
5093+
operands:
5094+
input: Int64
5095+
call_instruction: true
5096+
mir_op: true
50775097

50785098
- name: WasmUnalignedLoad
50795099
gen_boilerplate: false
@@ -5120,7 +5140,10 @@
51205140
gen_boilerplate: false
51215141

51225142
- name: Int64ToFloatingPoint
5123-
gen_boilerplate: false
5143+
result_type: WordSized
5144+
operands:
5145+
input: Int64
5146+
mir_op: true
51245147

51255148
- name: WasmUnalignedLoad
51265149
gen_boilerplate: false
@@ -5161,7 +5184,10 @@
51615184
gen_boilerplate: false
51625185

51635186
- name: Int64ToFloatingPoint
5164-
gen_boilerplate: false
5187+
result_type: WordSized
5188+
operands:
5189+
input: Int64
5190+
mir_op: true
51655191

51665192
- name: WasmCompareExchangeI64
51675193
gen_boilerplate: false
@@ -5190,7 +5216,10 @@
51905216
gen_boilerplate: false
51915217

51925218
- name: Int64ToFloatingPoint
5193-
gen_boilerplate: false
5219+
result_type: WordSized
5220+
operands:
5221+
input: Int64
5222+
mir_op: true
51945223

51955224
- name: WasmCompareExchangeI64
51965225
gen_boilerplate: false

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -310,29 +310,6 @@ class LWasmTruncateToInt64 : public LCallInstructionHelper<INT64_PIECES, 2, 0> {
310310
}
311311
};
312312

313-
class LInt64ToFloatingPointCall
314-
: public LCallInstructionHelper<1, INT64_PIECES + 1, 0> {
315-
public:
316-
LIR_HEADER(Int64ToFloatingPointCall);
317-
318-
static const size_t Input = 0;
319-
static const size_t Instance = INT64_PIECES;
320-
321-
LInt64ToFloatingPointCall(const LInt64Allocation& in,
322-
const LAllocation& instance)
323-
: LCallInstructionHelper(classOpcode) {
324-
setInt64Operand(Input, in);
325-
setOperand(Instance, instance);
326-
}
327-
328-
LInt64Allocation input() const { return getInt64Operand(Input); }
329-
const LAllocation* instance() const { return getOperand(Instance); }
330-
331-
MBuiltinInt64ToFloatingPoint* mir() const {
332-
return mir_->toBuiltinInt64ToFloatingPoint();
333-
}
334-
};
335-
336313
class LWasmAtomicLoadI64 : public LInstructionHelper<INT64_PIECES, 2, 0> {
337314
public:
338315
LIR_HEADER(WasmAtomicLoadI64);

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,6 @@ class LUMod : public LBinaryMath<0> {
193193
MMod* mir() { return mir_->toMod(); }
194194
};
195195

196-
class LInt64ToFloatingPoint : public LInstructionHelper<1, 1, 0> {
197-
public:
198-
LIR_HEADER(Int64ToFloatingPoint);
199-
200-
explicit LInt64ToFloatingPoint(const LInt64Allocation& in)
201-
: LInstructionHelper(classOpcode) {
202-
setInt64Operand(0, in);
203-
}
204-
205-
LInt64Allocation input() const { return getInt64Operand(0); }
206-
207-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
208-
};
209-
210196
class LWasmTruncateToInt64 : public LInstructionHelper<1, 1, 0> {
211197
public:
212198
LIR_HEADER(WasmTruncateToInt64);

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -309,20 +309,6 @@ class LWasmTruncateToInt64 : public LInstructionHelper<1, 1, 0> {
309309
MWasmTruncateToInt64* mir() const { return mir_->toWasmTruncateToInt64(); }
310310
};
311311

312-
class LInt64ToFloatingPoint : public LInstructionHelper<1, 1, 0> {
313-
public:
314-
LIR_HEADER(Int64ToFloatingPoint);
315-
316-
explicit LInt64ToFloatingPoint(const LInt64Allocation& in)
317-
: LInstructionHelper(classOpcode) {
318-
setInt64Operand(0, in);
319-
}
320-
321-
LInt64Allocation input() const { return getInt64Operand(0); }
322-
323-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
324-
};
325-
326312
} // namespace jit
327313
} // namespace js
328314

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,6 @@ class LWasmTruncateToInt64 : public LCallInstructionHelper<INT64_PIECES, 1, 0> {
151151
MWasmTruncateToInt64* mir() const { return mir_->toWasmTruncateToInt64(); }
152152
};
153153

154-
class LInt64ToFloatingPoint
155-
: public LCallInstructionHelper<1, INT64_PIECES, 0> {
156-
public:
157-
LIR_HEADER(Int64ToFloatingPoint);
158-
159-
explicit LInt64ToFloatingPoint(const LInt64Allocation& in)
160-
: LCallInstructionHelper(classOpcode) {
161-
setInt64Operand(0, in);
162-
}
163-
164-
LInt64Allocation input() const { return getInt64Operand(0); }
165-
166-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
167-
};
168-
169154
class LWasmAtomicLoadI64 : public LInstructionHelper<INT64_PIECES, 1, 0> {
170155
public:
171156
LIR_HEADER(WasmAtomicLoadI64);

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,6 @@ class LWasmTruncateToInt64 : public LInstructionHelper<1, 1, 0> {
125125
MWasmTruncateToInt64* mir() const { return mir_->toWasmTruncateToInt64(); }
126126
};
127127

128-
class LInt64ToFloatingPoint : public LInstructionHelper<1, 1, 0> {
129-
public:
130-
LIR_HEADER(Int64ToFloatingPoint);
131-
132-
explicit LInt64ToFloatingPoint(const LInt64Allocation& in)
133-
: LInstructionHelper(classOpcode) {
134-
setInt64Operand(0, in);
135-
}
136-
137-
LInt64Allocation input() const { return getInt64Operand(0); }
138-
139-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
140-
};
141-
142128
} // namespace jit
143129
} // namespace js
144130

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -309,20 +309,6 @@ class LWasmTruncateToInt64 : public LInstructionHelper<1, 1, 0> {
309309
MWasmTruncateToInt64* mir() const { return mir_->toWasmTruncateToInt64(); }
310310
};
311311

312-
class LInt64ToFloatingPoint : public LInstructionHelper<1, 1, 0> {
313-
public:
314-
LIR_HEADER(Int64ToFloatingPoint);
315-
316-
explicit LInt64ToFloatingPoint(const LInt64Allocation& in)
317-
: LInstructionHelper(classOpcode) {
318-
setInt64Operand(0, in);
319-
}
320-
321-
LInt64Allocation input() const { return getInt64Operand(0); }
322-
323-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
324-
};
325-
326312
} // namespace jit
327313
} // namespace js
328314

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,23 +924,24 @@ void CodeGenerator::visitWasmTruncateToInt64(LWasmTruncateToInt64* lir) {
924924
void CodeGenerator::visitInt64ToFloatingPoint(LInt64ToFloatingPoint* lir) {
925925
Register64 input = ToRegister64(lir->input());
926926
FloatRegister output = ToFloatRegister(lir->output());
927+
Register temp = ToTempRegisterOrInvalid(lir->temp0());
927928

928929
MInt64ToFloatingPoint* mir = lir->mir();
929930
bool isUnsigned = mir->isUnsigned();
930931

931932
MIRType outputType = mir->type();
932933
MOZ_ASSERT(outputType == MIRType::Double || outputType == MIRType::Float32);
933-
MOZ_ASSERT(isUnsigned == !lir->getTemp(0)->isBogusTemp());
934+
MOZ_ASSERT(isUnsigned == (temp != InvalidReg));
934935

935936
if (outputType == MIRType::Double) {
936937
if (isUnsigned) {
937-
masm.convertUInt64ToDouble(input, output, ToRegister(lir->getTemp(0)));
938+
masm.convertUInt64ToDouble(input, output, temp);
938939
} else {
939940
masm.convertInt64ToDouble(input, output);
940941
}
941942
} else {
942943
if (isUnsigned) {
943-
masm.convertUInt64ToFloat32(input, output, ToRegister(lir->getTemp(0)));
944+
masm.convertUInt64ToFloat32(input, output, temp);
944945
} else {
945946
masm.convertInt64ToFloat32(input, output);
946947
}

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,6 @@ class LMulI : public LBinaryMath<0, 1> {
189189
const LAllocation* lhsCopy() { return this->getOperand(2); }
190190
};
191191

192-
class LInt64ToFloatingPoint : public LInstructionHelper<1, INT64_PIECES, 1> {
193-
public:
194-
LIR_HEADER(Int64ToFloatingPoint);
195-
196-
LInt64ToFloatingPoint(const LInt64Allocation& in, const LDefinition& temp)
197-
: LInstructionHelper(classOpcode) {
198-
setInt64Operand(0, in);
199-
setTemp(0, temp);
200-
}
201-
202-
LInt64Allocation input() const { return getInt64Operand(0); }
203-
204-
MInt64ToFloatingPoint* mir() const { return mir_->toInt64ToFloatingPoint(); }
205-
206-
const LDefinition* temp() { return getTemp(0); }
207-
};
208-
209192
} // namespace jit
210193
} // namespace js
211194

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ void CodeGenerator::visitWasmTruncateToInt64(LWasmTruncateToInt64* lir) {
11561156
void CodeGenerator::visitInt64ToFloatingPoint(LInt64ToFloatingPoint* lir) {
11571157
Register64 input = ToRegister64(lir->input());
11581158
FloatRegister output = ToFloatRegister(lir->output());
1159-
Register temp = ToTempRegisterOrInvalid(lir->temp());
1159+
Register temp = ToTempRegisterOrInvalid(lir->temp0());
11601160

11611161
MIRType outputType = lir->mir()->type();
11621162
MOZ_ASSERT(outputType == MIRType::Double || outputType == MIRType::Float32);

0 commit comments

Comments
 (0)