using f32 in a 64bit integer only architecture


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)


Jeroen Dobbelaere

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.