On 12/01/2016 04:21 AM, Paolo Bonzini wrote:
In code like the following from KVM:
/* it is a read fault? */
error_code = (exit_qualification << 2) & PFERR_FETCH_MASK;
it would be nicer to write
/* it is a read fault? */
error_code = (exit_qualification & VMX_EPT_READ_FAULT_MASK) ?
PFERR_FETCH_MASK : 0;
instead of having to know the difference between the positions of the
source and destination bits. LLVM catches the latter just fine (which
is why I am sending this in stage 3...), but GCC does not, so this
patch adds two patterns to catch it.
The combine.c hunk of v1 has been committed already.
Bootstrapped/regtested x86_64-pc-linux-gnu, ok?
Paolo
2016-11-26 Paolo Bonzini <bonz...@gnu.org>
* match.pd: Simplify X ? C : 0 where C is a power of 2 and
X tests a single bit.
2016-11-26 Paolo Bonzini <bonz...@gnu.org>
* gcc.dg/fold-and-lshift.c, gcc.dg/fold-and-rshift-1.c,
gcc.dg/fold-and-rshift-2.c: New testcases.
OK.
jeff