Skip to content

Commit

Permalink
update rspirv: handle LiteralFloat just like other numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Firestar99 authored and eddyb committed Nov 7, 2024
1 parent 0bbf8c3 commit b1cbff4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/rustc_codegen_spirv/src/builder/spirv_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,12 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
Ok(v) => inst.operands.push(dr::Operand::LiteralBit32(v)),
Err(e) => self.err(format!("invalid integer: {e}")),
},
(OperandKind::LiteralFloat, Some(word)) => match word.parse() {
Ok(v) => inst
.operands
.push(dr::Operand::LiteralBit32(f32::to_bits(v))),
Err(e) => self.err(format!("invalid float: {e}")),
},
(OperandKind::LiteralString, _) => {
if let Token::String(value) = token {
inst.operands.push(dr::Operand::LiteralString(value));
Expand Down Expand Up @@ -1439,7 +1445,6 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
Ok(x) => inst.operands.push(dr::Operand::StoreCacheControl(x)),
Err(()) => self.err(format!("unknown StoreCacheControl {word}")),
},
(OperandKind::LiteralFloat, Some(_word)) => todo!(),
(kind, None) => match token {
Token::Word(_) => bug!(),
Token::String(_) => {
Expand Down

0 comments on commit b1cbff4

Please sign in to comment.