Promote Result Type of Operation

Hi all, I’m a new comer to the forum and still learning LLVM.

Im struggling to understand how to promote result type from f32 to f64, As my target only support f64 and i64 register classes and have the appropriate addRegisterClass(…) for both.

Specifically having a problem with sint_to_fp.
How do I get the result type to promote to f64 instead of softening to i64?

——— Log ———
Legalizing Node: t8: f32 = sint_to_fp t7
Analyzing Result Type : f32
Soften float result 0 : t8 : f32 = sint_to_fp t7

Creating new node : t19: i64 = sign_to_fp t7

With what you’ve said, I’d assume this would just work. If the result type isn’t legal, you should get softening of f32 to f64. Your debug output here doesn’t make sense: “i64 = sign_to_fp t7”; there’s no sign_to_fp and the returned type would have to be f64 not i64

The result types are typically legalized before illegal operands. The more complicated case is if you want softening but the type is also legal

Apologies, it’s a typo supposed to be “sint_to_fp” not “sign…”. And currently it still doesn’t just promote the result type from f32 to f64, still chooses to “soften float type” which is my understanding that it it just changes f32 to i32/i64 as it wants to change things to integers.