This patch depends on D89855. We have patterns to fold RLWINM + RLWINM.
Pairs of RLWINM and ANDI_rec can also be folded in some cases.
Following is a scenario in C code:
int tmp = vec_test_swdiv(x,y); if (((__builtin_rotateleft32(tmp, 62)) & (1)) != 0){ ... }
clang -c t.c -O3 generates the sequence:
xvtdivdp cr0,vs34,vs35 mfocrf r3,128 rlwinm r3,r3,4,28,31 --->generated in POST-RA andi. r3,r3,4
This patch will fold it to:
xvtdivdp cr0,vs34,vs35 mfocrf r3,128 rlwinm. r3,r3,4,29,29
Nice catch! Then should we reuse legacy logic? If ANDI_rec mask is not runofones, we can not fold RLWINM + ANDI_rec to a single RLWINM? If ANDI_rec mask is runofones, can we treat it as special rlwinm_rec with sh = 0, and MB, ME can be got from runofones check?