cmd/compile: support named values on RHS of rewrite rules #38621
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
I'd like to change the amd64 splitload rules to use (TESTQ x x) instead of (CMPQconst [0] x) when possible. However, there's no way to write (TESTQ x x) on the RHS of a rewrite rule unless x is already present on the LHS. You can spell out x twice, but then it generates two distinct values. In normal rewrite rules, we rely on a subsequent CSE to clean that up. But no CSE runs after splitload. Plus that is inefficient. I'd like to be able to write something like:
(CMP(Q|L|W|B)constload {sym} [vo] ptr mem) && valOnly(vo) == 0 -> (TEST(Q|L|W|B) x:(MOV(Q|L|W|B)load {sym} [offOnly(vo)] ptr mem) x)
Comments?
cc @mvdan @randall77
The text was updated successfully, but these errors were encountered: