(&mut self, val: Self::Value, ptr: Self::Value, _align: Align)
| 1234 | } |
| 1235 | |
| 1236 | fn store(&mut self, val: Self::Value, ptr: Self::Value, _align: Align) -> Self::Value { |
| 1237 | let ptr_elem_ty = match self.lookup_type(ptr.ty) { |
| 1238 | SpirvType::Pointer { pointee } => pointee, |
| 1239 | ty => self.fatal(&format!( |
| 1240 | "store called on variable that wasn't a pointer: {ty:?}" |
| 1241 | )), |
| 1242 | }; |
| 1243 | |
| 1244 | // HACK(eddyb) https://github.com/rust-lang/rust/pull/101483 accidentally |
| 1245 | // abused the fact that an `i1` LLVM value will be automatically `zext`'d |
| 1246 | // to `i8` by `from_immediate`, and so you can pretend that, from the |
| 1247 | // Rust perspective, a `bool` value has the type `u8`, as long as it will |
| 1248 | // be stored to memory (which intrinsics all do, for historical reasons) |
| 1249 | // - but we don't do that in `from_immediate`, so it's emulated here. |
| 1250 | let val = match (self.lookup_type(val.ty), self.lookup_type(ptr_elem_ty)) { |
| 1251 | (SpirvType::Bool, SpirvType::Integer(8, false)) => self.zext(val, ptr_elem_ty), |
| 1252 | |
| 1253 | _ => val, |
| 1254 | }; |
| 1255 | |
| 1256 | assert_ty_eq!(self, ptr_elem_ty, val.ty); |
| 1257 | self.emit() |
| 1258 | .store(ptr.def(self), val.def(self), None, empty()) |
| 1259 | .unwrap(); |
| 1260 | val |
| 1261 | } |
| 1262 | |
| 1263 | fn store_with_flags( |
| 1264 | &mut self, |
no test coverage detected