This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/79045] bool&bool expanded as 2 jumps
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Jan 2017 18:53:40 +0000
- Subject: [Bug middle-end/79045] bool&bool expanded as 2 jumps
- Auto-submitted: auto-generated
- References: <bug-79045-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79045
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Same situation with:
extern void g();
void f1(char a,char b){ if(a|b)g(); }
void f2(bool a,bool b){ if(a|b)g(); }
f1:
movl %esi, %eax
orb %dil, %al
jne .L4
f2:
testb %dil, %dil
jne .L8
testb %sil, %sil
jne .L8
Also note that for f1 reload fails to figure out that both regs die in (insn
10):
(insn 10 9 11 2 (parallel [
(set (reg:CCZ 17 flags)
(compare:CCZ (ior:QI (subreg:QI (reg:SI 91 [ b ]) 0)
(subreg:QI (reg:SI 89 [ a ]) 0))
(const_int 0 [0])))
(clobber (scratch:QI))
]) "pr79045.c":2 437 {*iorqi_3}
(expr_list:REG_DEAD (reg:SI 91 [ b ])
(expr_list:REG_DEAD (reg:SI 89 [ a ])
(nil))))
so it is free to allocate %esi (or even %edi, iorqi_3 has commutative operands)
as a matched output scratch, resulting in unnecessary reload:
(insn 21 9 10 2 (set (reg:QI 0 ax [93])
(reg:QI 4 si [orig:91 b ] [91])) "pr79045.c":2 84 {*movqi_internal}
(nil))
(insn 10 21 11 2 (parallel [
(set (reg:CCZ 17 flags)
(compare:CCZ (ior:QI (reg:QI 0 ax [93])
(reg:QI 5 di [orig:89 a ] [89]))
(const_int 0 [0])))
(clobber (reg:QI 0 ax [93]))
]) "pr79045.c":2 437 {*iorqi_3}
(nil))