From patchwork Sat Jun 3 02:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 688777 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1164806wru; Fri, 2 Jun 2023 19:38:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6v6oivMFXPOx1LrZcdSiiSiEjrOu2fcASxNILGFy1ICoMYwrziAeY71vxvOz5COKOTIP6b X-Received: by 2002:ac8:5c0d:0:b0:3f8:20a:1c6a with SMTP id i13-20020ac85c0d000000b003f8020a1c6amr447583qti.40.1685759882767; Fri, 02 Jun 2023 19:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685759882; cv=none; d=google.com; s=arc-20160816; b=kwVo7j4tvnohnuOpeVZbtnfF/zvvO43ILTc2ylfa0q+s36Ovx0wkTW6l0+5DUuGpzs 4p+l9wTCxqq9SJemaaGTMUybHL1PHnsAjzXWR8mra2DdrSt94N9962Jgq6djqvttQ4E4 A2F6ELXEIGpQUYQCez/K0HtY8dQaI+Z7Sea1Me+vsU4IxgJHPO4zpaKsjtDNCf4+6oPQ tFfx6dwvP5KanyeUmRoHydR4h+hrwE5h+9MUhAWNBIvLnSVioDlBKjx6Y5YkLQoRalU4 3umG9m3yXeCNgm1UG6FauaA4ECYRldy29o28/vFsABBnrxX0uozHG0lZrK7ZrQMDoRlV z46g== 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=xQJo2C3OKYrLdgG+Avv/itkRaFPUqHtuD2xcYh5Lh3Y=; b=SQyM4p+0qFrk82ol6QrdAgKfdD5xyc2JVDL460bahntCuWbOYyVWHvKV5oD24vrLGS nkQWL8NhlSMoFo5srzwWIvjb/CfCCVjvtJoslsBplwnnNMZttxgT2M3xzJEBsyTEISz6 axnmSWmOGw1k27pEH8pOAKFmJhEV4duG7wMfEDGUKLstjucSUuR8usWJENr6pzL7LXAh VhK5T7rwThHHjquO+KBCGhgz88vfWyCrnSLvRDb9MrvdkTyGQzmAbpx1FZ12dXe5lnjR 9YUX6yyYo5MlXadHXerojSJfixj1A5HwLE504CAQ/TJQmizGFzEc75s72gMAxih7ZHHb NxLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OdXJUkKl; 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 o19-20020a05622a139300b003f6b0742cb0si1868180qtk.441.2023.06.02.19.38.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Jun 2023 19:38:02 -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=OdXJUkKl; 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 1q5H7h-0002xV-Iu; Fri, 02 Jun 2023 22:36:09 -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 1q5H6b-0000aM-Ji for qemu-devel@nongnu.org; Fri, 02 Jun 2023 22:35:02 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q5H6P-0004rf-Bm for qemu-devel@nongnu.org; Fri, 02 Jun 2023 22:35:01 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6af74ca9f4aso2703161a34.3 for ; Fri, 02 Jun 2023 19:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685759687; x=1688351687; 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=xQJo2C3OKYrLdgG+Avv/itkRaFPUqHtuD2xcYh5Lh3Y=; b=OdXJUkKlmbPfOIMb4syHFC9vqCA+CKjZqxnq3kv6h4Z5znXuxTl126Ci6RAxADj7Ew vkAKmgkAx1asIQSc+sWpnSJyrguLuzoq2M2P8MjPCjz9mzUCQuE1MUs7ULJbf6eRNyBv lmfBmvYwzRUA2pcuWHXY0k0H28CqCA/HZJlt3r9C+ncfxRVgnmgu6igPSiaO+lbfnVJU QuN4Dlls9KZWNvu01cbpxJa+IG8xPXYQjTsJIMkn93y43HCNqLp0WjKAl1Y0tT0hOWvt vF74OPKA+qKn3L/9M8cp7BU+6H69Db6DO73cKKyLeA2yKjqtfLIV4Kwn9mPWht73ysu4 ciog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685759687; x=1688351687; 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=xQJo2C3OKYrLdgG+Avv/itkRaFPUqHtuD2xcYh5Lh3Y=; b=c1kIw73+SXKYDcL/2ekUkWYXRVlP/gcx20VQk3aC8P+g1ZVBUCRTPookHwhHKGP43M ckBcdAcHqNUJgC94BTJuYmKg14w+/EAl1N3k3FpsRrDwkq+GPqMnC7j1Zrr0i48e48XZ WTbj/U85VGqC6l7igur80QM6zHKpDU3/e2Xyuc7+XyAG4s/vrDTpczx4YtzvHBQE7NdH ZKxU9G/Dl3e/+1jL6IVgLRjWAnREwQVaEaHZdwZDSg+PuPj+0tZ0C+xS/gUW3j/UsLuT mJRkCESW9amOXY8Mn0pDbIHw1hSzWxo8WfpCVSaT86SXpugliepcAPUZwxtC7VjDG+tU uuiA== X-Gm-Message-State: AC+VfDzYW69FPt9RF71+9TQyW4WnbxIzfhyMitnmIV1NJxOhDCjimE58 GKKDgLL8dJ4vOoL3RUIHbG3IRK4Yp/4aCTheuy0= X-Received: by 2002:a05:6358:4315:b0:123:3ea3:2bd2 with SMTP id r21-20020a056358431500b001233ea32bd2mr11882291rwc.32.1685759687666; Fri, 02 Jun 2023 19:34:47 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:66a6:82c2:d794:68f6]) by smtp.gmail.com with ESMTPSA id e91-20020a17090a6fe400b002508d73f4e8sm3914289pjk.57.2023.06.02.19.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 19:34:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: ardb@kernel.org, berrange@redhat.com, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com Subject: [PATCH 22/35] target/i386: Use aesenc_SB_SR_MC_AK Date: Fri, 2 Jun 2023 19:34:13 -0700 Message-Id: <20230603023426.1064431-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230603023426.1064431-1-richard.henderson@linaro.org> References: <20230603023426.1064431-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.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=unavailable 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. 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 0187651140..c7a2c586f4 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2190,16 +2190,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); } }