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 #96306
  • Loading branch information
jakobbotsch authored and github-actions committed Feb 21, 2024
1 parent fe2ea4e commit 437a6c3
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 @@ -6154,8 +6154,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 437a6c3

Please sign in to comment.