Skip to content

Commit ac8a874

Browse files
committed
add memset const and dynamic support for f16
1 parent c904e5c commit ac8a874

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
407407
)),
408408
},
409409
SpirvType::Float(width) => match width {
410+
16 => {
411+
let ty = SpirvType::Float(16).def(self.span(), self);
412+
self.def_constant(ty, SpirvConst::Scalar(memset_fill_u16(fill_byte) as u128))
413+
.def(self)
414+
}
410415
32 => self
411416
.constant_f32(self.span(), f32::from_bits(memset_fill_u32(fill_byte)))
412417
.def(self),
@@ -461,6 +466,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
461466
)),
462467
},
463468
SpirvType::Float(width) => match width {
469+
16 => memset_dynamic_scalar(self, fill_var, 2, true),
464470
32 => memset_dynamic_scalar(self, fill_var, 4, true),
465471
64 => memset_dynamic_scalar(self, fill_var, 8, true),
466472
_ => self.fatal(format!("memset on float width {width} not implemented yet")),

0 commit comments

Comments
 (0)