aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
index 55bf5d14fdac..4961c2ef9529 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
@@ -130,19 +130,12 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
encodeULEB128(uint64_t(MO.getImm()), OS);
}
- } else if (MO.isFPImm()) {
- const MCOperandInfo &Info = Desc.OpInfo[I];
- if (Info.OperandType == WebAssembly::OPERAND_F32IMM) {
- // TODO: MC converts all floating point immediate operands to double.
- // This is fine for numeric values, but may cause NaNs to change bits.
- auto F = float(MO.getFPImm());
- support::endian::write<float>(OS, F, support::little);
- } else {
- assert(Info.OperandType == WebAssembly::OPERAND_F64IMM);
- double D = MO.getFPImm();
- support::endian::write<double>(OS, D, support::little);
- }
-
+ } else if (MO.isSFPImm()) {
+ uint32_t F = MO.getSFPImm();
+ support::endian::write<uint32_t>(OS, F, support::little);
+ } else if (MO.isDFPImm()) {
+ uint64_t D = MO.getDFPImm();
+ support::endian::write<uint64_t>(OS, D, support::little);
} else if (MO.isExpr()) {
const MCOperandInfo &Info = Desc.OpInfo[I];
llvm::MCFixupKind FixupKind;
@@ -161,7 +154,7 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
case WebAssembly::OPERAND_SIGNATURE:
case WebAssembly::OPERAND_TYPEINDEX:
case WebAssembly::OPERAND_GLOBAL:
- case WebAssembly::OPERAND_EVENT:
+ case WebAssembly::OPERAND_TAG:
FixupKind = MCFixupKind(WebAssembly::fixup_uleb128_i32);
break;
case WebAssembly::OPERAND_OFFSET64: