On Fri, Sep 15, 2017 at 08:40:41PM +0200, Jakub Jelinek wrote: > > > I'm greatly oversimplifying here. Type promotion/demotion is fairly > > > complex to get right. > > > > Yeah :-( > > > > Maybe the best thing is to promote really early, but to keep track of which > > bits matter. And then adjust some passes to take that into account. Not a > > trivial amount of work. > > Is type promotion actually what we want to do early? I'd think type > demotion is what better canonicalizes the IL and removes redundant > operations (e.g. those affecting only high bits if we only care about low > bits).
On gimple we already have smallest type possible, I think? When expanding to RTL that then needs to only use instructions that exist for the target. And then problems happen -- we only have instructions that work on full registers on many targets (or also on 32-bit items), but we do not care about the higher bits in some cases, or we only need it to be sign/zero extended and we do not need a separate extend insn in many cases (but the RTL passes do not realise that). Or do you see problems during gimple as well? Segher