Skip to content

Fix int64->float32 cast codegen#2758

Merged
TheNumbat merged 1 commit intomainfrom
f32-cvt-bug
Jul 3, 2024
Merged

Fix int64->float32 cast codegen#2758
TheNumbat merged 1 commit intomainfrom
f32-cvt-bug

Conversation

@TheNumbat
Copy link
Copy Markdown
Member

@TheNumbat TheNumbat commented Jul 3, 2024

If gas encounters cvtsi2ss where the first (integer) operand is a memory location, it will assume that the int is 32 bits wide.
Hence, we need to suffix the instruction name with the width of the integer operand.
This matches the usage of cvtsi2sd.

This bug does not apply to the internal assembler, which already cases on the operand width.
We believe it does not apply to the nasm assembler (no suffix was required for cvtsi2sd), but nasm isn't tested, and isn't supported in flambda-backend anyway.

(Bug found / fix tested in #2697)

@TheNumbat TheNumbat added bug Something isn't working backend labels Jul 3, 2024
Copy link
Copy Markdown
Contributor

@xclerc xclerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Already reviewed as part of #2697.)

@TheNumbat TheNumbat merged commit 944f991 into main Jul 3, 2024
@TheNumbat TheNumbat deleted the f32-cvt-bug branch July 3, 2024 16:58
Ekdohibs pushed a commit to Ekdohibs/flambda-backend that referenced this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants