From patchwork Sun Jul 9 13:59:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 700843 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp4742502wrs; Sun, 9 Jul 2023 07:05:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHd01crmTQHyIVQcDrDgrBu/rzEUojDLHf8qvoRexk/KnhxM5z1ZVUc/EIW6sZNJKlAF5sk X-Received: by 2002:a05:622a:386:b0:400:9390:d129 with SMTP id j6-20020a05622a038600b004009390d129mr11193296qtx.36.1688911513608; Sun, 09 Jul 2023 07:05:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688911513; cv=none; d=google.com; s=arc-20160816; b=uZ46CCcA+czYqs6fruLU3aFLjkpU2l/qh1POAl5As4HfRfhewIbMUoo7584eUuHFC1 5kZwTaCKJywFttemqeFWHq+kj/On4c+OcKu9qmvxPrPKHzWwFyP9+so3SSgcEF7xCb0p cwGRsgH0jKVpN2F3SPRXX5B6fvlOiDSIIToindSbCYqrjh4XTLmI4TAOnBcgrLvBUYdR hB0AO7FhfhFew6gR9lUrXzf2A3fZd7WyBvTxIANoRXTHwAf5Due7gcPzoqpKaofFcbWU tPP8+WGxhqwuAAHApncCYl5ud2Je2HzJs2tP1noqJ54sMbYeKTLSEiesiFodNgUVnv52 c0sA== 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=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=gI/Tb79U6Jhqw2LNP96tCeUSM+7+b1rXewktb1DjDdMEUsueMV/sJ3kBZdFrmEzcla VRS2m25N+njIxpNavFw8omQEA7lFvySnvXPoDca1Hhy8sgi554jR4RGhe8rFTaj6RErI XBgBbcKoTQQhYIdVKjasy0LFQm0rRg0x2GJbMXks7YxQrTNLeqUrL4GQRc1x9z/qBN8V uPF/3GMFhEulEGILOsRiP0RRtYBoL17qS7BLWjlVSRt9VkdG0l4SrZEt4KwipHjfgN2I JfL2bwZFrQ45dsG5tYYKSIMj3anf9DkA9VJ6lsolcDw2+D/i1CGObCNRixhHU+rXyVSk d4jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ChNG7oeB; 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 d24-20020a05620a137800b0075f02d4d588si4835088qkl.117.2023.07.09.07.05.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2023 07:05:13 -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=ChNG7oeB; 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 1qIUxe-0000Un-2l; Sun, 09 Jul 2023 10:00:26 -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 1qIUxP-0000Ow-9J for qemu-devel@nongnu.org; Sun, 09 Jul 2023 10:00:14 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIUxM-0000cN-3N for qemu-devel@nongnu.org; Sun, 09 Jul 2023 10:00:10 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3142ee41fd2so3551866f8f.3 for ; Sun, 09 Jul 2023 07:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688911207; x=1691503207; 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=ChNG7oeBvyoQpH6hcvOBCDY51pQZ7OC+1X1y41WQuo93cWHgTsIHuLW4ulySsd9dVP Ha/b8BaySVFZbLR5QvYL12sGGMw+9rYUhrX2Co0Ya27Jt52EunVuhH/yCNdlpi83OIVZ Jr9YyjD+i7t7mCaQ1vpOfQvQhiRpr8gT68SXak0XJR7ajQQejcLGDwEQAH31eVV82iXY zIvLI0kC7Ou3gBg++U6fPlAKZ5qJRc/fSCSPAvo9ETFwO+3ZIQ6jDYSEF1nzCmepWgmT rYnLg+04TZV8o7s0fAHPWUuwUSjDB/7P+CFgl5M4d4Lc5fdeNO7UzWOmFjV9fVZlALGv UN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688911207; x=1691503207; 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=ERafas68AkDAbYFuZLFTU250Rn9vRPLCBhqqGoItrcAMxL+Gh1KhppvxPCD6SArWB1 aTHiUfndy61v5p2GsIE1eUtXhHBAWhOaPgAe30/B47yz4f6EJfzmPh9m3AmVj3jBfQj/ d3+ETCo+k7wr7/AgzBzm7G5BSfIY8oV6v0NmfQ2kfebuI/AhZtraN4FgmW85mEWycjnL gq1BQhA//5O3xQzJNZPbWJrb3qbULxY9zZFLdOVw59ox1a6n4u23DpPa+y+t21gv6XtT yCwWe5JHudEds+/0kzJSqmdXX6ApH/Yssz9CIENkWFsV30zA6AtBAw69tNf1BWdClGm/ M16Q== X-Gm-Message-State: ABy/qLZxcrgCz+4ijdrEJ8JABO7Da3TyzsjrnBNI6Rl6PCzrkzihzXfE FXrymK2GY0/U0gw4Cj5a5haclm77MDPrejwPUFSDFw== X-Received: by 2002:a5d:58cf:0:b0:314:77a:c2b2 with SMTP id o15-20020a5d58cf000000b00314077ac2b2mr7774527wrf.32.1688911206772; Sun, 09 Jul 2023 07:00:06 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id v18-20020a5d6792000000b003063a92bbf5sm9239422wru.70.2023.07.09.07.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 07:00:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?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 14:59:30 +0100 Message-Id: <20230709135945.250311-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709135945.250311-1-richard.henderson@linaro.org> References: <20230709135945.250311-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.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); } }