@@ -147,6 +147,8 @@ class jit_generator : public Xbyak::CodeGenerator, public c_compatible {
147147
148148private:
149149 const size_t xmm_len = 16 ;
150+ const size_t ymm_len = 32 ;
151+ const size_t zmm_len = 64 ;
150152#ifdef _WIN32
151153 const size_t xmm_to_preserve_start = 6 ;
152154 const size_t xmm_to_preserve = 10 ;
@@ -182,6 +184,35 @@ class jit_generator : public Xbyak::CodeGenerator, public c_compatible {
182184
183185 inline size_t get_size_of_abi_save_regs () { return size_of_abi_save_regs; }
184186
187+ using Xbyak::CodeGenerator::push;
188+ using Xbyak::CodeGenerator::pop;
189+
190+ inline void push (const Xbyak::Xmm &xmm) {
191+ if (xmm.isXMM ()) {
192+ sub (rsp, xmm_len);
193+ uni_vmovdqu (ptr[rsp], xmm);
194+ } else if (xmm.isYMM ()) {
195+ sub (rsp, ymm_len);
196+ uni_vmovdqu (ptr[rsp], Xbyak::Ymm{xmm.getIdx ()});
197+ } else if (xmm.isZMM ()) {
198+ sub (rsp, zmm_len);
199+ uni_vmovdqu (ptr[rsp], Xbyak::Zmm{xmm.getIdx ()});
200+ }
201+ }
202+
203+ inline void pop (const Xbyak::Xmm &xmm) {
204+ if (xmm.isXMM ()) {
205+ uni_vmovdqu (xmm, ptr[rsp]);
206+ add (rsp, xmm_len);
207+ } else if (xmm.isYMM ()) {
208+ uni_vmovdqu (Xbyak::Ymm{xmm.getIdx ()}, ptr[rsp]);
209+ add (rsp, ymm_len);
210+ } else if (xmm.isZMM ()) {
211+ uni_vmovdqu (Xbyak::Zmm{xmm.getIdx ()}, ptr[rsp]);
212+ add (rsp, zmm_len);
213+ }
214+ }
215+
185216 void preamble () {
186217 if (xmm_to_preserve) {
187218 sub (rsp, xmm_to_preserve * xmm_len);
0 commit comments