The SELR(Mux) instructions can be converted to two-address form as LOCR(Mux) instructions whenever one of the sources are the same reg as dest. By adding this mapping in getTwoOperandOpcode(), we get:
- Two address hints in getRegAllocationHints() for select register instructions.
- No effect in foldMemoryOperandImpl() as the select register instructions do not have a memory mapped instructions. This is possibly a potential improvement to be utilized as is currently done for the K (3-address) instructions.
- no need for special handling in SystemZShortenInst.cpp - shortenSelect() removed.
It seems that there is yet another part of the "high-muxes patch" that never got committed separately, namely the moving of the handling of two-address hints to be done before the GRX32 hints, in getRegAllocationHints(), which this patch also does.
Instruction mix effects on SPEC 2006:
selgrlh : 1728 231 -1497 locgre : 1923 3385 +1462 selgre : 1511 753 -758 locgrlh : 1159 1861 +702 selgrl : 1175 499 -676 locrl : 1354 1996 +642 selgrnle : 641 82 -559 locgrle : 356 905 +549 locgrhe : 779 1320 +541 selrl : 1081 541 -540 locgrl : 722 1059 +337 selrh : 536 209 -327 ahi : 31094 31403 +309 ahik : 26654 26351 -303 locrle : 502 749 +247 locre : 761 977 +216 selgrhe : 216 4 -212 selgrh : 489 277 -212 selre : 333 162 -171 ...
Number of spill instructions go up just a little in total:
master <> patch Spill|Reload : 187260 187339 +79 Copies : 414305 414303 -2
This seems to be small enough to be considered random. It seems that the number of spilled live ranges in total are very slightly less, while the number of instructions emitted for spill/restore are very slightly more... I could not find any reason to suspect anything in particular with the test cases I tried to examine, and it should hopefully not be bad to hint (softly) a two-address register.
738 files are different.