<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">Hello,</p>
<p style="margin:0px 0px 1.2em!important">I’m not sure if this is the right place to ask beginner questions.</p>
<p style="margin:0px 0px 1.2em!important">If not, please direct me to the appropriate place.</p>
<p style="margin:0px 0px 1.2em!important">I’m writing my first <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">llvm</code> program and I’m trying to call an intrinsic, but failing.</p>
<p style="margin:0px 0px 1.2em!important">So far this is what I have:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">declare ccc i32 @llvm.x86.bmi.pdep.32(i32, i32)
@.str2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
declare i32 @printf(i8*, ...) nounwind
; Definition of main function
define i32 @main() {
%res = call ccc i32 (i32, i32) @llvm.x86.bmi.pdep.32( i32 1, i32 1 )
%a = alloca i32, align 8
%1 = load i32, i32* %a, align 8
%ss = getelementptr inbounds [4 x i8], [4 x i8]* @.str2, i32 0, i32 0
call i32 (i8*, ...) @printf( i8* %ss, i32 %res)
ret i32 0
}
</code></pre><p style="margin:0px 0px 1.2em!important">When I run this code, I get the following error:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">$ lli helloWorld.ll
LLVM ERROR: Cannot select: intrinsic %llvm.x86.bmi.pdep.32
</code></pre><p style="margin:0px 0px 1.2em!important">Where am I going wrong?</p>
<p style="margin:0px 0px 1.2em!important">Also, what’s the best resource for learning <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">llvm</code>?</p>
<p style="margin:0px 0px 1.2em!important">Cheers,</p>
<p style="margin:0px 0px 1.2em!important">-John</p>
<div title="MDH:SGVsbG8sPGRpdj48YnI+PC9kaXY+PGRpdj5JJ20gbm90IHN1cmUgaWYgdGhpcyBpcyB0aGUgcmln
aHQgcGxhY2UgdG8gYXNrIGJlZ2lubmVyIHF1ZXN0aW9ucy48L2Rpdj48ZGl2Pjxicj48L2Rpdj48
ZGl2PklmIG5vdCwgcGxlYXNlIGRpcmVjdCBtZSB0byB0aGUgYXBwcm9wcmlhdGUgcGxhY2UuPC9k
aXY+PGRpdj48YnI+PC9kaXY+PGRpdj5JJ20gd3JpdGluZyBteSBmaXJzdCBgbGx2bWAgcHJvZ3Jh
bSBhbmQgSSdtIHRyeWluZyB0byBjYWxsIGFuIGludHJpbnNpYywgYnV0IGZhaWxpbmcuPC9kaXY+
PGRpdj48YnI+PC9kaXY+PGRpdj5TbyBmYXIgdGhpcyBpcyB3aGF0IEkgaGF2ZTo8L2Rpdj48ZGl2
Pjxicj48L2Rpdj48ZGl2PmBgYDwvZGl2PjxkaXY+PGRpdj5kZWNsYXJlIGNjYyBpMzIgQGxsdm0u
eDg2LmJtaS5wZGVwLjMyKGkzMiwgaTMyKTwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+QC5zdHIy
ID0gcHJpdmF0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