Also fix undefined behaviour when shift equals the number of bits

As @ben0x539 commented in #18206 for issie #17713

LLVM states:  "If op2 is (statically or dynamically) negative or equal
to or larger than the number of bits in op1, the result is undefined."