[LLVMdev] type promotion i16 -> i32
Jim Grosbach
grosbach at apple.com
Thu Jun 23 09:34:12 PDT 2011
On Jun 23, 2011, at 8:47 AM, Giovanni Ansaloni wrote:
>
> Hello,
> I'm developing a llvm backend. It seems that, if i16 is not a legal type
> (no register can hold i16 types in RegisterInfo.td and as a RegisterClass in
> SelLowering.cpp), i16 should be promoted to i32.
Arithmetic operations will be promoted to the next-smallest legal type (i32 usually). Loads and stores, however, will not. You still need to implement patterns for those. In particular, the extending loads and truncating stores.
-Jim
> Nonotheless, this simple program:
>
> int main(){
> volatile short a;
> a= 3;
> return 0;
> }
>
> which is trasformed in this IR:
>
> define i32 @main() nounwind readnone {
> entry:
> %a = alloca i16, align 2 ; <i16*> [#uses=1]
> volatile store i16 3, i16* %a, align 2
> ret i32 0
> }
>
> fails to compile with the following error:
>
> LLVM ERROR: Cannot yet select: 0x181c2d0: ch = store 0x1204a08, 0x181c248,
> 0x181be90, 0x181bfa0 <0x12022ec:0> <trunc i16> <volatile> alignment=2
>
> Can anybody help?
> Thanks
> Giovanni.
>
> --
> View this message in context: http://old.nabble.com/type-promotion-i16--%3E-i32-tp31911111p31911111.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> 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