[LLVMdev] libcalls for shifts

Villmow, Micah Micah.Villmow at amd.com
Tue Jan 10 10:52:04 PST 2012


Johannes,
 Try a custom lowering of the 64bit shift instructions and then in the Lower[SRL|SHL|SRA] function, generate a call instruction to the function you want.

Micah

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Johannes Birgmeier
> Sent: Sunday, January 08, 2012 2:38 AM
> To: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] libcalls for shifts
> 
> > Is i64 a legal type on your target?  If so, you might need to hack the
> > code generator a bit; no in-tree target has a legal integer type that
> > doesn't support shifts.  If not, I have no idea how you're getting
> > that error.
> 
> Yes, well, i64 is a legal type, that's how it is. However, i64s are
> always stored in two 32-bit registers and in some cases need complicated
> instruction patterns for easy things (such as add, sub and so on) that
> basically simulate the i64 behaviour with a sequence of i32
> instructions. Simulating an i64 shift with two variables (no immediates)
> with i32 instructions is so complicated that the target (the TI C64x+
> family) has libcalls for them. Instructions for i32 shift exist, of
> course.
> 
> Thanks for your help. I'll maybe start tearing up the code generator
> then. (I've already tried just copying the MakeLibCall function from the
> right class into our *Lowering.cpp and calling it using custom lowering,
> but some pass doesn't like that; I suspect it's our scheduler.)
> 
> Regards,
> Johannes
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev






More information about the llvm-dev mailing list