We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e57d6c commit d1ecc1fCopy full SHA for d1ecc1f
src/CodeGen_WebAssembly.cpp
@@ -175,6 +175,17 @@ void CodeGen_WebAssembly::visit(const Cast *op) {
175
}
176
177
178
+
179
+ // Narrowing float -> int casts should go via an integer type of the
180
+ // matching width (see https://github.com/halide/Halide/issues/7972)
181
+ if (op->value.type().is_float() &&
182
+ (op->type.is_int() || op->type.is_uint()) &&
183
+ op->type.bits() < op->value.type().bits()) {
184
+ Expr equiv = Cast::make(op->type.with_bits(op->value.type().bits()), op->value);
185
+ equiv = Cast::make(op->type, equiv);
186
+ codegen(equiv);
187
+ return;
188
+ }
189
190
191
CodeGen_Posix::visit(op);
0 commit comments