From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D213C2D0DB for ; Fri, 31 Jan 2020 21:16:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07D5B20705 for ; Fri, 31 Jan 2020 21:16:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07D5B20705 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=twiddle.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixdeQ-0006d5-W7 for qemu-devel@archiver.kernel.org; Fri, 31 Jan 2020 16:16:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33899) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixddc-0006Cz-L5 for qemu-devel@nongnu.org; Fri, 31 Jan 2020 16:15:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixdda-0006u6-Bk for qemu-devel@nongnu.org; Fri, 31 Jan 2020 16:15:40 -0500 Received: from indium.canonical.com ([91.189.90.7]:40136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixdda-0006sO-4j for qemu-devel@nongnu.org; Fri, 31 Jan 2020 16:15:38 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.86_2 #2 (Debian)) id 1ixddY-0007jg-Ve for ; Fri, 31 Jan 2020 21:15:36 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id D4A5D2E80C8 for ; Fri, 31 Jan 2020 21:15:36 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Fri, 31 Jan 2020 21:02:07 -0000 From: Richard Henderson To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=New; importance=Undecided; assignee=None; X-Launchpad-Bug-Tags: tcg testcase X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: amarkovic rth stvlvrn X-Launchpad-Bug-Reporter: Stevie Lavern (stvlvrn) X-Launchpad-Bug-Modifier: Richard Henderson (rth) References: <158038956597.5319.13308249814127344774.malonedeb@chaenomeles.canonical.com> Message-Id: <158050452751.8211.8131089451171466061.malone@chaenomeles.canonical.com> Subject: [Bug 1861404] Re: AVX instruction VMOVDQU implementation error for YMM registers X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="0a62c17273454a1313f81a74a2198ec30b44c7b6"; Instance="production-secrets-lazr.conf" X-Launchpad-Hash: 83cfe7140971f527652d2254e522e429877de159 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 91.189.90.7 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1861404 <1861404@bugs.launchpad.net> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Because the sse code is sloppy, and it was interpreted as the sse instruction movdqu. AVX support was coded for GSoC last year, https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg05369.html but it has not been completely reviewed and committed. There is no support for AVX in master. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1861404 Title: AVX instruction VMOVDQU implementation error for YMM registers Status in QEMU: New Bug description: Hi, Tested with Qemu 4.2.0, and with git version bddff6f6787c916b0e9d63ef9e4d442114257739. The x86 AVX instruction VMOVDQU doesn't work properly with YMM registers = (32 bytes). It works with XMM registers (16 bytes) though. See the attached test case `ymm.c`: when copying from memory-to-ymm0 and then back from ymm0-to-memory using VMOVDQU, Qemu only copies the first 16 of the total 32 bytes. ``` user@ubuntu ~/Qemu % gcc -o ymm ymm.c -Wall -Wextra -Werror user@ubuntu ~/Qemu % ./ymm 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 1= 8 19 1A 1B 1C 1D 1E 1F user@ubuntu ~/Qemu % ./x86_64-linux-user/qemu-x86_64 -cpu max ymm 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 00 00 00 00 00 00 00 0= 0 00 00 00 00 00 00 00 ``` This seems to be because in `translate.c > gen_sse()`, the case handling the VMOVDQU instruction calls `gen_ldo_env_A0` which always performs a 16 bytes copy using two 8 bytes load and store operations (with `tcg_gen_qemu_ld_i64` and `tcg_gen_st_i64`). Instead, the `gen_ldo_env_A0` function should generate a copy with a size corresponding to the used register. = ``` static void gen_sse(CPUX86State *env, DisasContext *s, int b, target_ulong pc_start, int rex_r) { [...] case 0x26f: /* movdqu xmm, ea */ if (mod !=3D 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { = [...] ``` ``` static inline void gen_ldo_env_A0(DisasContext *s, int offset) { int mem_index =3D s->mem_index; tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, mem_index, MO_LEQ); tcg_gen_st_i64(s->tmp1_i64, cpu_env, offset + offsetof(ZMMReg, ZMM_Q(= 0))); tcg_gen_addi_tl(s->tmp0, s->A0, 8); tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEQ); tcg_gen_st_i64(s->tmp1_i64, cpu_env, offset + offsetof(ZMMReg, ZMM_Q(= 1))); } ``` To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1861404/+subscriptions