Skip to content

Commit 0ab6ec1

Browse files
committed
update rspirv: handle LiteralFloat just like other numbers
1 parent ff0d9ae commit 0ab6ec1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,10 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
10811081
Ok(v) => inst.operands.push(dr::Operand::LiteralBit32(v)),
10821082
Err(e) => self.err(format!("invalid integer: {e}")),
10831083
},
1084+
(OperandKind::LiteralFloat, Some(word)) => match word.parse() {
1085+
Ok(v) => inst.operands.push(dr::Operand::LiteralBit32(v.to_bits())),
1086+
Err(e) => self.err(format!("invalid float: {e}")),
1087+
},
10841088
(OperandKind::LiteralString, _) => {
10851089
if let Token::String(value) = token {
10861090
inst.operands.push(dr::Operand::LiteralString(value));
@@ -1412,7 +1416,6 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
14121416
Ok(x) => inst.operands.push(dr::Operand::StoreCacheControl(x)),
14131417
Err(()) => self.err(format!("unknown StoreCacheControl {word}")),
14141418
},
1415-
(OperandKind::LiteralFloat, Some(_word)) => todo!(),
14161419
(kind, None) => match token {
14171420
Token::Word(_) => bug!(),
14181421
Token::String(_) => {

0 commit comments

Comments
 (0)