compiler.cfg: add peephole opt to never untag the input of ##bit-count. fixes #1764

char-rename
Jon Harper 2017-01-03 20:43:01 +01:00 committed by John Benediktsson
parent ccbf1c1429
commit dc3ee923ca
3 changed files with 23 additions and 1 deletions

View File

@ -281,3 +281,6 @@ M: ##not optimize-insn
}
[ call-next-method ]
} cond ;
M: ##bit-count optimize-insn
[ no-use-conversion ] [ finish ] [ emit-def-conversion ] tri ;

View File

@ -897,3 +897,21 @@ cpu x86.64? [
T{ ##replace f 1 D: 0 }
} test-peephole
] unit-test
! untag elimination for ##bit-count
2 vreg-counter set-global
{
V{
T{ ##peek f 0 D: 0 }
T{ ##bit-count f 3 0 }
T{ ##shl-imm f 1 3 $[ tag-bits get ] }
T{ ##replace f 1 D: 0 }
}
} [
V{
T{ ##peek f 0 D: 0 }
T{ ##bit-count f 1 0 }
T{ ##replace f 1 D: 0 }
} test-peephole
] unit-test

View File

@ -109,7 +109,8 @@ UNION: peephole-optimizable
##test-imm
##test
##test-imm-branch
##test-branch ;
##test-branch
##bit-count ;
GENERIC: compute-insn-costs ( insn -- )