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 2, 2024
1 parent ff0d9ae commit 0ab6ec1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 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,10 @@ 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(v.to_bits())),
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 +1416,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 0ab6ec1

Please sign in to comment.