From patchwork Sun Jul 9 18:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 700910 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp4830044wrs; Sun, 9 Jul 2023 11:42:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHCqvtbSyaSJj3ntHZy1k2Jh5CHvIicvRTZ5MSopYDcmebVM8valqEUlXowpy4iLeCO8LjX X-Received: by 2002:a05:6214:d6a:b0:636:695:c84c with SMTP id 10-20020a0562140d6a00b006360695c84cmr18500296qvs.20.1688928156139; Sun, 09 Jul 2023 11:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688928156; cv=none; d=google.com; s=arc-20160816; b=mPYASmxVifn5v1omFuS75S/PHavGsfP3aUEBlkzs7CPOkSkeuL+CUmipyY4hYSfu1U oaUi2HHYl8aRu9X+R4CR4Hes2LfgiXHlBvnSe2+NZsg8E5VTitkc0Ff+L2EEEuS5CFdI sOikuF5nbxldkdKgaSs07G9G+lJulsCw03MSKVmXosZjaCHmfkJRfFNHu2xwq6GNpATu PNzbFEbqMbDPM/TmjHYZN5qlRQmmjBzPNX8F5pXg+11p913JhSrYbxL0Lb3v2t86daMb x/ReY/+qubuiWEW1TGuFs4+E6QYej9fPe6tF8V4D+Pww8p9F2ZlIFjqYYi+uAwV2DN7O xFVg== 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:cc:to :from:dkim-signature; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; fh=3IEiF/YPZ00TE94rna3Orj/L+TRFhpuNf7ElRJz3ubE=; b=S3Xb8jHPzx+1ZpPdebyR1QRrspuHlTnwTlM2zPkawvSl6P1TWd06dU9tuhzhA6D6yD 9vV91NEk7d3r4wwyfIoJEOoha6dywEUysTyeMOts3KH54908a0u+ya5sAgUlFuUzZljB uYhu5TlzLBhdHuzeosvehsN5u7IikC4TPbcvu+3E0L+S6SVyvuF6eJoZuSvE1ZbyuL9O LNM0W0b+GJdDxMyjUtjmnl4K1ofhePBJUjuk9ckFn8lPMYVPEPOPDIcJzrcA6rF+4be9 uy9M9OG03cH6qb/KvsujGbbfwIeoK/eOzXWalmnh3a4GSVA5j8GaTwrAVjuoT3lLgAZ6 4gUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ryBrjVtC; 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 r10-20020a0ccc0a000000b00626322e9aa9si4798399qvk.50.2023.07.09.11.42.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2023 11:42:36 -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=ryBrjVtC; 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 1qIZDs-0003RP-8N; Sun, 09 Jul 2023 14:33:33 -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 1qIZDl-00033c-1Z for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:21 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDg-0004A1-KT for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:18 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc656873eso49182145e9.1 for ; Sun, 09 Jul 2023 11:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927595; x=1691519595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; b=ryBrjVtCzcG5Bxe66Yg3RhXI1AJDqQ5I53JXZsqA92sGwkS2tzrfYPSy+9pyDpmb7o bLkxrUNXeDaX3Z6qgH4465ZwQYpaF6Zb9V6XDptnt7B4DCyaESvC4XHHHGnQBlsp7xmw LY/2tijGhCc1AtVkuxzsR7th7mOJtGKM86nB1YIZCkzuJm/q3xLt/U233bgmuw77p2O/ gwTzbHh0xxnRLMdJSWO46e59TV7Y6HpL7qNHF2NkdlNxotwBGFvLqjXnmBsUrOaXKg/j fd1VrPacoZLFm7MxUYSi5F6e8IeHE+J3qrNFlYzTdFWEwQu/XycC5f5SzX1AVPHf/2LK M/WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927595; x=1691519595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; b=PbqqYJQy8wEMgmSEfHxZbqN62F4Bi04D6bRWAwChrZq12roECCTB+TxMt88pQGnX1K 7W1q9Dg3RfrtSBzRsHFCPkHcKpv9PKHlc6nQLkfi1XlSEf67yf8GUIbieeaRP6cl5dQx CUp3suMPC5teYfpTF9p3GtV6Adtd2du1bTAd1aTxMhlD2caAFfSvIYhFTd6Rw0pp7Bm9 Z0zK6GiKWWvVeGwCPZeqv6jdb+BqsNVzFLz209KLItEFp0Tm3h45Bz1gJi6jkbUMqoLi IoHHuz0Xhzx62RvU6uKOYG1xw9FzEVf8yaMmw2A30eMbx9uAF9h913JKqY6p2/Q1LytN pdMA== X-Gm-Message-State: ABy/qLZhsRZC2wLX31wtaleYsabMV1FFuFos87zoJJvRBlbchewUwhsp 0fJQnHFVBifn2QuqtkrBb3CMxwqpSuwndSRoagOfEQ== X-Received: by 2002:a5d:6a08:0:b0:315:8a80:329e with SMTP id m8-20020a5d6a08000000b003158a80329emr8433162wru.40.1688927595095; Sun, 09 Jul 2023 11:33:15 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 22/37] target/i386: Use aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:28:56 +0100 Message-Id: <20230709182934.309468-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 This implements the AESENC instruction. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 893913ebf8..93a4e0cf16 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2188,16 +2188,12 @@ void glue(helper_aesdeclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s) void glue(helper_aesenc, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s) { - int i; - Reg st = *v; - Reg rk = *s; + for (int i = 0; i < SHIFT; i++) { + AESState *ad = (AESState *)&d->ZMM_X(i); + AESState *st = (AESState *)&v->ZMM_X(i); + AESState *rk = (AESState *)&s->ZMM_X(i); - for (i = 0 ; i < 2 << SHIFT ; i++) { - int j = i & 3; - d->L(i) = rk.L(i) ^ bswap32(AES_Te0[st.B(AES_shifts[4 * j + 0])] ^ - AES_Te1[st.B(AES_shifts[4 * j + 1])] ^ - AES_Te2[st.B(AES_shifts[4 * j + 2])] ^ - AES_Te3[st.B(AES_shifts[4 * j + 3])]); + aesenc_SB_SR_MC_AK(ad, st, rk, false); } }