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 committed Feb 7, 2024
1 parent 08575eb commit cd0cbf6
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 @@ -1081,6 +1081,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 @@ -1412,7 +1418,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 cd0cbf6

Please sign in to comment.