@@ -193,7 +193,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
193
193
match * ty {
194
194
SpirvType :: Void => self . fatal ( "memset invalid on void pattern" ) ,
195
195
SpirvType :: Bool => self . fatal ( "memset invalid on bool pattern" ) ,
196
- SpirvType :: Integer ( width, _signedness ) => match width {
196
+ SpirvType :: Integer ( width, false ) => match width {
197
197
8 => self . constant_u8 ( self . span ( ) , fill_byte) . def ( self ) ,
198
198
16 => self
199
199
. constant_u16 ( self . span ( ) , memset_fill_u16 ( fill_byte) )
@@ -208,6 +208,29 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
208
208
"memset on integer width {width} not implemented yet"
209
209
) ) ,
210
210
} ,
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
+ } ,
211
234
SpirvType :: Float ( width) => match width {
212
235
32 => self
213
236
. constant_f32 ( self . span ( ) , f32:: from_bits ( memset_fill_u32 ( fill_byte) ) )
@@ -318,7 +341,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
318
341
} else {
319
342
for index in 0 ..count {
320
343
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] ) ;
322
345
self . store ( pat, gep_ptr, Align :: from_bytes ( 0 ) . unwrap ( ) ) ;
323
346
}
324
347
}
0 commit comments