From nobody Sun May 5 12:50:17 2024 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=1599170969; cv=none; d=zohomail.com; s=zohoarc; b=d5cnRh1Dnyz+B4MrdvGbVtFn0oi9hstS3boCNfZ/ymhoo0etWJCcdRgaD6T6V39Hmk1dbUuoNNqgrraZhXCfY1h1t9+KyeNtODGkaNQN2yJii0UARqtk8Z+KBNgZ+8hpuU83qzKIZxaXe7KAKrC3An7DAi7cdfMNwW2h40d04Uk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599170969; 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=IMG3qseWSaOmr5obAEbYxrSknPJe5yf/j+8Oo8HLII4=; b=b+xzmNKDUsiVzzwHUy/THnd1V3Gppbuw1n5Vv8tVLWCI6V/M2zbtDYwBAyjP8WTla8jAInZHTTHzuEvlqgYdkJmD3ZQOOroqXTydCotsnwvVfKwRQHJWQBE7Y1f2KCdR6aALu7YNzUfcNXD34eYC48/zQ+5/9oGj/LZ2Bwap0eY= 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 1599170969602227.77596396840443; Thu, 3 Sep 2020 15:09:29 -0700 (PDT) Received: from localhost ([::1]:59378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDxQ8-0002Hi-M0 for importer@patchew.org; Thu, 03 Sep 2020 18:09:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDwym-0007RO-GK for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:14 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:46152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDwyh-0004aB-2W for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:12 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 31so3141132pgy.13 for ; Thu, 03 Sep 2020 14:41:06 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v17sm4113290pfn.24.2020.09.03.14.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 14:41:04 -0700 (PDT) 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=IMG3qseWSaOmr5obAEbYxrSknPJe5yf/j+8Oo8HLII4=; b=VOrzOhmlVAWCYlFKporFwHYZxIC51hXuBXnY4gSTM16rv4qVYEl8t4IBIo2fI/SYn9 Dc3sxXqdOPM7molRjqDUKOT5NX0VOvSsT+H7A2ioRyADljrQyIrA09BZmAaQq3042rHO B42IqSWmrgTa2QyLb+/vjRihknaqPgy47CAjBWFpkl0f6n5j43sM9MO3DkMJ8CLNH1+Q OFQb9liuAfIfZ659RmqTNCPvN/XPyXHqtQXBFEd1+v6eycpcMOcJhE52Nslj8AvMLDPN 03oVs3gL7g3KC6QCmsl6UDsMTJoYTaql5rfblK3p3+3yFCdT3U8f94zwmNFAPRyNZ7sG UWrA== 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=IMG3qseWSaOmr5obAEbYxrSknPJe5yf/j+8Oo8HLII4=; b=lCmqSBG/iEr7jFBYNhBezjMC4hxMnzTSn5RoWiglvg82lBgWGy7YAAyZiVF7gCHxud 9jlS34i7VWjMeKBSuZFUY2oVf0Vna4zkaxG5XF+/5bH/osWrb4du0M3k6kNEzZ8WGH+4 XnyqItU93GIyFYiK1YgQMyPVTv0s8X1Euou99RUnEOZUtk2c1nnfnrQ2XPUcnjJknPVp 2cMgBGLfYOuc5Y+/g8AmEUP/HJAsNItIivnJeGI7FMY51w+/lKvzqgLynTDp8SL+fMV9 yA5TXoQZAAnSRpqs1zmFGTRudnxAC6MUsOqNv5QdnVqudtJSGsEV8Dexgg5l55M/F3/G SyzQ== X-Gm-Message-State: AOAM5305MlOX5jTNuJDaqeVup8/WQvgAen4EbPaoFME8RMkbq68q/5LX XYfOzueYynyNU4Jz9B25lK6BRLwGN2LxCA== X-Google-Smtp-Source: ABdhPJyFJy94Zeik0GYh7GFnbIOy96MXCrOdU3ON6w8WAG71YBnpBE5aXx9Azaar98ZEFbEmsm9XtA== X-Received: by 2002:a62:6003:: with SMTP id u3mr258146pfb.55.1599169264941; Thu, 03 Sep 2020 14:41:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/5] cputlb: Make store_helper less fragile to compiler optimizations Date: Thu, 3 Sep 2020 14:40:57 -0700 Message-Id: <20200903214101.1746878-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200903214101.1746878-1-richard.henderson@linaro.org> References: <20200903214101.1746878-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Shu-Chun Weng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This has no functional change. The current function structure is: inline QEMU_ALWAYSINLINE store_memop() { switch () { ... default: qemu_build_not_reached(); } } inline QEMU_ALWAYSINLINE store_helper() { ... if (span_two_pages_or_io) { ... helper_ret_stb_mmu(); } store_memop(); } helper_ret_stb_mmu() { store_helper(); } Whereas GCC will generate an error at compile-time when an always_inline function is not inlined, Clang does not. Nor does Clang prioritize the inlining of always_inline functions. Both of these are arguably bugs. Both `store_memop` and `store_helper` need to be inlined and allow constant propogations to eliminate the `qemu_build_not_reached` call. However, if the compiler instead chooses to inline helper_ret_stb_mmu into store_helper, then store_helper is now self-recursive and the compiler is no longer able to propagate the constant in the same way. This does not produce at current QEMU head, but was reproducible at v4.2.0 with `clang-10 -O2 -fexperimental-new-pass-manager`. The inline recursion problem can be fixed solely by marking helper_ret_stb_mmu as noinline, so the compiler does not make an incorrect decision about which functions to inline. In addition, extract store_helper_unaligned as a noinline subroutine that can be shared by all of the helpers. This saves about 6k code size in an optimized x86_64 build. Reported-by: Shu-Chun Weng Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 138 ++++++++++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 59 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2d48281942..6489abbf8c 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -2009,6 +2009,80 @@ store_memop(void *haddr, uint64_t val, MemOp op) } } =20 +static void __attribute__((noinline)) +store_helper_unaligned(CPUArchState *env, target_ulong addr, uint64_t val, + uintptr_t retaddr, size_t size, uintptr_t mmu_idx, + bool big_endian) +{ + const size_t tlb_off =3D offsetof(CPUTLBEntry, addr_write); + uintptr_t index, index2; + CPUTLBEntry *entry, *entry2; + target_ulong page2, tlb_addr, tlb_addr2; + TCGMemOpIdx oi; + size_t size2; + int i; + + /* + * Ensure the second page is in the TLB. Note that the first page + * is already guaranteed to be filled, and that the second page + * cannot evict the first. + */ + page2 =3D (addr + size) & TARGET_PAGE_MASK; + size2 =3D (addr + size) & ~TARGET_PAGE_MASK; + index2 =3D tlb_index(env, mmu_idx, page2); + entry2 =3D tlb_entry(env, mmu_idx, page2); + + tlb_addr2 =3D tlb_addr_write(entry2); + if (!tlb_hit_page(tlb_addr2, page2)) { + if (!victim_tlb_hit(env, mmu_idx, index2, tlb_off, page2)) { + tlb_fill(env_cpu(env), page2, size2, MMU_DATA_STORE, + mmu_idx, retaddr); + index2 =3D tlb_index(env, mmu_idx, page2); + entry2 =3D tlb_entry(env, mmu_idx, page2); + } + tlb_addr2 =3D tlb_addr_write(entry2); + } + + index =3D tlb_index(env, mmu_idx, addr); + entry =3D tlb_entry(env, mmu_idx, addr); + tlb_addr =3D tlb_addr_write(entry); + + /* + * Handle watchpoints. Since this may trap, all checks + * must happen before any store. + */ + if (unlikely(tlb_addr & TLB_WATCHPOINT)) { + cpu_check_watchpoint(env_cpu(env), addr, size - size2, + env_tlb(env)->d[mmu_idx].iotlb[index].attrs, + BP_MEM_WRITE, retaddr); + } + if (unlikely(tlb_addr2 & TLB_WATCHPOINT)) { + cpu_check_watchpoint(env_cpu(env), page2, size2, + env_tlb(env)->d[mmu_idx].iotlb[index2].attrs, + BP_MEM_WRITE, retaddr); + } + + /* + * XXX: not efficient, but simple. + * This loop must go in the forward direction to avoid issues + * with self-modifying code in Windows 64-bit. + */ + oi =3D make_memop_idx(MO_UB, mmu_idx); + if (big_endian) { + for (i =3D 0; i < size; ++i) { + /* Big-endian extract. */ + uint8_t val8 =3D val >> (((size - 1) * 8) - (i * 8)); + helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr); + } + } else { + for (i =3D 0; i < size; ++i) { + /* Little-endian extract. */ + uint8_t val8 =3D val >> (i * 8); + helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr); + } + } +} + static inline void QEMU_ALWAYS_INLINE store_helper(CPUArchState *env, target_ulong addr, uint64_t val, TCGMemOpIdx oi, uintptr_t retaddr, MemOp op) @@ -2097,64 +2171,9 @@ store_helper(CPUArchState *env, target_ulong addr, u= int64_t val, if (size > 1 && unlikely((addr & ~TARGET_PAGE_MASK) + size - 1 >=3D TARGET_PAGE_SIZE)) { - int i; - uintptr_t index2; - CPUTLBEntry *entry2; - target_ulong page2, tlb_addr2; - size_t size2; - do_unaligned_access: - /* - * Ensure the second page is in the TLB. Note that the first page - * is already guaranteed to be filled, and that the second page - * cannot evict the first. - */ - page2 =3D (addr + size) & TARGET_PAGE_MASK; - size2 =3D (addr + size) & ~TARGET_PAGE_MASK; - index2 =3D tlb_index(env, mmu_idx, page2); - entry2 =3D tlb_entry(env, mmu_idx, page2); - tlb_addr2 =3D tlb_addr_write(entry2); - if (!tlb_hit_page(tlb_addr2, page2)) { - if (!victim_tlb_hit(env, mmu_idx, index2, tlb_off, page2)) { - tlb_fill(env_cpu(env), page2, size2, MMU_DATA_STORE, - mmu_idx, retaddr); - index2 =3D tlb_index(env, mmu_idx, page2); - entry2 =3D tlb_entry(env, mmu_idx, page2); - } - tlb_addr2 =3D tlb_addr_write(entry2); - } - - /* - * Handle watchpoints. Since this may trap, all checks - * must happen before any store. - */ - if (unlikely(tlb_addr & TLB_WATCHPOINT)) { - cpu_check_watchpoint(env_cpu(env), addr, size - size2, - env_tlb(env)->d[mmu_idx].iotlb[index].att= rs, - BP_MEM_WRITE, retaddr); - } - if (unlikely(tlb_addr2 & TLB_WATCHPOINT)) { - cpu_check_watchpoint(env_cpu(env), page2, size2, - env_tlb(env)->d[mmu_idx].iotlb[index2].at= trs, - BP_MEM_WRITE, retaddr); - } - - /* - * XXX: not efficient, but simple. - * This loop must go in the forward direction to avoid issues - * with self-modifying code in Windows 64-bit. - */ - for (i =3D 0; i < size; ++i) { - uint8_t val8; - if (memop_big_endian(op)) { - /* Big-endian extract. */ - val8 =3D val >> (((size - 1) * 8) - (i * 8)); - } else { - /* Little-endian extract. */ - val8 =3D val >> (i * 8); - } - helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr); - } + store_helper_unaligned(env, addr, val, retaddr, size, + mmu_idx, memop_big_endian(op)); return; } =20 @@ -2162,8 +2181,9 @@ store_helper(CPUArchState *env, target_ulong addr, ui= nt64_t val, store_memop(haddr, val, op); } =20 -void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val, - TCGMemOpIdx oi, uintptr_t retaddr) +void __attribute__((noinline)) +helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val, + TCGMemOpIdx oi, uintptr_t retaddr) { store_helper(env, addr, val, oi, retaddr, MO_UB); } --=20 2.25.1 From nobody Sun May 5 12:50:17 2024 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=1599169345; cv=none; d=zohomail.com; s=zohoarc; b=mTe5gfbSULFdvelpNcIFmuAbOtCDzT1RfHocpaYmmflSAgOdafy+5Dy/qY5CmkfYXMAoL7i6aTceZYw8fnIESgrBcYfOAIl+9KFWgJHWDfeLH3/RNn2o/WEKgbDti7L2rkATpRxOIrG/bWOhT8K95w313j2jlVUpK1v/EwQxBeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599169345; 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=ujJytkO077otcKV33Z+6URYnEerHnMmPUii31K7Opk8=; b=ASFx8wASAO1LhglD8F3RD5VcNsyxVMH3pxXp9ZA8oP3t4T7wWzT2k/bL83rc9ZQmlBYbIrGjFhq3ZuPVUtrRW3kMxkcIJjZj87yY49/Fh+Tn19ycIA2JsC/B+o3AFaDZo9TuAumJ7MQS+vte2hnqWuSzWZJyD5UZiVE5dcD5hEM= 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 1599169345514257.1225631503313; Thu, 3 Sep 2020 14:42:25 -0700 (PDT) Received: from localhost ([::1]:40738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDwzw-0000pZ-Mf for importer@patchew.org; Thu, 03 Sep 2020 17:42:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDwyo-0007S1-DX for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:15 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:36159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDwyi-0004aI-7U for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:14 -0400 Received: by mail-pj1-x1035.google.com with SMTP id q1so2095762pjd.1 for ; Thu, 03 Sep 2020 14:41:07 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v17sm4113290pfn.24.2020.09.03.14.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 14:41:05 -0700 (PDT) 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=ujJytkO077otcKV33Z+6URYnEerHnMmPUii31K7Opk8=; b=nNVsemZumGQHzPZsmDIwWSVy9lKcieRa11sGrPfas3bq5Q8s07H314usupPsyAbNzy IbXlAMI5XpJVxz1Hxzv3dLzOu9gf11NMCLi6pvg8upRUJYsnTYIxGS2G+zB0fRtmKRSJ QlQTdbyBBjfIdv/ayuqFIFhhJkJ9GS/B34uKWO1m9NM6ehCDFkjXT6KNQzW1yx8TJWCM z3avuA1xWtBQthHOpp0h46Z2yug1MQfbLtBmz0mRE3D4+1VDIPxlYMP6YZUhqUaW5DBQ PM7EI/hR1OZmFZJ4u6gr1bp9jZtmgX7Cb1UHO+S7e+gVYiKrwUJjmwIGtg3h1dRpa2F5 zM2g== 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=ujJytkO077otcKV33Z+6URYnEerHnMmPUii31K7Opk8=; b=K4euij79VzXINqrZKbCUtU7t94gY1Z+oGn14YFtaGympsg0+jMGtxBoAwXjsnF3LMB tOGedSb8cFSHTkgcxMAUwX8mLDDgthQ6lNrOsCp9sFbGbnzOwmcGIu1yn/n4n4OOJWGz Fgq/YDTWI70kvtjHku735Tl/9gzii8ZCTibwS9NSk+XY7VEdmhNF1+dMZN4yw0k9qTn2 LXkLBPIBgv23deNkLpcURpBN9525M5b5zSRIZkX2pLS66zJEEHP8s25Fl5Q7MXQCKAed A3wjdPAuw3mOzGdMhgPHhHEv0fYh02kS/XSauteHey80pBTwA341koJJaPRVDCVngp9F 8UYA== X-Gm-Message-State: AOAM533vQSYBj8GkHlThHydZU3GTIrFqTCEmgfrVcsN26/DhY6wo4Jmd +JTdttLrk1lJfTzrYpM4UvddyxWUgRfOCA== X-Google-Smtp-Source: ABdhPJyh/9ucyiqnpcm/plApsTotHR5qxKMI5JvApPoJoBqpbJdmMLXXJ7T+jlVHQzHfvSD+l1ir5A== X-Received: by 2002:a17:90a:5a01:: with SMTP id b1mr4828268pjd.27.1599169266244; Thu, 03 Sep 2020 14:41:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/5] tcg: Fix tcg gen for vectorized absolute value Date: Thu, 3 Sep 2020 14:40:58 -0700 Message-Id: <20200903214101.1746878-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200903214101.1746878-1-richard.henderson@linaro.org> References: <20200903214101.1746878-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, Stephen Long 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: Stephen Long The fallback inline expansion for vectorized absolute value, when the host doesn't support such an insn was flawed. E.g. when a vector of bytes has all elements negative, mask will be 0xffff_ffff_ffff_ffff. Subtracting mask only adds 1 to the low element instead of all elements becase -mask is 1 and not 0x0101_0101_0101_0101. Signed-off-by: Stephen Long Message-Id: <20200813161818.190-1-steplong@quicinc.com> Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 3707c0effb..793d4ba64c 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -2264,12 +2264,13 @@ static void gen_absv_mask(TCGv_i64 d, TCGv_i64 b, u= nsigned vece) tcg_gen_muli_i64(t, t, (1 << nbit) - 1); =20 /* - * Invert (via xor -1) and add one (via sub -1). + * Invert (via xor -1) and add one. * Because of the ordering the msb is cleared, * so we never have carry into the next element. */ tcg_gen_xor_i64(d, b, t); - tcg_gen_sub_i64(d, d, t); + tcg_gen_andi_i64(t, t, dup_const(vece, 1)); + tcg_gen_add_i64(d, d, t); =20 tcg_temp_free_i64(t); } --=20 2.25.1 From nobody Sun May 5 12:50:17 2024 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=1599170252; cv=none; d=zohomail.com; s=zohoarc; b=KQDCDOriJRfZwnWNX5HwTQ88w82z5800AXtj0NmXVDqsTx1kV9td3yB7MrWIzrQPjOoOQgDtEQv8uqhoAakXoBIs3I2XBIriL7W6Zxh+MTYBzt00jnpb3sD00MeafFkOYUF1qaCnhyGyG3G5wrtByO5eTHhVj2ziE7YthIuMsoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599170252; 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=+IpDS3pKsg+orX5M7DofjfKOj/+sV/QvHnOyEKwjMnE=; b=IW2EI8y+Q2EU+IyXFHXoDfFpcNE275H+dElyfHzKsAvMUd2eFOApzomNk9bn76LXAvY47iiSOK9UQvfinS687pGAMEQkVom+JEE7DmvuHcxrv1njSzWruowh4V+zSOWX3ycUOwBn1YT5iJY7x54lDgwJPrJtBZz4WpsSqfCmcMI= 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 1599170252639721.064617181423; Thu, 3 Sep 2020 14:57:32 -0700 (PDT) Received: from localhost ([::1]:44710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDxEZ-000152-Sh for importer@patchew.org; Thu, 03 Sep 2020 17:57:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDwyl-0007RL-PD for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:12 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:35856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDwyj-0004aN-Ij for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:11 -0400 Received: by mail-pg1-x532.google.com with SMTP id p37so3170417pgl.3 for ; Thu, 03 Sep 2020 14:41:09 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v17sm4113290pfn.24.2020.09.03.14.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 14:41:06 -0700 (PDT) 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=+IpDS3pKsg+orX5M7DofjfKOj/+sV/QvHnOyEKwjMnE=; b=UZh++ogd+TpI1ahfhOsvV8lmQ10uIbCS2TlFQAk55jKxEx7gb8+SRVEtfPMkHqFk7L i7IFDGrDbBzCM/sukMj6VDhzC7rsPRRfrgYh/OQSWw11Zi08ingehHkI2tDJpHxqPO66 74KaRXbC/RgMqOVf3poGEXq5DwWijn6yMuyGn/f2KcVC4DGkHmXZ7QHx8UUTatfcnPLj PXognyJCXXE4m9qjKAjw9rsGSf84c40PDkwU9dZa+YiG6q6tRUInMKozqqrMEj3OIS5+ N8oM2vQfdSd6VY9muJHnZ+dlYiCKUuK8ja/3YqtkUEqqEXdfUltcGyQbv/Rlxsp80EBL mcVQ== 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=+IpDS3pKsg+orX5M7DofjfKOj/+sV/QvHnOyEKwjMnE=; b=jbprJrt+u5vSSU59X9wjJJ5zo4LLhZ4pl+JCJ/dxUe9wwgJ6VSzawGC2dMAidWFotZ zxgUB8KU/LB5zXPK90VqF5f+abknWHnT/E0ir0Gqcp0LJlWk/5dJUgszVcjcFOco9F6M sqf95YreAX20TMCdjVaKNynRbuW6lR6xvIK8SIgx8yguCf4KQhet+KDIemo0qb94VZoK umNd0bvi5B3sMRitGGMWmHWtw4ZIl8zCwwuHt95dbq17PMIVAGYqwPgrPzM0uVK/uFCc fwvVEhmUFBi/6ErVLIq+2oRni+nIet2FTXFxvfdtkjmCYRR3yqiY+rdyRozXnLEyAP4E Jgtg== X-Gm-Message-State: AOAM533jGwKv/djWbprafTlRRISwnl+zej50ddz1H+YtknnX9141JalW jEnP3sMZrfGT0j3crDnH9jSs8M2yAmDsUg== X-Google-Smtp-Source: ABdhPJx0zu/UJAqI8jxJ8vR6QB+eotQx2U3XX492DvUytR0UT8lm+8PD9YkkAFyLwL1zs8SkqQ57YQ== X-Received: by 2002:a63:fa45:: with SMTP id g5mr4510243pgk.448.1599169267417; Thu, 03 Sep 2020 14:41:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/5] softmmu/cpus: Only set parallel_cpus for SMP Date: Thu, 3 Sep 2020 14:40:59 -0700 Message-Id: <20200903214101.1746878-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200903214101.1746878-1-richard.henderson@linaro.org> References: <20200903214101.1746878-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::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, =?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) Do not set parallel_cpus if there is only one cpu instantiated. This will allow tcg to use serial code to implement atomics. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- softmmu/cpus.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/softmmu/cpus.c b/softmmu/cpus.c index a802e899ab..e3b98065c9 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -1895,6 +1895,16 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) if (!tcg_region_inited) { tcg_region_inited =3D 1; tcg_region_init(); + /* + * If MTTCG, and we will create multiple cpus, + * then we will have cpus running in parallel. + */ + if (qemu_tcg_mttcg_enabled()) { + MachineState *ms =3D MACHINE(qdev_get_machine()); + if (ms->smp.max_cpus > 1) { + parallel_cpus =3D true; + } + } } =20 if (qemu_tcg_mttcg_enabled() || !single_tcg_cpu_thread) { @@ -1904,7 +1914,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) =20 if (qemu_tcg_mttcg_enabled()) { /* create a thread per vCPU with TCG (MTTCG) */ - parallel_cpus =3D true; snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG", cpu->cpu_index); =20 --=20 2.25.1 From nobody Sun May 5 12:50:17 2024 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=1599170347; cv=none; d=zohomail.com; s=zohoarc; b=bta6y6IUsdECukJIfMA52yub+D02VKIY42pjfg/JnHMOsOVeKC9JTpx0GVYRVSRaeDmqNwFTY8zwH6KKGwyoq7eCFEk7oEmLVfneh4dW/cnVRVW+I0wg1TTMOUyrps7TRf09l09b8ijq9je8rfIoSIv4K0+yIBAqLUr0m2WXSvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599170347; 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=i/w3vLxBt1qJ2wyxNzwes/y8JNN7aVfo7El89r/8IyU=; b=OHJ3lFuEfuKo4qpNxs9wqugiuAKHXB4PKxx1ytVdU/8+zWV4ne7i7Y0jnXTG+BZUuYn+6AydsDtczwiXkmn35bUyA+ubRtu+sDPMIg5NwdSoWXe0Nvjqcpc36Ou7YolP2OsVhDEu+6mRm1z9NXSTJvU/NWLf3sSX2yPLcMVfEDg= 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 1599170347597747.518913038273; Thu, 3 Sep 2020 14:59:07 -0700 (PDT) Received: from localhost ([::1]:51632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDxG6-00041G-Pp for importer@patchew.org; Thu, 03 Sep 2020 17:59:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDwyq-0007SS-0S for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:16 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:37687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDwyk-0004aR-Mi for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:15 -0400 Received: by mail-pg1-x535.google.com with SMTP id 5so3168704pgl.4 for ; Thu, 03 Sep 2020 14:41:10 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v17sm4113290pfn.24.2020.09.03.14.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 14:41:08 -0700 (PDT) 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=i/w3vLxBt1qJ2wyxNzwes/y8JNN7aVfo7El89r/8IyU=; b=UdB+hwvBO6ZXYI+WyJfXs3Phu0UmliMM2CgveUz+rDwCB0XIR9eqUcZUEsGOxnpUvQ uO4YlKCu4hsgKYi9VU5JrMGC27Sn8Pf7z9VFk0qIdtPjt0eV2d5RUg7u/28kNyleiTvC oei1M1aItA9efdHYzTEH+1elqvCFJZ+NPaRo2zHo34O4qdf5CdHL709qZPXPOTIIcWL7 m740O/IYHRt6twaiDdFDSId0DkV6neMGonZ4wopAND3z54gdRGksRVPvwFEf0tnG+d1P 97PHBGnSN2hLDXmq1BlXfFglx7lqzhjDtBkWKNUgOCSJ99Rt/TIMpHRnflENzNIxWer+ 0j+g== 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=i/w3vLxBt1qJ2wyxNzwes/y8JNN7aVfo7El89r/8IyU=; b=ehS81iHw19jP2tTfvFRRTsusvK4BrzDC0vaW7eTIRb/8kSGdoGtOUGp37gqqArg0da jVgiIwY2rByG3JCBHJVlFDLtZI96yb7KU4yCqEmaASo7rcq55hVDkwucpmNygDQw/Ge3 Cn4sfbrxORbVyUE7/40NvE6vw1Cf5d41NdI1t3+QrSn2zxdrv/3z3EOtW3f0zTGdl54W MJC339WTMeGZ3qHT7kOYvxg594BXxdGX+2apl3wwM1YAtYBh81ovPBGU329ro0bNEyQR QGwLAQ8Hmx5esB2dN2MPwH5xAfQvXABBAsDwuFZ9OoTP6MDlyZ3FslM0T4LgCUfAPZnu eY3w== X-Gm-Message-State: AOAM532/GMNkI6qVWbqIq8kdDDJuWcN0ovPanBm10NFn3KLC7pH54o+Q 6d5tHiZFT4MQHUYXy14xgwpIxcdGUgidGw== X-Google-Smtp-Source: ABdhPJzpDs85C8C5dbARtJC9d6cItil7QPyxDZKuknDePotcH9b5TBDsu2tByHOrRPW7zb8/MYJnlw== X-Received: by 2002:a62:1743:: with SMTP id 64mr5648427pfx.133.1599169269075; Thu, 03 Sep 2020 14:41:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/5] tcg: Eliminate one store for in-place 128-bit dup_mem Date: Thu, 3 Sep 2020 14:41:00 -0700 Message-Id: <20200903214101.1746878-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200903214101.1746878-1-richard.henderson@linaro.org> References: <20200903214101.1746878-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::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, =?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) Do not store back to the exact memory from which we just loaded. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 793d4ba64c..fcc25b04e6 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1581,7 +1581,7 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dof= s, uint32_t aofs, TCGv_vec in =3D tcg_temp_new_vec(TCG_TYPE_V128); =20 tcg_gen_ld_vec(in, cpu_env, aofs); - for (i =3D 0; i < oprsz; i +=3D 16) { + for (i =3D (aofs =3D=3D dofs) * 16; i < oprsz; i +=3D 16) { tcg_gen_st_vec(in, cpu_env, dofs + i); } tcg_temp_free_vec(in); @@ -1591,7 +1591,7 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dof= s, uint32_t aofs, =20 tcg_gen_ld_i64(in0, cpu_env, aofs); tcg_gen_ld_i64(in1, cpu_env, aofs + 8); - for (i =3D 0; i < oprsz; i +=3D 16) { + for (i =3D (aofs =3D=3D dofs) * 16; i < oprsz; i +=3D 16) { tcg_gen_st_i64(in0, cpu_env, dofs + i); tcg_gen_st_i64(in1, cpu_env, dofs + i + 8); } --=20 2.25.1 From nobody Sun May 5 12:50:17 2024 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=1599170690; cv=none; d=zohomail.com; s=zohoarc; b=ZJpP9o4PsKHb4QnNDhd+KCnnh1JUoVB9ZhWog4OY1ZDcyB6ylHecUDMcI2knf+naV7+NjeGjSQ1mSzZ2mTvnR8dExWkzABZ0caygfI91CoNnvKHyC3/woEZQ8HpeSA9mKCGHdxw0KfhvA+rm6CKVTyjQVKqziLACX74ItkOzP7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599170690; 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=XhMSwJ2jkxWxuBTzeCmlaoUshyrdzQ2sWDC5rvAjlMw=; b=Hs/cu9xqr1VUgTJL/ZTsl7rTBB7to761dQGUoYgzXii7ZDX85QK6TIznJGcbt9j3NF+JFxwrko7Yzvu1tanSBbsr9sVP38h0oQ031gnXHM8XfKlwCNDKhvP6MqYydnSN+TlAww4g2lgQFFgcEwtB+Mg0e36nS+CZZj9w0mwirhs= 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 1599170690835730.8964942377744; Thu, 3 Sep 2020 15:04:50 -0700 (PDT) Received: from localhost ([::1]:42554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDxLe-0003pT-3O for importer@patchew.org; Thu, 03 Sep 2020 18:04:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDwyr-0007TK-Hs for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:17 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:38145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDwym-0004al-N9 for qemu-devel@nongnu.org; Thu, 03 Sep 2020 17:41:16 -0400 Received: by mail-pg1-x52c.google.com with SMTP id l191so3164590pgd.5 for ; Thu, 03 Sep 2020 14:41:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v17sm4113290pfn.24.2020.09.03.14.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 14:41:10 -0700 (PDT) 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=XhMSwJ2jkxWxuBTzeCmlaoUshyrdzQ2sWDC5rvAjlMw=; b=fbUCyK71YOSWuyozk4rmhaR+mgQzn6PTYzicPW2WJwUIlYN0XCHpvUl3c5flK5GtzU 3u30FNI5Z5AshCtiqjot4nCgd3tTPAkTX5IdpUWysy2annB0xTtNg+MxCc8J2AfWv/Sn va7rd+ocBjm7q+5zyynog+PE0GwqP4YlBHo0PcmlcfPUOXALZoJMrxA33zeJYudab5HY ggFA74cdKdlWz5Se+Lp9WTDwzuJh2XtCanRg3rtvB+Mph+tx2rOlp4psptYRexemkBo0 EtAHIkHqaBZHq9QehCI46fdH60EiDSoWfaHVxKIjrUW+J3n6iqMuh7y3WyV6GopXTMdw 3XHQ== 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=XhMSwJ2jkxWxuBTzeCmlaoUshyrdzQ2sWDC5rvAjlMw=; b=LiMCzOB04keSnzHnC0A4iIdMd7LVmir/bnFI25nbTkP96+MT3M27Yemh5AFdKLLk/k KEj/Xb4lFFDdbYb1AJ5h0E9RtD/HSfTY5mT80h5jqHljnXXUWZTYmoGAzgT1FvSyFK0m +RVplJT/YGo+PnbaE2WDu3i/Uo0/4jXGXe1YqWU9JTiQgYBXCOV+dLSOCUlYWYOGzfI5 9pU6jJ6NfrdaYWuPupORBk+i4Owa/jFvt2NADCH+iQeSxeyLLa0Om8clK5iF3W4EW9Lz +ZXvp9OA3HnOYlGs54HrahciNxflqMCiajQ/12T5o2/bHmkiRoiNktn9WYfCSy8Xhfrg 0goA== X-Gm-Message-State: AOAM5318tQLNxgy9X+dz0I4BW14StmZcIE8uER5bOlcxapvXPrw6DsYg 1WL622NYobDN1cOIHofAfetLQ98QiTIxSw== X-Google-Smtp-Source: ABdhPJyUyOCLK1s2Ur/M1ErMpX8tT3GnMLFycu0N1b7WGAJUMprdpvI+xLd8Zf3/bWtlWE+VZq6dfw== X-Received: by 2002:a62:1d44:: with SMTP id d65mr5725038pfd.150.1599169270638; Thu, 03 Sep 2020 14:41:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 5/5] tcg: Implement 256-bit dup for tcg_gen_gvec_dup_mem Date: Thu, 3 Sep 2020 14:41:01 -0700 Message-Id: <20200903214101.1746878-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200903214101.1746878-1-richard.henderson@linaro.org> References: <20200903214101.1746878-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::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, =?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) We already support duplication of 128-bit blocks. This extends that support to 256-bit blocks. This will be needed by SVE2. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/tcg-op-gvec.c | 52 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index fcc25b04e6..7ebd9e8298 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -1570,12 +1570,10 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t d= ofs, uint32_t aofs, do_dup(vece, dofs, oprsz, maxsz, NULL, in, 0); tcg_temp_free_i64(in); } - } else { + } else if (vece =3D=3D 4) { /* 128-bit duplicate. */ - /* ??? Dup to 256-bit vector. */ int i; =20 - tcg_debug_assert(vece =3D=3D 4); tcg_debug_assert(oprsz >=3D 16); if (TCG_TARGET_HAS_v128) { TCGv_vec in =3D tcg_temp_new_vec(TCG_TYPE_V128); @@ -1601,6 +1599,54 @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t do= fs, uint32_t aofs, if (oprsz < maxsz) { expand_clr(dofs + oprsz, maxsz - oprsz); } + } else if (vece =3D=3D 5) { + /* 256-bit duplicate. */ + int i; + + tcg_debug_assert(oprsz >=3D 32); + tcg_debug_assert(oprsz % 32 =3D=3D 0); + if (TCG_TARGET_HAS_v256) { + TCGv_vec in =3D tcg_temp_new_vec(TCG_TYPE_V256); + + tcg_gen_ld_vec(in, cpu_env, aofs); + for (i =3D (aofs =3D=3D dofs) * 32; i < oprsz; i +=3D 32) { + tcg_gen_st_vec(in, cpu_env, dofs + i); + } + tcg_temp_free_vec(in); + } else if (TCG_TARGET_HAS_v128) { + TCGv_vec in0 =3D tcg_temp_new_vec(TCG_TYPE_V128); + TCGv_vec in1 =3D tcg_temp_new_vec(TCG_TYPE_V128); + + tcg_gen_ld_vec(in0, cpu_env, aofs); + tcg_gen_ld_vec(in1, cpu_env, aofs + 16); + for (i =3D (aofs =3D=3D dofs) * 32; i < oprsz; i +=3D 32) { + tcg_gen_st_vec(in0, cpu_env, dofs + i); + tcg_gen_st_vec(in1, cpu_env, dofs + i + 16); + } + tcg_temp_free_vec(in0); + tcg_temp_free_vec(in1); + } else { + TCGv_i64 in[4]; + int j; + + for (j =3D 0; j < 4; ++j) { + in[j] =3D tcg_temp_new_i64(); + tcg_gen_ld_i64(in[j], cpu_env, aofs + j * 8); + } + for (i =3D (aofs =3D=3D dofs) * 32; i < oprsz; i +=3D 32) { + for (j =3D 0; j < 4; ++j) { + tcg_gen_st_i64(in[j], cpu_env, dofs + i + j * 8); + } + } + for (j =3D 0; j < 4; ++j) { + tcg_temp_free_i64(in[j]); + } + } + if (oprsz < maxsz) { + expand_clr(dofs + oprsz, maxsz - oprsz); + } + } else { + g_assert_not_reached(); } } =20 --=20 2.25.1