https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40073
Segher Boessenkool <segher at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |segher at gcc dot gnu.org --- Comment #10 from Segher Boessenkool <segher at gcc dot gnu.org> --- The shifts done as "int" are defined for shift values 0..31, while the shifts done as "short int" are only defined for 0..15. Defining those for 16..31 in the natural way (0, except shift right signed is -1 if the input was negative) makes it possible to just shift in the smaller mode. But machine insns like PowerPC vslb or vslh do not work that way, so it will need to be expanded in a slightly trickier way, say (input in vA, vB, short int case): vspltib vZ,0 ; vspltib vO,-1 vslh vA,vA,vB vpkuhum vB,vB,vB vmrghb vB,vB,vB vperm vT,vO,vZ,vB vand vA,vA,vT Or, split vB into three parts: vspltih vE,1 vsrh vB1,vB,vE ; vand vB,vB,vE vslh vA,vA,vB1 ; vslh vA,vA,vB1 ; vslh vA,vA,vB (I hope I did that correctly; untested.)