None
EN
A shifty tale about unit testing with Maxwell, NVK's backend compiler
['A Shifty Tale About Unit Testing With Maxwell', "Nvk'S Backend Compiler", 'Faith Ekstrand']
Collabora Newsroom RSS Feed
The PTX docs have a description of the PTX shf instruction but that doesn't have half the modifier bits that the hardware instruction does. It then shifts that value to the right or left (based on a modifier bit) by the shift amount and returns either the high or low 32 bits of the result. impl Foldable for OpShf { fn fold (&self, sm: &dyn ShaderModel, f: &mut OpFoldData< '_ >) { let low = f .get_u32_src (self, &self.low); let high = f .get_u32_src (self, &self.high); let shift = f .get_u32_src (self, &self.shift); let bits: u32 = self.data_type .bits () .try_into () .unwrap (); let shift = if self.wrap { shift & (bits - 1 ) } else { min (shift, bits) }; let folded = if self.data_type .is_signed () { if self.right { (x as i64 ) .checked_shr (shift) .unwrap_or ( 0 ) as u64 } else { (x as…