<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 15, 2011, at 6:51 PM, Jakob Stoklund Olesen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 15, 2011, at 5:02 PM, Chris Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">One major advantage of recognizing popcount though is that the optimizer has a chance of hacking on it, and there are a lot of instcombine xforms that we could do.  Here are some that I note looking at the bc file for crafy (when hacked to use builtin_popcount).  I attached the bc file below if you're interested.<br></span></span></blockquote></div><br><div>I noticed that we have intrinsics and ISD nodes for ctlz, cttz, and ctpop, but none for parity. Is that on purpose?</div><div><br></div><div>Currently, clang compiles __builtin_parity to:</div><div><br></div><div><div>define i32 @f(i32 %x) nounwind readnone ssp {</div><div>entry:</div><div>  %tmp1 = tail call i32 @llvm.ctpop.i32(i32 %x)</div><div>  %tmp2 = and i32 %tmp1, 1</div><div>  ret i32 %tmp2</div><div>}</div></div></div></blockquote><div><br></div><div>I found an old PR1983 covering this.</div><div><br></div><div>I don't know if there would be any advantage to a parity intrinsic over the current ctpop(x)&1 representation.</div><div><br></div></div></body></html>