Skip to content

Commit b1cbff4

Browse files
Firestar99eddyb
authored andcommitted
update rspirv: handle LiteralFloat just like other numbers
1 parent 0bbf8c3 commit b1cbff4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,12 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
11031103
Ok(v) => inst.operands.push(dr::Operand::LiteralBit32(v)),
11041104
Err(e) => self.err(format!("invalid integer: {e}")),
11051105
},
1106+
(OperandKind::LiteralFloat, Some(word)) => match word.parse() {
1107+
Ok(v) => inst
1108+
.operands
1109+
.push(dr::Operand::LiteralBit32(f32::to_bits(v))),
1110+
Err(e) => self.err(format!("invalid float: {e}")),
1111+
},
11061112
(OperandKind::LiteralString, _) => {
11071113
if let Token::String(value) = token {
11081114
inst.operands.push(dr::Operand::LiteralString(value));
@@ -1439,7 +1445,6 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
14391445
Ok(x) => inst.operands.push(dr::Operand::StoreCacheControl(x)),
14401446
Err(()) => self.err(format!("unknown StoreCacheControl {word}")),
14411447
},
1442-
(OperandKind::LiteralFloat, Some(_word)) => todo!(),
14431448
(kind, None) => match token {
14441449
Token::Word(_) => bug!(),
14451450
Token::String(_) => {

0 commit comments

Comments
 (0)