Skip to content

Commit

Permalink
JIT: Home float parameters before integer parameters
Browse files Browse the repository at this point in the history
Parameters that are going into float registers can come from integer
registers in the presence of struct promotion. We need to home those
before integer parameters or the source register could have been
overridden by the integer parameter homing logic.

Ideally it seems like the homing logic should be unified to handle all
parameters simultaneously, but this seems like a simple enough fix. I do
not think we have ABIs where we have the opposite kind constraint
(integer parameters coming from float registers).

Fix dotnet#96306
  • Loading branch information
jakobbotsch committed Jan 3, 2024
1 parent 9cc490e commit c0cd071
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6228,8 +6228,14 @@ void CodeGen::genFnProlog()
};

#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_ARM)
assignIncomingRegisterArgs(&intRegState);
// Handle float parameters first; in the presence of struct promotion
// we can have parameters that are homed into float registers but
// passed in integer registers. So make sure we get those out of the
// integer registers before we potentially override those as part of
// handling integer parameters.

assignIncomingRegisterArgs(&floatRegState);
assignIncomingRegisterArgs(&intRegState);
#else
assignIncomingRegisterArgs(&intRegState);
#endif
Expand Down

0 comments on commit c0cd071

Please sign in to comment.