https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95650
--- Comment #3 from Alex Coplan <acoplan at gcc dot gnu.org> --- I think clang's optimisation is sound here. C says that we add two shorts as int and then truncate to short (i.e. reduce mod 16). The question is whether the top bits being set (which the ABI allows) can influence the result. I don't think it can. The observation is that the "top bits being set" are just extra multiples of 2^16 in the addition, which just disappear when we reduce mod 2^16. That is: (x_1 + x_2 + y_1 + y_2) % 2^16 = (x_1 + x_2) % 2^16 where x_1,x_2 are arbitrary integers and y_1,y_2 are multiples of 2^16 (the top bits).