From 72fb58b3dfd4f9a40d5f3b0f87e26d9f24136570 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Sun, 21 May 2023 22:41:51 +0200 Subject: [PATCH] Use VEX xorps to zero a zmm reg (#86555) Co-authored-by: Tanner Gooding --- src/coreclr/jit/codegenxarch.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index 72939e8..f849495 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -517,7 +517,13 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, simd_t } else if (val64.IsZero()) { - emit->emitIns_SIMD_R_R_R(INS_xorps, attr, targetReg, targetReg, targetReg); + // Use VEX version because it's smaller (for zmm0-zmm15) than EVEX to zero a zmm register and still + // zeros the entire register: + // + // xorps zmm0, zmm0, zmm0 (6 bytes) + // xorps ymm0, ymm0, ymm0 (4 bytes) + // + emit->emitIns_SIMD_R_R_R(INS_xorps, EA_32BYTE, targetReg, targetReg, targetReg); } else { -- 2.7.4