nir: add strength reduction pattern for imod/irem with pow2 divisor.
As far as I understand, the nir_op_imod is based on SPIRV OpSMod and is defined as
- res = x - y * floor(x/y)
while nir_op_irem is based on SPIRV OpSRem and is defined as
- res = x - y * trunc(x/y)
The pattern are derived from the following formula:
imod = y >= 0 ? x & (|y|-1) : x | ~(|y|-1)
irem = x >= 0 ? x & (|y|-1) : x | ~(|y|-1)
where the |y| are already further reduced.
Please let me know, if I misunderstood anything w.r.t. correctness.