Skip to content

Commit

Permalink
[NFC] Rename {F32,F64}NearestInt to {F32,F64}Nearest (WebAssembly#7089)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tlively authored Nov 27, 2024
1 parent f8e1622 commit b1c5a00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/wasm-binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ enum ASTNodes {
F32Ceil = 0x8d,
F32Floor = 0x8e,
F32Trunc = 0x8f,
F32NearestInt = 0x90,
F32Nearest = 0x90,
F32Sqrt = 0x91,
F32Add = 0x92,
F32Sub = 0x93,
Expand All @@ -578,7 +578,7 @@ enum ASTNodes {
F64Ceil = 0x9b,
F64Floor = 0x9c,
F64Trunc = 0x9d,
F64NearestInt = 0x9e,
F64Nearest = 0x9e,
F64Sqrt = 0x9f,
F64Add = 0xa0,
F64Sub = 0xa1,
Expand Down
6 changes: 1 addition & 5 deletions src/wasm/wasm-binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3097,11 +3097,7 @@ Result<> WasmBinaryReader::readInst() {
UNARY_FLOAT(Abs);
UNARY_FLOAT(Ceil);
UNARY_FLOAT(Floor);
// UNARY_FLOAT(NearestInt);
case BinaryConsts::F32NearestInt:
return builder.makeUnary(NearestFloat32);
case BinaryConsts::F64NearestInt:
return builder.makeUnary(NearestFloat64);
UNARY_FLOAT(Nearest);
UNARY_FLOAT(Sqrt);

case BinaryConsts::F32UConvertI32:
Expand Down
4 changes: 2 additions & 2 deletions src/wasm/wasm-stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) {
o << int8_t(BinaryConsts::F32Trunc);
break;
case NearestFloat32:
o << int8_t(BinaryConsts::F32NearestInt);
o << int8_t(BinaryConsts::F32Nearest);
break;
case SqrtFloat32:
o << int8_t(BinaryConsts::F32Sqrt);
Expand All @@ -923,7 +923,7 @@ void BinaryInstWriter::visitUnary(Unary* curr) {
o << int8_t(BinaryConsts::F64Trunc);
break;
case NearestFloat64:
o << int8_t(BinaryConsts::F64NearestInt);
o << int8_t(BinaryConsts::F64Nearest);
break;
case SqrtFloat64:
o << int8_t(BinaryConsts::F64Sqrt);
Expand Down

0 comments on commit b1c5a00

Please sign in to comment.