From: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx> Date: Thu, 16 Feb 2023 16:43:04 +0100 > From: Jesper Dangaard Brouer <jbrouer@xxxxxxxxxx> > Date: Thu, 16 Feb 2023 16:17:46 +0100 [...] >> Summary, the only thing we can save is replacing some movzx >> (zero-extend) with mov instructions. > > Good stuff, thanks! When I call to not use short types on the stack, the > only thing I care about is the resulting object code, not simple "just > don't use it, I said so". So when a developer inspects the results from > using one or another type, he's free in picking whatever he wants if it > doesn't hurt optimization. Oh, forgot to mention: I just don't want to give people "bad" example. I mean, someone may look at some code where u8-u16s are actively used and start thinking that it's a regular/standard practice, while it's not. I've seen a lot of places in the kernel where the short types were used only because "the queue index can't be bigger than 255", "we won't handle more than 64Kb of data in one loop anyway" and then the stack is full of u8s and u16s and the object code (I'm talking more about hotpaths, but generally is applicable to any code) is full of masking and other completely avoidable operations. > > [...] Thanks, Olek