<div dir="ltr">The easiest way here is to take a look at an existing target, say x86, and do what it does :)<div><br></div><div>For specific guidance within x86, take a look at how -msse3 works.</div><div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Mar 4, 2016 at 5:25 PM Rail Shafigulin via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to enable/disable a target feature through clang. <div><br></div><div>Here is how my target looks like</div><div><br></div><div><div>// Esencia subtarget features</div><div>//===----------------------------------------------------------------------===//</div><div>def FeatureMul : SubtargetFeature<"mul", "HasMul", "true",</div><div> "Enable hardware multiplier">;</div><div>def FeatureDiv : SubtargetFeature<"div", "HasDiv", "true",</div><div> "Enable hardware divider">;</div><div>def FeatureCmov : SubtargetFeature<"cmov", "HasCmov", "true",</div><div> "Enable conditional move instruction">;</div><div>def FeatureAddc : SubtargetFeature<"addc", "HasAddc", "true",</div><div> "Enable add with carry instruction">;</div><div><br></div><div>//===----------------------------------------------------------------------===//</div><div>// Esencia processors supported.</div><div>//===----------------------------------------------------------------------===//</div><div>class Proc<string Name, SchedMachineModel Model,</div><div> list<SubtargetFeature> Features></div><div> : ProcessorModel<Name, Model, Features>;</div><div><br></div><div>def : Proc<"esencia", EsenciaModel, [FeatureMul,</div><div> FeatureDiv,</div><div> FeatureCmov,</div><div> FeatureAddc</div><div> ]>;</div><div><br></div><div>This is what I have in EsenciaTargetInfo::setFeatureEnabled(...) in clang/lib/Basic/Targets.cpp</div><div><br></div><div><div> virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,</div><div> StringRef Name,</div><div> bool Enabled) const {</div><div> if (Name == "mul" ||</div><div> Name == "div" ||</div><div> Name == "cmov" ||</div><div> Name == "addc") {</div><div> Features[Name] = Enabled;</div><div> }</div><div> }</div></div><div><br></div><div>Is there a way to enable/disable a given feature through clang? Any flags I need to pass?</div><div><br></div><div>Any help is appreciated.</div><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>