From ba51ff6a74393971a5a9aaaa797f3490c3c37b4d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 12 Sep 2023 23:26:44 +0200 Subject: [PATCH] Issue #2307 - Part 1: Extend masm with the pmovmskb SSE2 instruction. --- js/src/jit/x86-shared/Assembler-x86-shared.h | 4 ++++ js/src/jit/x86-shared/BaseAssembler-x86-shared.h | 6 ++++++ js/src/jit/x86-shared/Encoding-x86-shared.h | 1 + 3 files changed, 11 insertions(+) diff --git a/js/src/jit/x86-shared/Assembler-x86-shared.h b/js/src/jit/x86-shared/Assembler-x86-shared.h index 7b01f9c3ef..d7cba49aff 100644 --- a/js/src/jit/x86-shared/Assembler-x86-shared.h +++ b/js/src/jit/x86-shared/Assembler-x86-shared.h @@ -2275,6 +2275,10 @@ class AssemblerX86Shared : public AssemblerShared MOZ_ASSERT(HasSSE2()); masm.vmovmskps_rr(src.encoding(), dest.encoding()); } + void vpmovmskb(FloatRegister src, Register dest) { + MOZ_ASSERT(HasSSE2()); + masm.vpmovmskb_rr(src.encoding(), dest.encoding()); + } void vptest(FloatRegister rhs, FloatRegister lhs) { MOZ_ASSERT(HasSSE41()); masm.vptest_rr(rhs.encoding(), lhs.encoding()); diff --git a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h index d14ec89742..484039fd23 100644 --- a/js/src/jit/x86-shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/BaseAssembler-x86-shared.h @@ -2,6 +2,7 @@ * * ***** BEGIN LICENSE BLOCK ***** * Copyright (C) 2008 Apple Inc. All rights reserved. + * Portions Copyright (C) 2022, 2023 Moonchild Productions. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -3051,6 +3052,11 @@ public: twoByteOpSimdInt32("vmovmskps", VEX_PS, OP2_MOVMSKPD_EdVd, src, dst); } + void vpmovmskb_rr(XMMRegisterID src, RegisterID dst) + { + twoByteOpSimdInt32("vpmovmskb", VEX_PD, OP2_PMOVMSKB_EdVd, src, dst); + } + void vptest_rr(XMMRegisterID rhs, XMMRegisterID lhs) { threeByteOpSimd("vptest", VEX_PD, OP3_PTEST_VdVd, ESCAPE_38, rhs, invalid_xmm, lhs); } diff --git a/js/src/jit/x86-shared/Encoding-x86-shared.h b/js/src/jit/x86-shared/Encoding-x86-shared.h index 405413828d..a55d5029e6 100644 --- a/js/src/jit/x86-shared/Encoding-x86-shared.h +++ b/js/src/jit/x86-shared/Encoding-x86-shared.h @@ -265,6 +265,7 @@ enum TwoByteOpcodeID { OP2_PSRLD_VdqWdq = 0xD2, OP2_PMULLW_VdqWdq = 0xD5, OP2_MOVQ_WdVd = 0xD6, + OP2_PMOVMSKB_EdVd = 0xD7, OP2_PSUBUSB_VdqWdq = 0xD8, OP2_PSUBUSW_VdqWdq = 0xD9, OP2_PANDDQ_VdqWdq = 0xDB,