Skip to content

Commit b1c5a00

Browse files
authored
[NFC] Rename {F32,F64}NearestInt to {F32,F64}Nearest (#7089)
Rename the opcode values in wasm-binary.h to better match the names of the corresponding instructions. This also makes these names match the scheme used by the rest of the basic unary operations, allowing for more macro use in the binary reader.
1 parent f8e1622 commit b1c5a00

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

src/wasm-binary.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ enum ASTNodes {
563563
F32Ceil = 0x8d,
564564
F32Floor = 0x8e,
565565
F32Trunc = 0x8f,
566-
F32NearestInt = 0x90,
566+
F32Nearest = 0x90,
567567
F32Sqrt = 0x91,
568568
F32Add = 0x92,
569569
F32Sub = 0x93,
@@ -578,7 +578,7 @@ enum ASTNodes {
578578
F64Ceil = 0x9b,
579579
F64Floor = 0x9c,
580580
F64Trunc = 0x9d,
581-
F64NearestInt = 0x9e,
581+
F64Nearest = 0x9e,
582582
F64Sqrt = 0x9f,
583583
F64Add = 0xa0,
584584
F64Sub = 0xa1,

src/wasm/wasm-binary.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3097,11 +3097,7 @@ Result<> WasmBinaryReader::readInst() {
30973097
UNARY_FLOAT(Abs);
30983098
UNARY_FLOAT(Ceil);
30993099
UNARY_FLOAT(Floor);
3100-
// UNARY_FLOAT(NearestInt);
3101-
case BinaryConsts::F32NearestInt:
3102-
return builder.makeUnary(NearestFloat32);
3103-
case BinaryConsts::F64NearestInt:
3104-
return builder.makeUnary(NearestFloat64);
3100+
UNARY_FLOAT(Nearest);
31053101
UNARY_FLOAT(Sqrt);
31063102

31073103
case BinaryConsts::F32UConvertI32:

src/wasm/wasm-stack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) {
902902
o << int8_t(BinaryConsts::F32Trunc);
903903
break;
904904
case NearestFloat32:
905-
o << int8_t(BinaryConsts::F32NearestInt);
905+
o << int8_t(BinaryConsts::F32Nearest);
906906
break;
907907
case SqrtFloat32:
908908
o << int8_t(BinaryConsts::F32Sqrt);
@@ -923,7 +923,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) {
923923
o << int8_t(BinaryConsts::F64Trunc);
924924
break;
925925
case NearestFloat64:
926-
o << int8_t(BinaryConsts::F64NearestInt);
926+
o << int8_t(BinaryConsts::F64Nearest);
927927
break;
928928
case SqrtFloat64:
929929
o << int8_t(BinaryConsts::F64Sqrt);

0 commit comments

Comments
 (0)