@@ -193,7 +193,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
193193 match * ty {
194194 SpirvType :: Void => self . fatal ( "memset invalid on void pattern" ) ,
195195 SpirvType :: Bool => self . fatal ( "memset invalid on bool pattern" ) ,
196- SpirvType :: Integer ( width, _signedness ) => match width {
196+ SpirvType :: Integer ( width, false ) => match width {
197197 8 => self . constant_u8 ( self . span ( ) , fill_byte) . def ( self ) ,
198198 16 => self
199199 . constant_u16 ( self . span ( ) , memset_fill_u16 ( fill_byte) )
@@ -208,6 +208,29 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
208208 "memset on integer width {width} not implemented yet"
209209 ) ) ,
210210 } ,
211+ SpirvType :: Integer ( width, true ) => match width {
212+ 8 => self
213+ . constant_i8 ( self . span ( ) , unsafe { std:: mem:: transmute ( fill_byte) } )
214+ . def ( self ) ,
215+ 16 => self
216+ . constant_i16 ( self . span ( ) , unsafe {
217+ std:: mem:: transmute ( memset_fill_u16 ( fill_byte) )
218+ } )
219+ . def ( self ) ,
220+ 32 => self
221+ . constant_i32 ( self . span ( ) , unsafe {
222+ std:: mem:: transmute ( memset_fill_u32 ( fill_byte) )
223+ } )
224+ . def ( self ) ,
225+ 64 => self
226+ . constant_i64 ( self . span ( ) , unsafe {
227+ std:: mem:: transmute ( memset_fill_u64 ( fill_byte) )
228+ } )
229+ . def ( self ) ,
230+ _ => self . fatal ( format ! (
231+ "memset on integer width {width} not implemented yet"
232+ ) ) ,
233+ } ,
211234 SpirvType :: Float ( width) => match width {
212235 32 => self
213236 . constant_f32 ( self . span ( ) , f32:: from_bits ( memset_fill_u32 ( fill_byte) ) )
@@ -318,7 +341,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
318341 } else {
319342 for index in 0 ..count {
320343 let const_index = self . constant_u32 ( self . span ( ) , index as u32 ) ;
321- let gep_ptr = self . gep ( pat. ty , ptr, & [ const_index] ) ;
344+ let gep_ptr = self . inbounds_gep ( pat. ty , ptr, & [ const_index] ) ;
322345 self . store ( pat, gep_ptr, Align :: from_bytes ( 0 ) . unwrap ( ) ) ;
323346 }
324347 }
0 commit comments