<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi, <br><br>his patch is trying to fold (icmp ult/ule (A + C1), C3) | (icmp ult/ule (A + C2), C3)  to (icmp ult/ule ((A & ~(C1 ^ C2)) + max(C1, C2)), C3)  .<br>This transformation is legal if C1 ^ C2 is one-bit mask, in other word, C1 is only one bit different from C2. In this case, we can “mask” that bit and do just one comparison. <br>A typical example is:<br>isALPHA(c)    ((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z’)<br><br>Now llvm will optimize it to ((c + 191) <=25) || ((c + 159) <=25)<div><br></div><div>With this patch, we can optimize it further to:<br>(c & 223) + 191 <= 25 <br><br><div>The binary format of the constants are:</div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">191   10111111</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">159   10011111</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">223   11011111</div></div><div><br></div>Here is some experiment result on arm64:<br>The patch shows no regression and improve spec2000 perlbmk 3.8% in test-suite under -O3. <br>We also test the spec2006 400.perlbench with ref size input, it will improve 1% under -O3 and 1.2% under -O3+lto+pgo.</div><div><br></div><div>Any comments are appreciated.<br><div> </div></div></body></html>