<div dir="ltr"><div>I am working on AVX2 code generation by LLVM framework.<br><br></div><div>I want to generate LLVM-IR code for the following code by C/C++ API from LLVM framework. I am using LLVM3.8.<br></div><div>Basically, I want to generate TARGET (Refer to below) LLVM-IR code for SOURCE function by C/C++ API.<br></div><div>As you see below, the AVX2 data type is __m256i which is vector type. How can I indicate vector type (function return type, input parameters) for IRBuiler by C/C++ APIs?<br><br></div><div>I don't see any example online and please let me know if anybody has examples.<br></div><div><br><br></div><div><br>SOURCE:<br>#include "immintrin.h"<br>__m256i sum(__m256i a, __m256i b) {<br>    return a+b;<br>}<br><br></div><div>TARGET: <br>michael@michael-Precision-Tower-3420:~/Year_2017/work_DEMO$ cat avx2_add2.ll<br>; ModuleID = 'avx2_add2.c'<br>target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"<br>target triple = "x86_64-unknown-windows-cygnus"<br><br>; Function Attrs: nounwind<br>define <4 x i64> @sum(<4 x i64> %a, <4 x i64> %b) #0 {<br>  %1 = alloca <4 x i64>, align 32<br>  %2 = alloca <4 x i64>, align 32<br>  store <4 x i64> %a, <4 x i64>* %1, align 32<br>  store <4 x i64> %b, <4 x i64>* %2, align 32<br>  %3 = load <4 x i64>, <4 x i64>* %1, align 32<br>  %4 = load <4 x i64>, <4 x i64>* %2, align 32<br>  %5 = add <4 x i64> %3, %4<br>  ret <4 x i64> %5<br>}<br><br>attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }<br><br>!llvm.ident = !{!0}<br><br>!0 = !{!"clang version 3.8.1 (tags/RELEASE_381/final)"}<br><br></div><div>Thanks,<br></div><div>Michael<br></div></div>