[llvm-dev] replacing sequence of IR instruction to intrinsic/builtin call
Oleg Tsibulnyak via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 20 02:18:33 PDT 2017
Hi,please guide me in solving the next task.I want to replace sequence of IR instruction to call of my own procedure,specifically this sequence (it is adding 2 vectors, each consists from 8 elements):
%31 = getelementptr inbounds i32, i32* %0, i64 %29
%32 = bitcast i32* %31 to <8 x i32>*
%33 = load <8 x i32>, <8 x i32>* %32, align 4, !tbaa !1, !alias.scope !5
%34 = getelementptr inbounds i32, i32* %1, i64 %29
%35 = bitcast i32* %34 to <8 x i32>*
%36 = load <8 x i32>, <8 x i32>* %35, align 4, !tbaa !1, !alias.scope !8
%37 = add nsw <8 x i32> %36, %33
%38 = getelementptr inbounds i32, i32* %2, i64 %29
%39 = bitcast i32* %38 to <8 x i32>*
store <8 x i32> %37, <8 x i32>* %39, align 4, !tbaa !1, !alias.scope !10, !noalias !12
to C procdure likeexec_vect8add(add1stPtr, add2ndPtr, resPtr)
I tried to do this via tablegen (I tried to replace to intrinsic), but cannot compile LLVM.I added to the instruction definition file Cpu0InstrInfo.td next lines:def : Pat<(store (v8i32 (add (v8i32 (load addr:$adr1)), (v8i32 (load addr:$adr2))
)
),
addr:$adrdst
),
(int_cpu0_GEadd addr:$adr1, addr:$adr2, addr:$adrdst)>;
Error during compilation:Included from /home/tsib/LLVM/test/src/lib/Target/Cpu0/Cpu0.td:15:
/home/tsib/LLVM/test/src/lib/Target/Cpu0/Cpu0InstrInfo.td:1125:1: error: In anonymous_537: Cannot use 'int_cpu0_GEadd' in an output pattern!
def : Pat<(store (v8i32 (add (v8i32 (load addr:$adr1)), (v8i32 (load addr:$adr2))
Thanks,Oleg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170320/fb8d4fcf/attachment.html>
More information about the llvm-dev
mailing list