This patch handles addimm chains in SelectAddrRegImm to better reuse materialized constant when the offset is larger than the maximum immediate.
Can this create additional LUIs if the lower 12-bits wrap around? That defeats the point of the common base optimization.
Does this prevent using C.LW/C.SW/C.LD/C.SD because we've increased the size of the offsets?
I feel like this should be handled where the chain was formed or in DAG combine. The whole reason the chain exists is to provide a common base. If the common base isn't right we should fix that.
Zcf and Zcd imply Zca so I don't think you need to check them. You can also hasStdExtCOrZca.