<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Now I remember why I don't pass Type as a parameter to this
function.<br>
The pass need to examine if the underlying architecture has HW
support (for some popular int type) at very beginning. <br>
At that moment, it doesn't even know if the loop has popcount
pattern, let alone which Type is involved.<br>
<br>
<br>
<blockquote cite="mid:50EDB765.2020600@gmail.com" type="cite">
<blockquote
cite="mid:CAGCO0KioZnKjLjNE9PYfDEMLO4knuzZGQM+MuYSsGS0Q+JW_og@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="im">
<blockquote type="cite">
<div
style="font-family:arial,helvetica,sans-serif;font-size:10pt">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"> <br>
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
URL: <a moz-do-not-send="true"
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=168931&r1=168930&r2=168931&view=diff"
target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=168931&r1=168930&r2=168931&view=diff</a><br>
==============================================================================<br>
---
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
(original)<br>
+++
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Thu Nov 29 13:38:54 2012<br>
@@ -17670,6 +17670,17 @@<br>
return -1;<br>
}<br>
<br>
+ScalarTargetTransformInfo::PopcntHwSupport<br>
+X86ScalarTargetTransformImpl::getPopcntHwSupport(unsigned
TyWidth) const {<br>
+ assert(isPowerOf2_32(TyWidth)
&& "Ty width must be power of
2");</blockquote>
<div><br>
</div>
<div>This constraint seems strange. It
certainly doesn't seem like it should be
an assert.</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
It catch the case when this function is fed with
nonsense parameter, and it at least make sense for x86</div>
</blockquote>
<div><br>
</div>
<div style="">I understand, but I disagree with that
design. Specifically, at the IR level we have integer
types that are not powers of two width. If this is an
important constraint, than it should be very clearly
documented, but it would seem more reasonable in a layer
like the TTI interface to either A) return 'none' or
whatever the conservative answer is, or B) accept the
IR-level type, run it through legalization to see the
legalized type it ends up with, and use that width.</div>
<div><br>
</div>
<div style="">I would suggest B here as it seems a more
robust solution and to follow the spirit of TTI --
modeling the result of CodeGen when lowering the code.</div>
</div>
</div>
</div>
</blockquote>
I just want to make sure the interface is very simple. If the
width is not power-of-2, we can simply ignore it <br>
for the sake of simplicity. <br>
</blockquote>
<br>
</body>
</html>