<div dir="ltr">Hi Joshua,<div><br></div><div>Thanks for your great comment. I made up a ConstantVector in IR. Then I successfully use AVX intrinsics to retrieve the returned vector data. The remaining thing is that how to pass the vectors to LLVM function using intrinsics. Do you have any suggestions? Please forgive me if the question is too naive.</div><div><br></div><div>I pasted below two IR I used. The first one works. The second one doesn't. This means I didn't pass the _m256I into LLVM function correctly. Could you please take a look at it?</div><div><br></div><div>I really appreciate your help!</div><div><br></div><div>Jia</div><div><br></div><div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255);float:none;display:inline">//////////////////////////////</span><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255);float:none;display:inline">//////////////////////////////</span><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255);float:none;display:inline">//////////////////////////////</span><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(255,255,255);float:none;display:inline">/</span><br class="gmail-Apple-interchange-newline" style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br class="gmail-Apple-interchange-newline">My function call:</div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><div> __m256i input =_mm256_set_epi64x(1, 1, 1, 1);</div></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><div>__m256i result = _mm256_load_si256(function(&input,&input,&input,&input,&input,&input,&input,&input));</div><div>int64_t r0 = _mm256_extract_epi64(result, 0);</div><div>int64_t r1 = _mm256_extract_epi64(result, 1);</div><div>int64_t r2 = _mm256_extract_epi64(result, 2);</div><div>int64_t r3 = _mm256_extract_epi64(result, 3);</div></div>
<br></div><div><br></div><div>
<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">/</span></div><div>I can retrieve the returned value using the following IR</div><div><br></div><div>
<div>define <4 x i64> @tpchq6(<4 x i64> %leaf7, <4 x i64> %leaf8, <4 x i64> %leaf9, <4 x i64> %leaf10, <4 x i64> %leaf11, <4 x i64> %leaf12, <4 x i64> %leaf13, <4 x i64> %leaf14) #0 {</div><div>entry:</div><div> ret <4 x i64> <i64 5, i64 6, i64 7, i64 8></div><div>}</div></div><div><br></div><div>
<div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">//////////////////////////////</span><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">/</span></div><div style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">I cannot retrieve the returned value using the following IR</div>
<br></div><div><div>define <4 x i64> @tpchq6(<4 x i64> %leaf7, <4 x i64> %leaf8, <4 x i64> %leaf9, <4 x i64> %leaf10, <4 x i64> %leaf11, <4 x i64> %leaf12, <4 x i64> %leaf13, <4 x i64> %leaf14) #0 {</div><div>entry:</div><div> ret <4 x i64> %leaf7</div><div>}</div></div><div><br></div><div>Thanks,</div><div>Jia Yu</div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin:0in 0in 0.0001pt"><span style="line-height:21px"><font color="#666666" face="garamond, serif" size="2">------------------------------------</font></span></p><p style="margin:0in 0in 0.0001pt"><font color="#666666" face="garamond, serif" size="2"><span style="line-height:21px">Jia Yu,</span></font></p><p style="margin:0in 0in 0.0001pt"><font color="#666666" face="garamond, serif" size="2"><span style="line-height:21px">Ph.D. Student in </span></font><span style="color:rgb(102,102,102);font-family:garamond,serif;font-size:small">Computer Science</span></p><div style="line-height:21px"><p style="line-height:normal;margin:0in 0in 0.0001pt"><font color="#666666" face="garamond, serif" size="2"><a href="http://www.asu.edu/" target="_blank">Arizona State University</a> </font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 23, 2018 at 6:50 AM Cranmer, Joshua 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 lang="EN-US" link="blue" vlink="purple">
<div class="m_2367572598520865402WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">In x86 ABI terms, a result that is a vector is returned in %xmm0 (or %ymm0/%zmm0 if the size is >128 bits). All other scalar types are returned via %rax (or some
subslice thereof).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">The way you’re calling the function is expecting the value to be found in %rax, where the callee is trying to return it in %xmm0, which means you’re reading the
results of some scratch register. What you’ll want to do is either use the gcc/clang vector intrinsics to get a vector type for the function call or modify the code to read/write the vectors via memory references rather than passing them as arguments/return
values.<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_2367572598520865402__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal" style="margin-left:.5in"><a name="m_2367572598520865402______replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Jia Yu via llvm-dev<br>
<b>Sent:</b> Monday, July 23, 2018 6:02<br>
<b>To:</b> <a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] LLVM FunctionType cannot be returned as VectorType?<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">Hi Stefan,<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thank you very much for answering my question!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I followed your suggestion but the function still cannot return the correct result. I also set target-feature attributes for my function. I am using LLVM 6.0.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">It only prints out some random large numbers but the correct answer is supposed to be all 0.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
Can you please help me figure out what's going on here? Any help will be greatly appreciated.<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">My function prototype definition:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">auto vectorDataType = VectorType::get(IntegerType::getIntNTy(TheContext, 64), 4);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> std::vector<Type *> vecArguments;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> for (Uint64 nodeId = startOfLeaves; nodeId < numNodes; ++nodeId) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> vecArguments.push_back(vectorDataType);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> proto = FunctionType::get(vectorDataType,//int64*4 = __m256i<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> vecArguments, false);<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<span style="background:white">///////////////////////////////////////////////////////////////////////////////////////////</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">The generated IR:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">define <4 x i64> @tpchq6(<4 x i64> %leaf7, <4 x i64> %leaf8, <4 x i64> %leaf9, <4 x i64> %leaf10, <4 x i64> %leaf11, <4 x i64> %leaf12, <4 x i64> %leaf13, <4 x i64> %leaf14) #0 {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">entry:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp = add <4 x i64> %leaf8, %leaf7<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp1 = add <4 x i64> %addtmp, %leaf9<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp4 = add <4 x i64> %addtmp1, %leaf10<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp2 = add <4 x i64> %addtmp4, %leaf11<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp3 = add <4 x i64> %addtmp2, %leaf12<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp5 = add <4 x i64> %addtmp3, %leaf13<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> %addtmp6 = add <4 x i64> %addtmp5, %leaf14<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> ret <4 x i64> %addtmp6<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">}<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><br>
My JIT function call:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">using VecInt = int64_t[4];<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">auto function = (int64_t *(*)(<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> , VecInt<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> ))(TheExecutionEngine->getFunctionAddress(TheFunction->getName().str()));<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">VecInt argsX = {0,0,0,0};<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">int64_t* result = function(argsX,argsX,argsX,argsX,argsX,argsX,argsX,argsX);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="background:white">///////////////////////////////////////////////////////////////////////////////////////////</span><br>
My output result:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">422162285262848 562251371602737 843692813695832 422162285262848<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<span style="background:white">It only prints out some random large numbers but the correct answer is supposed to be all 0.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<span style="background:white">///////////////////////////////////////////////////////////////////////////////////////////</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thanks,<br>
Jia<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Garamond",serif;color:#666666">------------------------------------</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Garamond",serif;color:#666666">Jia Yu,</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Garamond",serif;color:#666666">Ph.D. Student in </span><span style="font-family:"Garamond",serif;color:#666666">Computer Science</span><u></u><u></u></p>
<div>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Garamond",serif;color:#666666"><a href="http://www.asu.edu/" target="_blank">Arizona State University</a> </span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">On Sun, Jul 22, 2018 at 8:51 AM Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com" target="_blank">stefan.graenitz@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
Hi Jia<br>
<br>
I don't think this is a problem with the ExecutionEngine. Your problem comes from the confusion of the "Vector Type" in LLVM IR [1] with the "std::vector" data structure in the C++ STL. While there is no direct relation between the two, you should be able to
use a std::vector to provide the input for the <4 x i61> Vector Type by passing the std::vector's raw data [3].<br>
<br>
However, it would be easier with something like this:<br>
<br>
using VecInt = int64[4];<br>
VecInt args0 { 0, 1, 2, 3 };<br>
...<br>
VecInt result = function(args0, ...);<br>
<br>
Btw.: Note that you may need to set target-feature attributes for your function like so: [3]<br>
<br>
Hope it helps.<br>
<br>
Cheers,<br>
Stefan<br>
<br>
[1] <a href="https://llvm.org/docs/LangRef.html#vector-type" target="_blank">https://llvm.org/docs/LangRef.html#vector-type</a><br>
[2] <a href="https://en.cppreference.com/w/cpp/container/vector" target="_blank">
https://en.cppreference.com/w/cpp/container/vector</a><br>
[3] <a href="https://en.cppreference.com/w/cpp/container/vector/data" target="_blank">
https://en.cppreference.com/w/cpp/container/vector/data</a><br>
[4] <a href="https://github.com/weliveindetail/DecisionTreeCompiler/blob/master/compiler/DecisionTreeCompiler.cpp#L83" target="_blank">
https://github.com/weliveindetail/DecisionTreeCompiler/blob/master/compiler/DecisionTreeCompiler.cpp#L83</a><u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">Am 20.07.18 um 02:02 schrieb Jia Yu via llvm-dev:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:.5in">Dear all, <u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I am using LLVM C++ API to generate some code. In particular, I am dealing with AVX2 SIMD API which uses __m256i.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">My function input types a set of vectors and return type is also a vector.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> arguments.push_back(VectorType::get(IntegerType::getIntNTy(TheContext, 64), 4));//int64*4 = __m256i<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> FunctionType * proto = FunctionType::get(VectorType::get(IntegerType::getIntNTy(TheContext, 64), 4),//int64*4 = __m256i<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> arguments, false);<u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-left:.5in">I can successfully use this way to produce the IR of my function properly like this:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black">define <4 x i64> @tpchq6(<4 x i64> %leaf7, <4 x i64> %leaf8, <4 x i64> %leaf9, <4 x i64> %leaf10, <4 x i64> %leaf11, <4 x i64> %leaf12, <4 x i64> %leaf13, <4 x i64> %leaf14) {</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black">entry:</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %addtmp = add <4 x i64> %leaf14, %leaf13</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %leaf8.neg = sub <4 x i64> zeroinitializer, %leaf8</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %xortmp = xor <4 x i64> %addtmp, %leaf11</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %addtmp1 = add <4 x i64> %leaf8.neg, %leaf7</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %subtmp = add <4 x i64> %addtmp1, %leaf9</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %addtmp2 = add <4 x i64> %subtmp, %leaf10</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> %addtmp3 = add <4 x i64> %addtmp2, %xortmp</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black"> ret <4 x i64> %addtmp3</span><u></u><u></u></p>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;vertical-align:baseline">
<span style="font-family:"Arial",sans-serif;color:black">}</span><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-left:.5in">However, when I use JIT ExectionEngine to run it, it cannot return the Vector type properly. I tried the jit execution engine with non-vector return like int64, it works fine.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">My code is as follows: It always tells me segment fault<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">// Define the input/output data type in LLVM function<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> typedef std::vector<int64_t> VecInt;<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">auto function = reinterpret_cast<VecInt (*)(VecInt , VecInt, VecInt, VecInt, VecInt, VecInt, VecInt, VecInt)>(TheExecutionEngine->getFunctionAddress(TheFunction->getName().str()));<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">VecInt result = function(functionCallArgs[0],functionCallArgs[1],functionCallArgs[2],functionCallArgs[3],<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> functionCallArgs[4],functionCallArgs[5],functionCallArgs[6],functionCallArgs[7]);<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">std::cout<<"result size "<< <span style="background:white">
result</span>.size()<<"\n";<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white">///////////////////////////////////////////////////////////////////////////////////////////<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in;background:white"><u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><br>
Can someone tell me whether this is the correct way to retrieve the vector return type? Or is the vector type return supported?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Jia Yu<br clear="all">
<u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p style="margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt">
<u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<u></u> <u></u></p>
<pre style="margin-left:.5in">_______________________________________________<u></u><u></u></pre>
<pre style="margin-left:.5in">LLVM Developers mailing list<u></u><u></u></pre>
<pre style="margin-left:.5in"><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><u></u><u></u></pre>
<pre style="margin-left:.5in"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><u></u><u></u></pre>
</blockquote>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<u></u><u></u></p>
<pre style="margin-left:.5in">-- <u></u><u></u></pre>
<pre style="margin-left:.5in"><a href="https://weliveindetail.github.io/blog/" target="_blank">https://weliveindetail.github.io/blog/</a><u></u><u></u></pre>
<pre style="margin-left:.5in"><a href="https://cryptup.org/pub/stefan.graenitz@gmail.com" target="_blank">https://cryptup.org/pub/stefan.graenitz@gmail.com</a><u></u><u></u></pre>
</div>
</blockquote>
</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>