Jeroen Dobbelaere
2013-Jul-30 15:26 UTC
[LLVMdev] using f32 in a 64bit integer only architecture
Hi, I am working on a 64bit architecture where only 'i64' is valid (no hardware floating point support) and I am triggering a 'Promote may not follow Expand or Promote' assertion failure. (TargetLowering.h : getTypeConversion) When I look into it, I see that the conversion fails because llvm tries to convert a 'f32' into a 'i32' through a TypeSoftenFloat. As i32 needs promotion to i64, this assertion is triggered. The other way around: a 32bit architecture (only i32 is valid) with doubles (f64) seems to work just fine. So, it seems that a 'TypeSoftenFloat' followed by an 'Expand' is valid (f64->i64->i32) Note: - this is for llvm-3.3 - In TargetLoweringBase.cpp , I find that (when f32 and f64 are not valid): -- the default action for 'f64' is to convert it into a 'i64' -- the default action for 'f32' is to convert it into a 'i32' Is this kind of support easy to add ? What would be the places that need to be updated ? (I tried with adding a direct promotion from f32 into i64 in TargetLoweringBase.cpp, but that seems to trigger other issues, so I am not sure if that is the right way to go) Greetings, Jeroen Dobbelaere
Micah Villmow
2013-Jul-30 15:50 UTC
[LLVMdev] using f32 in a 64bit integer only architecture
Jeroen, This most likely is the case that no one has ran into this situation before and there was no need to implement this code path. I ran into this quite often when working on the GPU backend. Micah> -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Jeroen Dobbelaere > Sent: Tuesday, July 30, 2013 8:27 AM > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] using f32 in a 64bit integer only architecture > > Hi, > > I am working on a 64bit architecture where only 'i64' is valid (no hardware > floating point support) and I am triggering a 'Promote may not follow Expand > or Promote' assertion failure. > (TargetLowering.h : getTypeConversion) > > When I look into it, I see that the conversion fails because llvm tries to > convert a 'f32' > into a 'i32' through a TypeSoftenFloat. > As i32 needs promotion to i64, this assertion is triggered. > > The other way around: a 32bit architecture (only i32 is valid) with doubles > (f64) seems to work just fine. So, it seems that a 'TypeSoftenFloat' followed > by an 'Expand' is valid (f64->i64->i32) > > Note: > - this is for llvm-3.3 > - In TargetLoweringBase.cpp , I find that (when f32 and f64 are not valid): > -- the default action for 'f64' is to convert it into a 'i64' > -- the default action for 'f32' is to convert it into a 'i32' > > Is this kind of support easy to add ? What would be the places that need to > be updated ? > (I tried with adding a direct promotion from f32 into i64 in > TargetLoweringBase.cpp, but that seems to trigger other issues, so I am not > sure if that is the right way to go) > > Greetings, > > Jeroen Dobbelaere > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev