From patchwork Wed Oct 18 22:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735146 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1236975wro; Wed, 18 Oct 2023 15:28:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyCffw1FF4rtT/BjHR1FLxEJjdxwKc/26W11o/Y7MuCti26uarivbmcubaMVOlcGS4DFg/ X-Received: by 2002:a05:6214:501a:b0:656:3b4c:b98b with SMTP id jo26-20020a056214501a00b006563b4cb98bmr645858qvb.11.1697668110499; Wed, 18 Oct 2023 15:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697668110; cv=none; d=google.com; s=arc-20160816; b=oqoHc18/FyXEvS7GxvzvLDGDT0q1iyUzGZvzC2Va+ZkqOmtOrLKX02lZr/2f/lbbjJ ARiU7l1QUCau7YQipPHSIi0qqqGxgdAri+UdeMK6LoAgNVqAvFRidpp00xahugXUaSlC Xblf04xql1oWPyyufE8MJL+1iPC0Q66HE5He4sVwQhFuMJ6zVDJbzgtIqlFIM9p0EyJI LYAvfpj8fmBgGo/IK7zI1uz+BCndW4RK9HCaVy71gsOFfbUxE1yRcB3rfDLVFOb8De76 keMKQC0zQr1M7NnvRqzes9Tam64EHxe8/VG5a0f3uBqDIOsdkl3t5ko+HaO3tome1aDp AePQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VWfRq90wjGAr0oweacpv5OPKCpxjoxKXHInDtElvTJQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=fZaQ2Kw707K2jZvcnGA0yWXz0pALyPIYF8wQIGlTSuY/xXOTwgj8XIad3MHmXT82Ol go35DmUSBVZrvtGugzDYoy6vtWinlbw5oHYUR3g/fppsq2uRuJLPoHWl83CPglIXqd6k cCVk5v14kwo+EcgBhC99cCD7tiPkWIZ3wBT7is/grAVWqnS+wWEz0mZ1XjH/knOPFgru oNJYA+Z47ElBqJwLtdBGg1kVshcHNUWUnjF1Dp0Pk8JyqEh1wnhjqLl1115/JRtYGRkN GdFAHZPO1U89iFTuK5lO0Sw5btDp6kFMF0E8py9lUQPxIpp5NFkeZCxW0vYeT53nLEOJ cN+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tem9Qmno; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g2-20020a0562140ac200b0065af2065d63si771084qvi.224.2023.10.18.15.28.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:28:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tem9Qmno; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtEzn-0008Em-MI; Wed, 18 Oct 2023 18:26:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtEzk-0008DO-2w for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:28 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtEzi-0002XE-82 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 18:26:27 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cab2c24ecdso2579805ad.0 for ; Wed, 18 Oct 2023 15:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697667984; x=1698272784; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VWfRq90wjGAr0oweacpv5OPKCpxjoxKXHInDtElvTJQ=; b=Tem9QmnoidsKj8YSLhQTsZr4LvyoGN+FE3T6vlSIJwTk3yhVB3PzUOT0mF/I1pXPmW Jw/1kIHChfR78WXZ40HEyUkMGWsb7W0Bw1W2+iCF4p4PK/vox83HVYxXThtUFRPVedpf z0ZfAsnjMOzJH/I5pBjqGwvRQ7TkLZ/V5xE2l9w3uEEBvwgCdoBGyVpTZr/VHv7zFiwt FvTwBeBkbodhyAhsDTCLrZPIXvPqnTBG78s9VTK2hyOpIPhudXGPczwvuko6QYMHihB6 JI3x5ysDWZq4oCFEkBuvi0aU8wunpQDnxTAdl6m6FX5qlecEyGkcsa02OoGkMf23lRTI 24sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697667984; x=1698272784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VWfRq90wjGAr0oweacpv5OPKCpxjoxKXHInDtElvTJQ=; b=nQBbbS8hx6XBdF7IHFv7k9gPz1wVLenaeG4Gya0ALQ4dq0VgxNifT6mlcPuuhq6NSs sC6mYo1w91SjhRwu2YtGMS/nwsyA6XAUig7u93Gld2LExiTHfYVgSFT6qA3hfEqighyv 0FfGFF+sdpxRdeKNuFVRTJnyIvrTtseZnZVUFDe6tpbt36uz9n0nRdCwOYWiFEKHrVCu 3QM/29Nse47AbTE86RZKLv9EcbQy2ySQrw3nJZYElyX7fFEU6K0bdahd+xaKT8n+mzi4 GTqMCSNdCXsDtKw5L7pxGwcYzOluSg9ZdvW9TVLblotiH1znj48O20ZH2DrmVPKjKd1f Sltg== X-Gm-Message-State: AOJu0YwNJBWq9xKQxJranPGtfoBq/609KOKPYt1RmDqN2XsW8xX6cuOI MOgFnMciPj1CCixTOQp+Llr0dCyxFHMvXzL6GEg= X-Received: by 2002:a17:903:258a:b0:1ca:8a38:38c4 with SMTP id jb10-20020a170903258a00b001ca8a3838c4mr597135plb.27.1697667984279; Wed, 18 Oct 2023 15:26:24 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c24d00b001b9d95945afsm431058plg.155.2023.10.18.15.26.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 15:26:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 29/29] target/i386: Use i128 for 128 and 256-bit loads and stores Date: Wed, 18 Oct 2023 15:25:57 -0700 Message-Id: <20231018222557.1562065-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018222557.1562065-1-richard.henderson@linaro.org> References: <20231018222557.1562065-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 63 +++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index d2061ec44a..0c81e066de 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2918,59 +2918,54 @@ static inline void gen_stq_env_A0(DisasContext *s, int offset) static inline void gen_ldo_env_A0(DisasContext *s, int offset, bool align) { + MemOp atom = (s->cpuid_ext_features & CPUID_EXT_AVX + ? MO_ATOM_IFALIGN : MO_ATOM_IFALIGN_PAIR); + MemOp mop = MO_128 | MO_LE | atom | (align ? MO_ALIGN_16 : 0); int mem_index = s->mem_index; - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_16 : 0)); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(0))); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(1))); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_qemu_ld_i128(t, s->A0, mem_index, mop); + tcg_gen_st_i128(t, tcg_env, offset); } static inline void gen_sto_env_A0(DisasContext *s, int offset, bool align) { + MemOp atom = (s->cpuid_ext_features & CPUID_EXT_AVX + ? MO_ATOM_IFALIGN : MO_ATOM_IFALIGN_PAIR); + MemOp mop = MO_128 | MO_LE | atom | (align ? MO_ALIGN_16 : 0); int mem_index = s->mem_index; - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(0))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_16 : 0)); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(XMMReg, XMM_Q(1))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_ld_i128(t, tcg_env, offset); + tcg_gen_qemu_st_i128(t, s->A0, mem_index, mop); } static void gen_ldy_env_A0(DisasContext *s, int offset, bool align) { + MemOp mop = MO_128 | MO_LE | MO_ATOM_IFALIGN_PAIR; int mem_index = s->mem_index; - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_32 : 0)); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(0))); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(1))); + TCGv_i128 t0 = tcg_temp_new_i128(); + TCGv_i128 t1 = tcg_temp_new_i128(); + tcg_gen_qemu_ld_i128(t0, s->A0, mem_index, mop | (align ? MO_ALIGN_32 : 0)); tcg_gen_addi_tl(s->tmp0, s->A0, 16); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(2))); - tcg_gen_addi_tl(s->tmp0, s->A0, 24); - tcg_gen_qemu_ld_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_st_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(3))); + tcg_gen_qemu_ld_i128(t1, s->tmp0, mem_index, mop); + + tcg_gen_st_i128(t0, tcg_env, offset + offsetof(YMMReg, YMM_X(0))); + tcg_gen_st_i128(t1, tcg_env, offset + offsetof(YMMReg, YMM_X(1))); } static void gen_sty_env_A0(DisasContext *s, int offset, bool align) { + MemOp mop = MO_128 | MO_LE | MO_ATOM_IFALIGN_PAIR; int mem_index = s->mem_index; - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(0))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->A0, mem_index, - MO_LEUQ | (align ? MO_ALIGN_32 : 0)); - tcg_gen_addi_tl(s->tmp0, s->A0, 8); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(1))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + TCGv_i128 t = tcg_temp_new_i128(); + + tcg_gen_ld_i128(t, tcg_env, offset + offsetof(YMMReg, YMM_X(0))); + tcg_gen_qemu_st_i128(t, s->A0, mem_index, mop | (align ? MO_ALIGN_32 : 0)); tcg_gen_addi_tl(s->tmp0, s->A0, 16); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(2))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); - tcg_gen_addi_tl(s->tmp0, s->A0, 24); - tcg_gen_ld_i64(s->tmp1_i64, tcg_env, offset + offsetof(YMMReg, YMM_Q(3))); - tcg_gen_qemu_st_i64(s->tmp1_i64, s->tmp0, mem_index, MO_LEUQ); + tcg_gen_ld_i128(t, tcg_env, offset + offsetof(YMMReg, YMM_X(1))); + tcg_gen_qemu_st_i128(t, s->tmp0, mem_index, mop); } #include "decode-new.h"