This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63464] compare one character to many: faster
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Jan 2015 17:28:19 +0000
- Subject: [Bug tree-optimization/63464] compare one character to many: faster
- Auto-submitted: auto-generated
- References: <bug-63464-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464
--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or try to deal with this in combine. We have:
(insn 91 90 92 18 (parallel [
(set (reg:DI 149 [ D.1943 ])
(and:DI (reg:DI 147 [ D.1943 ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) vrp66-1.c:32 379 {*anddi_1}
(expr_list:REG_DEAD (reg:DI 147 [ D.1943 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 92 91 94 18 (parallel [
(set (reg:DI 150 [ D.1943 ])
(xor:DI (reg:DI 149 [ D.1943 ])
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) vrp66-1.c:32 401 {*xordi_1}
(expr_list:REG_DEAD (reg:DI 149 [ D.1943 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 94 92 95 18 (parallel [
(set (reg:QI 93 [ D.1944 ])
(and:QI (subreg:QI (reg:DI 150 [ D.1943 ]) 0)
(const_int 1 [0x1])))
(clobber (reg:CC 17 flags))
]) vrp66-1.c:32 383 {*andqi_1}
(expr_list:REG_DEAD (reg:DI 150 [ D.1943 ])
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
and I believe nonzero_bits is smart enough to say that nonzero_bits of
(subreg:QI (reg:DI 150 [ D.1943 ]) 0) is 1. But the problem is that
simplify-rtl attempts to match all kinds of weird patterns, like:
(parallel [
(set (reg:QI 93 [ D.1944 ])
(eq:QI (zero_extract:DI (reg:DI 147 [ D.1943 ])
(const_int 1 [0x1])
(const_int 0 [0]))
(const_int 0 [0])))
(clobber (reg:CC 17 flags))
])
etc. Perhaps if everything fails, if for and with constant it would just try
to call nonzero_bits on the non-constant operand and if only bits set in the
constant mask are set, it would try to match the stmt into a plain assignment?