[LLVMdev] using f32 in a 64bit integer only architecture
Jeroen.Dobbelaere at synopsys.com
Tue Jul 30 08:26:53 PDT 2013
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)
- 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)
More information about the llvm-dev