[Bug tree-optimization/67328] range test rather than single bit test for code testing enum values
amodra at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Aug 25 13:09:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67328
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #3 from Alan Modra <amodra at gmail dot com> ---
Maybe adding #if ALT only confused the issue. For -UALT -O1 on x86_64 I get
test_pic:
testb $1, (%rdi)
je .L1
addl $1, result(%rip)
.L1:
rep ret
test_exe:
movzbl (%rdi), %eax
andl $3, %eax
cmpb $1, %al
ja .L3
addl $1, result(%rip)
.L3:
rep ret
For test_exe I would like to see the following equivalent and better optimised
code.
test_exe:
testb $2, (%rdi)
jne .L3
addl $1, result(%rip)
.L3:
rep ret
The optimisation to a bit test for test_pic happens in reassoc1, or at least
that's where the process starts.
More information about the Gcc-bugs
mailing list