From 2ff3639d85d76d1d644267277e283d7c78dabc3c Mon Sep 17 00:00:00 2001 From: Nicolas Capens Date: Fri, 15 Feb 2019 14:41:03 -0500 Subject: [PATCH] Work around x86-64 calling convention bug MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Microsoft's x86-64 calling convention ABI requires registers XMM6-15 to be preserved by the callee: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017#calling-convention-defaults Currently only the System V calling convention's behavior is supported, which does not have any callee-saved XMM registers. Fixing this properly is non-trivial and this bug is blocking other projects, so a temporary workaround is to limit Subzero to use only scratch registers XMM0-XMM5. Bug chromium:931926 Bug swiftshader:22 Change-Id: If3fde2295fc65fc52042124afe7dfc46873cce3f Reviewed-on: https://swiftshader-review.googlesource.com/c/25568 Tested-by: Nicolas Capens Reviewed-by: Alexis Hétu --- src/Common/Version.h | 2 +- third_party/subzero/src/IceInstX8664.def | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Common/Version.h b/src/Common/Version.h index 78c74b2f0..423fcf143 100644 --- a/src/Common/Version.h +++ b/src/Common/Version.h @@ -15,7 +15,7 @@ #define MAJOR_VERSION 4 #define MINOR_VERSION 1 #define BUILD_VERSION 0 -#define BUILD_REVISION 5 +#define BUILD_REVISION 6 #define STRINGIFY(x) #x #define MACRO_STRINGIFY(x) STRINGIFY(x) diff --git a/third_party/subzero/src/IceInstX8664.def b/third_party/subzero/src/IceInstX8664.def index 57038d6c0..3d455a61b 100644 --- a/third_party/subzero/src/IceInstX8664.def +++ b/third_party/subzero/src/IceInstX8664.def @@ -239,25 +239,25 @@ NO_ALIASES()) \ X(Reg_xmm5, 5, "xmm5", Reg_xmm5, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm6, 6, "xmm6", Reg_xmm6, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm6, 6, "xmm6", Reg_xmm6, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm7, 7, "xmm7", Reg_xmm7, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm7, 7, "xmm7", Reg_xmm7, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm8, 8, "xmm8", Reg_xmm8, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm8, 8, "xmm8", Reg_xmm8, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm9, 9, "xmm9", Reg_xmm9, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm9, 9, "xmm9", Reg_xmm9, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm10, 10, "xmm10", Reg_xmm10, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm10, 10, "xmm10", Reg_xmm10, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm11, 11, "xmm11", Reg_xmm11, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm11, 11, "xmm11", Reg_xmm11, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm12, 12, "xmm12", Reg_xmm12, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm12, 12, "xmm12", Reg_xmm12, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm13, 13, "xmm13", Reg_xmm13, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm13, 13, "xmm13", Reg_xmm13, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm14, 14, "xmm14", Reg_xmm14, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm14, 14, "xmm14", Reg_xmm14, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ - X(Reg_xmm15, 15, "xmm15", Reg_xmm15, 1,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ + X(Reg_xmm15, 15, "xmm15", Reg_xmm15, 0,0,0,0,0, 0,0,0,0,0, 1, 0,0,0,0,0, \ NO_ALIASES()) \ /* End of xmm register set */ //#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, -- 2.11.0