Skip to content

Commit 7ad995c

Browse files
committed
Bug 1944011 - Part 27: Generate boilerplate for WasmUint32To{Double,Float32}. r=jandem
These need a temp register only on x86. Differential Revision: https://phabricator.services.mozilla.com/D235800
1 parent e1bb691 commit 7ad995c

File tree

11 files changed

+16
-192
lines changed

11 files changed

+16
-192
lines changed

js/src/jit/LIROps.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4864,11 +4864,23 @@
48644864
- name: UnboxFloatingPoint
48654865
gen_boilerplate: false
48664866

4867+
# Convert a 32-bit unsigned integer to a double.
48674868
- name: WasmUint32ToDouble
4868-
gen_boilerplate: false
4869+
result_type: WordSized
4870+
operands:
4871+
input: WordSized
4872+
#ifdef JS_CODEGEN_X86
4873+
num_temps: 1
4874+
#endif
48694875

4876+
# Convert a 32-bit unsigned integer to a float32.
48704877
- name: WasmUint32ToFloat32
4871-
gen_boilerplate: false
4878+
result_type: WordSized
4879+
operands:
4880+
input: WordSized
4881+
#ifdef JS_CODEGEN_X86
4882+
num_temps: 1
4883+
#endif
48724884

48734885
- name: DivI
48744886
result_type: WordSized

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,6 @@ class LUnboxFloatingPoint : public LInstructionHelper<1, 2, 0> {
5353
MUnbox* mir() const { return mir_->toUnbox(); }
5454
};
5555

56-
// Convert a 32-bit unsigned integer to a double.
57-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
58-
public:
59-
LIR_HEADER(WasmUint32ToDouble)
60-
61-
explicit LWasmUint32ToDouble(const LAllocation& input)
62-
: LInstructionHelper(classOpcode) {
63-
setOperand(0, input);
64-
}
65-
};
66-
67-
// Convert a 32-bit unsigned integer to a float32.
68-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
69-
public:
70-
LIR_HEADER(WasmUint32ToFloat32)
71-
72-
explicit LWasmUint32ToFloat32(const LAllocation& input)
73-
: LInstructionHelper(classOpcode) {
74-
setOperand(0, input);
75-
}
76-
};
77-
7856
class LDivOrModI64
7957
: public LCallInstructionHelper<INT64_PIECES, INT64_PIECES * 2 + 1, 0> {
8058
public:

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,6 @@ class LUnboxFloatingPoint : public LUnboxBase {
3939
: LUnboxBase(classOpcode, input) {}
4040
};
4141

42-
// Convert a 32-bit unsigned integer to a double.
43-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
44-
public:
45-
LIR_HEADER(WasmUint32ToDouble)
46-
47-
explicit LWasmUint32ToDouble(const LAllocation& input)
48-
: LInstructionHelper(classOpcode) {
49-
setOperand(0, input);
50-
}
51-
};
52-
53-
// Convert a 32-bit unsigned integer to a float32.
54-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
55-
public:
56-
LIR_HEADER(WasmUint32ToFloat32)
57-
58-
explicit LWasmUint32ToFloat32(const LAllocation& input)
59-
: LInstructionHelper(classOpcode) {
60-
setOperand(0, input);
61-
}
62-
};
63-
6442
class LDivPowTwoI : public LInstructionHelper<1, 1, 0> {
6543
const int32_t shift_;
6644
const bool negativeDivisor_;

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,6 @@ class LUnboxFloatingPoint : public LUnbox {
3838
: LUnbox(classOpcode, input) {}
3939
};
4040

41-
// Convert a 32-bit unsigned integer to a double.
42-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
43-
public:
44-
LIR_HEADER(WasmUint32ToDouble)
45-
46-
explicit LWasmUint32ToDouble(const LAllocation& input)
47-
: LInstructionHelper(classOpcode) {
48-
setOperand(0, input);
49-
}
50-
};
51-
52-
// Convert a 32-bit unsigned integer to a float32.
53-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
54-
public:
55-
LIR_HEADER(WasmUint32ToFloat32)
56-
57-
explicit LWasmUint32ToFloat32(const LAllocation& input)
58-
: LInstructionHelper(classOpcode) {
59-
setOperand(0, input);
60-
}
61-
};
62-
6341
class LDivPowTwoI : public LInstructionHelper<1, 1, 1> {
6442
const int32_t shift_;
6543

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,6 @@
1010
namespace js {
1111
namespace jit {
1212

13-
// Convert a 32-bit unsigned integer to a double.
14-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
15-
public:
16-
LIR_HEADER(WasmUint32ToDouble)
17-
18-
LWasmUint32ToDouble(const LAllocation& input)
19-
: LInstructionHelper(classOpcode) {
20-
setOperand(0, input);
21-
}
22-
};
23-
24-
// Convert a 32-bit unsigned integer to a float32.
25-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
26-
public:
27-
LIR_HEADER(WasmUint32ToFloat32)
28-
29-
LWasmUint32ToFloat32(const LAllocation& input)
30-
: LInstructionHelper(classOpcode) {
31-
setOperand(0, input);
32-
}
33-
};
34-
3513
class LDivPowTwoI : public LInstructionHelper<1, 1, 1> {
3614
const int32_t shift_;
3715

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ class LUnboxFloatingPoint : public LInstruction {
2020
const LDefinition* output() const { MOZ_CRASH(); }
2121
};
2222

23-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
24-
public:
25-
explicit LWasmUint32ToFloat32(const LAllocation&)
26-
: LInstructionHelper(Opcode::Invalid) {
27-
MOZ_CRASH();
28-
}
29-
};
30-
3123
class LUnbox : public LInstructionHelper<1, 2, 0> {
3224
public:
3325
MUnbox* mir() const { MOZ_CRASH(); }
@@ -55,13 +47,6 @@ class LModI : public LBinaryMath<1> {
5547
const LDefinition* callTemp() { MOZ_CRASH(); }
5648
MMod* mir() const { MOZ_CRASH(); }
5749
};
58-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
59-
public:
60-
explicit LWasmUint32ToDouble(const LAllocation&)
61-
: LInstructionHelper(Opcode::Invalid) {
62-
MOZ_CRASH();
63-
}
64-
};
6550

6651
class LMulI : public LInstruction {};
6752

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,6 @@ class LUnboxFloatingPoint : public LUnbox {
3838
: LUnbox(classOpcode, input) {}
3939
};
4040

41-
// Convert a 32-bit unsigned integer to a double.
42-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
43-
public:
44-
LIR_HEADER(WasmUint32ToDouble)
45-
46-
explicit LWasmUint32ToDouble(const LAllocation& input)
47-
: LInstructionHelper(classOpcode) {
48-
setOperand(0, input);
49-
}
50-
};
51-
52-
// Convert a 32-bit unsigned integer to a float32.
53-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
54-
public:
55-
LIR_HEADER(WasmUint32ToFloat32)
56-
57-
explicit LWasmUint32ToFloat32(const LAllocation& input)
58-
: LInstructionHelper(classOpcode) {
59-
setOperand(0, input);
60-
}
61-
};
62-
6341
class LDivPowTwoI : public LInstructionHelper<1, 1, 1> {
6442
const int32_t shift_;
6543

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ class LUnboxFloatingPoint : public LInstruction {
1919
const LDefinition* output() const { MOZ_CRASH(); }
2020
};
2121

22-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
23-
public:
24-
explicit LWasmUint32ToFloat32(const LAllocation&)
25-
: LInstructionHelper(Opcode::Invalid) {
26-
MOZ_CRASH();
27-
}
28-
};
29-
3022
class LUnbox : public LInstructionHelper<1, 2, 0> {
3123
public:
3224
MUnbox* mir() const { MOZ_CRASH(); }
@@ -54,13 +46,6 @@ class LModI : public LBinaryMath<1> {
5446
const LDefinition* callTemp() { MOZ_CRASH(); }
5547
MMod* mir() const { MOZ_CRASH(); }
5648
};
57-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
58-
public:
59-
explicit LWasmUint32ToDouble(const LAllocation&)
60-
: LInstructionHelper(Opcode::Invalid) {
61-
MOZ_CRASH();
62-
}
63-
};
6449

6550
class LMulI : public LInstruction {};
6651

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,6 @@ class LUnboxFloatingPoint : public LUnboxBase {
4141
: LUnboxBase(classOpcode, input) {}
4242
};
4343

44-
// Convert a 32-bit unsigned integer to a double.
45-
class LWasmUint32ToDouble : public LInstructionHelper<1, 1, 0> {
46-
public:
47-
LIR_HEADER(WasmUint32ToDouble)
48-
49-
explicit LWasmUint32ToDouble(const LAllocation& input)
50-
: LInstructionHelper(classOpcode) {
51-
setOperand(0, input);
52-
}
53-
};
54-
55-
// Convert a 32-bit unsigned integer to a float32.
56-
class LWasmUint32ToFloat32 : public LInstructionHelper<1, 1, 0> {
57-
public:
58-
LIR_HEADER(WasmUint32ToFloat32)
59-
60-
explicit LWasmUint32ToFloat32(const LAllocation& input)
61-
: LInstructionHelper(classOpcode) {
62-
setOperand(0, input);
63-
}
64-
};
65-
6644
class LDivOrModI64 : public LBinaryMath<1> {
6745
public:
6846
LIR_HEADER(DivOrModI64)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void CodeGenerator::visitAtomicTypedArrayElementBinopForEffect64(
258258

259259
void CodeGenerator::visitWasmUint32ToDouble(LWasmUint32ToDouble* lir) {
260260
Register input = ToRegister(lir->input());
261-
Register temp = ToRegister(lir->temp());
261+
Register temp = ToRegister(lir->temp0());
262262

263263
if (input != temp) {
264264
masm.mov(input, temp);
@@ -270,7 +270,7 @@ void CodeGenerator::visitWasmUint32ToDouble(LWasmUint32ToDouble* lir) {
270270

271271
void CodeGenerator::visitWasmUint32ToFloat32(LWasmUint32ToFloat32* lir) {
272272
Register input = ToRegister(lir->input());
273-
Register temp = ToRegister(lir->temp());
273+
Register temp = ToRegister(lir->temp0());
274274
FloatRegister output = ToFloatRegister(lir->output());
275275

276276
if (input != temp) {

0 commit comments

Comments
 (0)