From nobody Sat Apr 12 08:58:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1609781906; cv=none; d=zohomail.com; s=zohoarc; b=bFnQ0G3dN+cjkQAmKltoJB0GS0ZAwY8S1qf+1XoDxBWdSkVIkb5PE91DUpwQzepADG2soVpCUHZEerN1W0P0FkGdOecENHWKS4s62ukjeg2OeyJR57z+oRx8Lw42q2XLFszFugA5mLjXbnbkYLlaM7E0aq29lLT4yD36m/bTMcQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609781906; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=syv5POQauWlsA/GaWvGPwJkQ5na4OEjJVqqBKvu8/Fw=; b=jSimFFB7CFwRY3fQICbUnw67XX9sw9Hc4HkbZahr2q8b4lw98c1PaE2HnbPbrmoDITfGGsMYKozfvsTIAaPh6QyrH4b2nM27VfuJQJnGZLyUe+arC+W9jrfXWeHbnVy0lteaWmhOmhfHZwbTJBBUPRaMUnA4OT0vKOHXXXY2KUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609781906564514.1173649779587; Mon, 4 Jan 2021 09:38:26 -0800 (PST) Received: from localhost ([::1]:51722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwToH-00064V-Er for importer@patchew.org; Mon, 04 Jan 2021 12:38:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwTlN-0003sP-8V for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:30 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:43773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwTlJ-0005yG-H5 for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:25 -0500 Received: by mail-pl1-x631.google.com with SMTP id x12so14896053plr.10 for ; Mon, 04 Jan 2021 09:35:21 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id a131sm50706933pfd.171.2021.01.04.09.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 09:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=syv5POQauWlsA/GaWvGPwJkQ5na4OEjJVqqBKvu8/Fw=; b=tB+dKXTI6oe6ldQxxCgTfUF6DTiISZ44bVnRYHmpW5PFJgYehfRHANDUsV4jN/Vg7r n1f2oNoz3dcC8ApitV0rFLwNhd00+/uS6mNoBoEP4k3XnhfNzGtSwTlvb5qdkONxPzUd 4rCEVFe4/g+6rAVv/T9V8S/8Djz7DFvWpLCCuPFkYC7I4R9FwS+zGjfPhHcgJH68me1T BwpHkvYQIb9WcNi4kiRZh647SUAIUqv7H3i5Pn8ITyTAoUCtlRDs6iCCUlCeUy1Bm5YK +oZUh61UHzQEvb17rP6zGDiHC2bdUSsaoE/pV5Wjnm81tcamO9jRfjAXeMmXixHjNKwc uOXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=syv5POQauWlsA/GaWvGPwJkQ5na4OEjJVqqBKvu8/Fw=; b=cdzRNbPsXpGLzptb7yBikr9S44raYJJeVwLvuNy1ErgZ9wClZ+yHVOjOiilvQYEj8Y FhSGM1a4ipA7s81k7HzGlQm04VXAKAPXWP/o1ewP2zM/70elCX7662+ZsPUfc99EIQ3+ vMwI6wnxvhcUgE2IfqBe33OzuKI9ycw9bG77FULn579zIfHhYsCn1Si51G92JKTPzA1U meZTvK2zW0KbyP0VMjY8dUkaQYoiGI707b8fgYSUClSYUVW01Hs9ekXrDhyvnd7R4Hkc /ZZVG6fO41D1ajXRIgMEnAFp7JxOOVKGCSIr+Ef7vpBgtwQzC9d9//uM2RNY/Ia8ADTc Sk/Q== X-Gm-Message-State: AOAM530bDrttUpAwitewloN3FkfaCluIIi1v63G9mY0DdK/cAiDQJbdL EtnF0CePICQL0HEnCOOwNmR72eNIFKMO3g== X-Google-Smtp-Source: ABdhPJxqMoRgJtYOgoPYmjEMKmXa2n5qhB8+yvTKU0MAbObvOzWkUpkLqcWanN/yF7t+G4RwCClWsA== X-Received: by 2002:a17:90a:4096:: with SMTP id l22mr30291130pjg.114.1609781719860; Mon, 04 Jan 2021 09:35:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/3] tcg: Use memset for large vector byte replication Date: Mon, 4 Jan 2021 07:35:13 -1000 Message-Id: <20210104173515.198921-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104173515.198921-1-richard.henderson@linaro.org> References: <20210104173515.198921-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-stable@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) In f47db80cc07, we handled odd-sized tail clearing for the case of hosts that have vector operations, but did not handle the case of hosts that do not have vector ops. This was ok until e2e7168a214b, which changed the encoding of simd_desc such that the odd sizes are impossible. Add memset as a tcg helper, and use that for all out-of-line byte stores to vectors. This includes, but is not limited to, the tail clearing operation in question. Cc: qemu-stable@nongnu.org Buglink: https://bugs.launchpad.net/bugs/1907817 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 11 +++++++++++ include/exec/helper-proto.h | 4 ++++ tcg/tcg-op-gvec.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 4eda24e63a..2e36d6eb0c 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -28,6 +28,17 @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr= , env) =20 DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) =20 +#ifndef IN_HELPER_PROTO +/* + * Pass calls to memset directly to libc, without a thunk in qemu. + * Do not re-declare memset, especially since we fudge the type here; + * we assume sizeof(void *) =3D=3D sizeof(size_t), which is true for + * all supported hosts. + */ +#define helper_memset memset +DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) +#endif /* IN_HELPER_PROTO */ + #ifdef CONFIG_SOFTMMU =20 DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h index a0a8d9aa46..659f9298e8 100644 --- a/include/exec/helper-proto.h +++ b/include/exec/helper-proto.h @@ -35,11 +35,15 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2),= dh_ctype(t3), \ dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \ dh_ctype(t7)); =20 +#define IN_HELPER_PROTO + #include "helper.h" #include "trace/generated-helpers.h" #include "tcg-runtime.h" #include "plugin-helpers.h" =20 +#undef IN_HELPER_PROTO + #undef DEF_HELPER_FLAGS_0 #undef DEF_HELPER_FLAGS_1 #undef DEF_HELPER_FLAGS_2 diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index ddbe06b71a..1a41dfa908 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -547,6 +547,9 @@ static void do_dup(unsigned vece, uint32_t dofs, uint32= _t oprsz, in_c =3D dup_const(vece, in_c); if (in_c =3D=3D 0) { oprsz =3D maxsz; + vece =3D MO_8; + } else if (in_c =3D=3D dup_const(MO_8, in_c)) { + vece =3D MO_8; } } =20 @@ -628,6 +631,35 @@ static void do_dup(unsigned vece, uint32_t dofs, uint3= 2_t oprsz, /* Otherwise implement out of line. */ t_ptr =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_ptr, cpu_env, dofs); + + /* + * This may be expand_clr for the tail of an operation, e.g. + * oprsz =3D=3D 8 && maxsz =3D=3D 64. The size of the clear is misali= gned + * wrt simd_desc and will assert. Simply pass all replicated byte + * stores through to memset. + */ + if (oprsz =3D=3D maxsz && vece =3D=3D MO_8) { + TCGv_ptr t_size =3D tcg_const_ptr(oprsz); + TCGv_i32 t_val; + + if (in_32) { + t_val =3D in_32; + } else if (in_64) { + t_val =3D tcg_temp_new_i32(); + tcg_gen_extrl_i64_i32(t_val, in_64); + } else { + t_val =3D tcg_const_i32(in_c); + } + gen_helper_memset(t_ptr, t_ptr, t_val, t_size); + + if (!in_32) { + tcg_temp_free_i32(t_val); + } + tcg_temp_free_ptr(t_size); + tcg_temp_free_ptr(t_ptr); + return; + } + t_desc =3D tcg_const_i32(simd_desc(oprsz, maxsz, 0)); =20 if (vece =3D=3D MO_64) { --=20 2.25.1 From nobody Sat Apr 12 08:58:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1609781881; cv=none; d=zohomail.com; s=zohoarc; b=mU5U1lsBFIUw9CND1RMZauRl8z3ooyZn/3gZFjSnoQnQ/AwZ2MVCUPmmxZz+ixGUJgexkWOUtiUC4qzIS5H95nN9XXwnSHoiyU9v9ZAUBjThkfyljR2XGFjzAri/7CXKUbPj4Hl0WISBJUGFAKdWZv4GAW7Srx+pbHO9VAuB5KU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609781881; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nSzBZtUK2LkfTKeonDTNF1AsDJCvjcDNLNACAlJxGQs=; b=CGlStvVzw3dm7/t1LNmTt116v47Fl8jLWHphHJOoyRXgy3UeSTW7ps4MpJT+xCKdPozHZwW6HG/HBZG1lhprYnEozBlSwCDRXX8oz6HwrrOgxjneMl752jnlGmhpMSH86ez20Hqv5blt62468QNFEbAU4CaSuWThDg0pt1czIqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609781881282181.8953404933511; Mon, 4 Jan 2021 09:38:01 -0800 (PST) Received: from localhost ([::1]:50742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwTnr-0005gJ-Ry for importer@patchew.org; Mon, 04 Jan 2021 12:37:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwTlN-0003sQ-My for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:30 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:43635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwTlL-0005yj-7f for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:25 -0500 Received: by mail-pf1-x42e.google.com with SMTP id c12so16819138pfo.10 for ; Mon, 04 Jan 2021 09:35:22 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id a131sm50706933pfd.171.2021.01.04.09.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 09:35:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nSzBZtUK2LkfTKeonDTNF1AsDJCvjcDNLNACAlJxGQs=; b=YhIswXX2MtMi5K2dtSOi/Q2wJThkCXl7Tfk65eSO0fMLL8PLll36ZBsEklbmNXugVZ Stvmmff2YnC41t9utvZu3xTYkzXA4uvw+14++ZnDaeSE2wM7FOKW3YRZv90wYqY6vC3G J/pESBjgnty5YYwGEuuhahBqIi9tIOXC0sIhGEpiMFVCA+g2Fam0Vu4mB/2y3AMFZA9F Du7zazwDzqM1u5MAZwG9UsgsrIIwKRe4DgVZHSn0l05evLkPrqNLfA1QyMPPHRczMJw5 9JGudWQMTS+Ul3HKRSsf9ZdsX6sYi2W+f3ncVNhcaVDK+5tU6uSL0g1wB49bvFZuEqY4 z/fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nSzBZtUK2LkfTKeonDTNF1AsDJCvjcDNLNACAlJxGQs=; b=rZGzjj7dw/2ltHBW4Qp2PZ1y7i0MLorASikn+2xyB1KyB2NlGE9NDS/bB/NQydwvHs jF8ZMlKaE/vDixh06+xyUyMEazneSNr3C6v3LYvoY/xDLZSiAhgi52qNhcNCoFo5lltI oBLd+7+4jmZIXU9dFUvzvdYLldHUvTfOHrDmFxgj3Rn7F2bp+CkJ9b5EAKBntanPMGdC NkFj94OVBAOvfRdKGTsgNWJ49A3IDtB/4t5qIx1VMX+9yqnzTTeR/NWCqggwFjaHvWfS 0otFH5HhO/bBlz2Z3RHbH6Is0UFCuBUuluJbdvKFnIU//nIOCR2VQRy0kiJYpggsMd4R 7iDQ== X-Gm-Message-State: AOAM533z7EAV4+eEmP55EeYvxYWj9akLldillB0MyCNibDMdSReYaj7b +l4Li7W4iWuP8yLvLEFQ5b0QhQZN8eLRbw== X-Google-Smtp-Source: ABdhPJyEJIQsyC0vacVfTCrSubfpdB/GKPl1B03DpE5hh/ypTA80P2iqwI+SuNOC1oxeJUFzAG4FTA== X-Received: by 2002:a05:6a00:a88:b029:19e:4ba8:bbe4 with SMTP id b8-20020a056a000a88b029019e4ba8bbe4mr67430423pfl.41.1609781721641; Mon, 04 Jan 2021 09:35:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/3] tcg/riscv: Fix illegal shift instructions Date: Mon, 4 Jan 2021 07:35:14 -1000 Message-Id: <20210104173515.198921-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104173515.198921-1-richard.henderson@linaro.org> References: <20210104173515.198921-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Zihao Yu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Zihao Yu Out-of-range shifts have undefined results, but must not trap. Mask off immediate shift counts to solve this problem. This bug can be reproduced by running the following guest instructions: xor %ecx,%ecx sar %cl,%eax cmovne %edi,%eax After optimization, the tcg opcodes of the sar are movi_i32 tmp3,$0xffffffffffffffff pref=3Dall sar_i32 tmp3,eax,tmp3 dead: 2 pref=3Dall mov_i32 cc_dst,eax sync: 0 dead: 1 pref=3D0xffc0300 mov_i32 cc_src,tmp3 sync: 0 dead: 0 1 pref=3Dall movi_i32 cc_op,$0x31 sync: 0 dead: 0 pref=3Dall The sar_i32 opcode is a shift by -1, which unmasked generates 0x200808d618: fffa5b9b illegal Signed-off-by: Zihao Yu Message-Id: <20201216081206.9628-1-yuzihao@ict.ac.cn> [rth: Reworded the patch description.] Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index d536f3ccc1..4089e29cd9 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1462,14 +1462,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_shl_i32: if (c2) { - tcg_out_opc_imm(s, OPC_SLLIW, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SLLIW, a0, a1, a2 & 0x1f); } else { tcg_out_opc_reg(s, OPC_SLLW, a0, a1, a2); } break; case INDEX_op_shl_i64: if (c2) { - tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2 & 0x3f); } else { tcg_out_opc_reg(s, OPC_SLL, a0, a1, a2); } @@ -1477,14 +1477,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_shr_i32: if (c2) { - tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2 & 0x1f); } else { tcg_out_opc_reg(s, OPC_SRLW, a0, a1, a2); } break; case INDEX_op_shr_i64: if (c2) { - tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2 & 0x3f); } else { tcg_out_opc_reg(s, OPC_SRL, a0, a1, a2); } @@ -1492,14 +1492,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, =20 case INDEX_op_sar_i32: if (c2) { - tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2 & 0x1f); } else { tcg_out_opc_reg(s, OPC_SRAW, a0, a1, a2); } break; case INDEX_op_sar_i64: if (c2) { - tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2); + tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2 & 0x3f); } else { tcg_out_opc_reg(s, OPC_SRA, a0, a1, a2); } --=20 2.25.1 From nobody Sat Apr 12 08:58:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1609782108; cv=none; d=zohomail.com; s=zohoarc; b=byUZ762G0SxyFXib1gJSlmbsXPAuGM3FewXM5eHoAAVGjVvJ2+LmH2pMKsVnUU3b9SwaDoEIFfhQfyXWPxyK3S/bahb3Iu8+GGGorc1xhRpo7BRsxM8baEdTlqFmrzvFCGKhgAvyBDbr23m07/y4XcDWiqr7ydHyjwdNGNLmYUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609782108; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T4//Q2GCuPy7as6bx6wtUDgAn+xSz8nl2x8ziXjxGSQ=; b=L5lNqNhnUPQB3BNNBwOe/ORCALFIZ6zR1Ud+2JGNI5kWqIo5zXhQqVVgmiPShHjT44Tfa76CeBYFu6cWER0iJeydudvyIV/5iWzCG5A+swbVqbQK7td65NPTHMnqG+hMSOU9m/e4oPBQlTTFLgsuEYtqLlyOtYVKuWMLulN7Sxo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609782108786889.4394887887066; Mon, 4 Jan 2021 09:41:48 -0800 (PST) Received: from localhost ([::1]:58784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwTrX-0000sL-NW for importer@patchew.org; Mon, 04 Jan 2021 12:41:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwTlS-0003uG-Pt for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:31 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:33729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwTlM-0005zx-TY for qemu-devel@nongnu.org; Mon, 04 Jan 2021 12:35:28 -0500 Received: by mail-pg1-x52d.google.com with SMTP id n25so19512768pgb.0 for ; Mon, 04 Jan 2021 09:35:24 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id a131sm50706933pfd.171.2021.01.04.09.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 09:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T4//Q2GCuPy7as6bx6wtUDgAn+xSz8nl2x8ziXjxGSQ=; b=c2eSPGW7PizGHA2sRC+OCDiEm3eF9IHpa5Hr8HQI9E5Y59c1tt9nKFxufYL2x1GAly 58eFRhVIsvlyUw+5kRRXE5SSDuJtYpiqgzMXkP4M25Yd3PZXLdiIS2V6ueOI/hvdC9bp wyb0ViKX4gVoAblonN6u5+zEhlGSlga5MdWPxcL2sSyS6nYQWVAJvP/fdCcaKVAO+EEn drkyjXXi7Zorkz9Lqvo7r8tnQGLrpSl0y20u+2qIZRZmCPx0pD1Wtt8hYWncz9w9RwHJ dMIql1VtPS7W2vCppMKkwLYB2uDLFii8aQycPzyuWOKmEX7vxcWil4IEVXZqvqDjIW4X BMIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T4//Q2GCuPy7as6bx6wtUDgAn+xSz8nl2x8ziXjxGSQ=; b=WcbGc8lltjaaVx/pUEvxTL7jmm0VREHEC5LtZobZSwgBhpQoNoeg5RVGRgUxMvnsnD 9SklYt3r6GMNp7gqHYkRc8m6Q22DwexXWXzbTqyIyrXWVTWxfbW7Vhu4wnRxs3blWBpF sYRVAhKzl3YbnFmi4rLd0c7cS7HQVnv9Z42gbx7f+D9uiHMgtKTNxhKU4yXYhH5vMUeR LVS+ruP2ezoi1N50uv3QZYWBG4cQsXaavbW0uv4VwmdB+sE5OSrtg9cpXUkX6ewpeTR+ Dy9awZax53Yomz2vgLNulHieNyubj2ddLiDoZ2dg5x6yAmylRUJ8mojfPJjAQzB3CF+p Z0gg== X-Gm-Message-State: AOAM5315Qy7eRiZ+1JZTxJIZ63gfhoOTSUDqBpc2K1r8Lnt3gGxxs1HU GBevUaXOAstxLDYK9e4HUnDkFb1KRC+3XA== X-Google-Smtp-Source: ABdhPJyi/rEgJfkG2fFjR9YIi7QkxL/i7hw+VH+NgDn1kMPmXp5VHGqeoG5NhmZpM3Fq1AQqz48mOw== X-Received: by 2002:a62:7b84:0:b029:19c:7146:4bbb with SMTP id w126-20020a627b840000b029019c71464bbbmr66747940pfc.52.1609781723249; Mon, 04 Jan 2021 09:35:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/3] tcg: Add tcg_gen_bswap_tl alias Date: Mon, 4 Jan 2021 07:35:15 -1000 Message-Id: <20210104173515.198921-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104173515.198921-1-richard.henderson@linaro.org> References: <20210104173515.198921-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Chang , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The alias is intended to indicate that the bswap is for the entire target_long. This should avoid ifdefs on some targets. Reviewed-by: Frank Chang Signed-off-by: Richard Henderson --- include/tcg/tcg-op.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h index 5abf17fecc..5b3bdacc39 100644 --- a/include/tcg/tcg-op.h +++ b/include/tcg/tcg-op.h @@ -1085,6 +1085,7 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGAr= g offset, TCGType t); #define tcg_gen_bswap16_tl tcg_gen_bswap16_i64 #define tcg_gen_bswap32_tl tcg_gen_bswap32_i64 #define tcg_gen_bswap64_tl tcg_gen_bswap64_i64 +#define tcg_gen_bswap_tl tcg_gen_bswap64_i64 #define tcg_gen_concat_tl_i64 tcg_gen_concat32_i64 #define tcg_gen_extr_i64_tl tcg_gen_extr32_i64 #define tcg_gen_andc_tl tcg_gen_andc_i64 @@ -1197,6 +1198,7 @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGAr= g offset, TCGType t); #define tcg_gen_ext32s_tl tcg_gen_mov_i32 #define tcg_gen_bswap16_tl tcg_gen_bswap16_i32 #define tcg_gen_bswap32_tl tcg_gen_bswap32_i32 +#define tcg_gen_bswap_tl tcg_gen_bswap32_i32 #define tcg_gen_concat_tl_i64 tcg_gen_concat_i32_i64 #define tcg_gen_extr_i64_tl tcg_gen_extr_i64_i32 #define tcg_gen_andc_tl tcg_gen_andc_i32 --=20 2.25.1