Open easyaspi314 opened 1 year ago
@llvm/issue-subscribers-backend-x86
So apparently the MMX register passing is implemented, but it must be x86_mmx
, which is not a natural type in C since __m64
encodes to long long vector_size(8)
.
However, both GCC and ICC pass vector_size(8)
in MMX (although they also have issues with state changing themselves).
According to the SysV ABI, 8 byte vectors are to be passed in mm0-mm2 and returned in mm0, and this is the only scenario where a function is called and/or returned in MMX mode.
Currently it seems to be quite random:
Of course this would need to be handled carefully since EMMS is required.
A simple "set it and forget it", albeit a bit inefficient, solution is to treat the function like it takes XMM registers and hardcode a prologue and epilogue to switch between them. Perhaps this could be optimized out if there is a direct bitcast to/from x86_mmx.