[llvm-dev] Back end with special loop instructions

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Mon May 30 16:30:59 PDT 2016


Hi Alex,

You might find it useful to look at how lib/Target/PowerPC/PPCCTRLoops.cpp works.

 -Hal

----- Original Message -----
> From: "Alex Susu via llvm-dev" <llvm-dev at lists.llvm.org>
> To: "llvm-dev" <llvm-dev at lists.llvm.org>
> Sent: Monday, May 30, 2016 5:09:37 PM
> Subject: [llvm-dev] Back end with special loop instructions
> 
> Hello.
>      I'm writing a back end for my research SIMD processor that has
>      an assembly language
> that is blocked structured, with one-level loops. An example program
> with my assembly
> language:
>        REPEAT_X_TIMES(Param2)
>          R0 = LS[offset_A];
>        END_REPEAT;
> 
>      The LLVM code somewhat equivalent to the above ASM program is:
>        vector.body:
>          %index = phi i64 [ %index.unr,
>          %vector.body.preheader.split.split ], [
> %index.next.3, %vector.body ]
>          %20 = getelementptr inbounds i32, i32* %A, i64 %index
>          %21 = bitcast i32* %20 to <16 x i32>*
>          %wide.load = load <16 x i32>, <16 x i32>* %21, align 4
>          br i1 %48, label %middle.block.unr-lcssa, label
>          %vector.body, !llvm.loop !3
> 
>      How do you suggest to attack this problem?
>      I guess I need to provide custom matching code in the Select()
>      function of the back
> end prior to the SelectCode() invocation in order to translate the
> label vector.body in
> LLVM/Machine Instr(DAG) before selection to a REPEAT_X_TIMES(...)
> instruction - are you
> aware if anybody else has done such a thing? Also, the br LLVM
> instruction will be
> translated to an END_REPEAT.
> 
>    Thank you,
>      Alex
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory


More information about the llvm-dev mailing list