From patchwork Fri Jun 9 02:23:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 690859 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp598003wru; Thu, 8 Jun 2023 19:26:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SvJW7J7DVJGA4bd5buDE/RgPpWPhEX8v/PUJzcdtTDfOL+BpdZ7oLWtvs41j2WDCQpgdA X-Received: by 2002:ad4:5de1:0:b0:5ef:8159:b9a9 with SMTP id jn1-20020ad45de1000000b005ef8159b9a9mr356709qvb.21.1686277595444; Thu, 08 Jun 2023 19:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686277595; cv=none; d=google.com; s=arc-20160816; b=zvv2uTNIdnjCBUFQeKgZ/oxaJY4kov1Mf61RB7w0oTYpBNbYfJVm5so03p3AqoFhHk JkUhkVOtQEvat30PiqF6A8YzPUpyCvISvaXcwj6BRWamhOJ+9oVyQwAVoUWHrLgKnET+ kaUaQkKCFd5RDamOsIfJ4gtDfO9mojcVbbhIbuMUfimtx4Xui7ebJ2G2oE5LVGVDSodo nIHi9UVKwJ4wkK3HtAjJkHLb9t3yYHKaTLmwbJoINIkmqcgIxm22etsZ4BHP48MtWzUO mveM9ME/MkPVIhQ3OnUXsUzOV/sifCJU1Ud+2M0DVCXBsaAKQGPZL8v8gyYnNQWxHAIQ x4Ag== 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=+os3nHQ/ZmARewYX8s5fRYkcgS0NtfZNFjYHPGkpaM4=; b=pTG1boWirWsazmRRaMgjCLIBVsaqN1TypxwgId2bRqOu9yvZq83uLPhmu5VcxCwfOc N3ZA/dIKoYBt8WJ5EkKYDCMXaQDQKkp1sToQKhH+GSbTAWTasqQ1CN1G1H4uOFwcd0fR ACpV0HNADxaUqDevi5fYeuY3NkIpjDg7+B/MtGhhqokSpjrDAksg6Kuej8aJtKIDxzAI zcVBVrntXH5CXNbSLSAzgQEN0/hqHTD36vipWjPykLcOdxe6HgFzECNutAxUpTNhMhmq 8zuC5mFLzSu6R/DG/0K1KFakL/so1xmbffYe98wmnv0/pEHsvHcZExdbnHpR9z3/iApk 1QKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qwJFwEtr; 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 q12-20020a05622a04cc00b003f51f13a728si1489815qtx.14.2023.06.08.19.26.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jun 2023 19:26:35 -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=qwJFwEtr; 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 1q7RpD-0005ig-Id; Thu, 08 Jun 2023 22:26:03 -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 1q7RoB-00032n-5Z for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:25:02 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7Rne-0005jV-H1 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:24:58 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-53fbb3a013dso353246a12.1 for ; Thu, 08 Jun 2023 19:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686277465; x=1688869465; 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=+os3nHQ/ZmARewYX8s5fRYkcgS0NtfZNFjYHPGkpaM4=; b=qwJFwEtrz4eOmeSiRKmOQjyX5vkfNx9xvMgp5tnbPcapURUKhy4JHSyVeucoRbzaOT VGsB9YaLH9crqdxESzusaqjIDh4PNhPflORyRiB67AJT6LXAkhh9vchbf0Tvese6Z1dh cUexEXa6/hJhdpPyvJfqgnmHsfhaHWMWm5OGH6KuHx+4f0I3fi2/qPHTylmbp5LkbnWH +0lBxU/njOfDZyaiRQ0itBp4Z9/BQAbCZF27RJy5U4XqnR5n4Lu2t7P0RDJeuX/+CcB/ WmOhSlP/hHBWyXhsuW5RAZ/Z2b+oJ6NXvTMLwyHaVrejuxZ8yhFzwX8GtuVDahRrK21r L9YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686277465; x=1688869465; 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=+os3nHQ/ZmARewYX8s5fRYkcgS0NtfZNFjYHPGkpaM4=; b=gfbYAI7o+xI+zuBEJAlrtjK8B+HBb33nxlRw8cdt/pdiJpDwapxSqLxj2rhKOD5f9E Y+zaklSOQOMO4+K8qE2MxSijFaQAUAf+P1IP5rSI/bh/q7rgO1xjX6lHa13kDgTuIQoY jpIeqjdT9u6YIKY23We5d1Z5VFvWGEx1rzVCcZ47YH6R9pOLcQQR80ESx566MyYIga47 nJf2DcmTNCOUAhPG3APq9WX/+gm4Qq/qTlh7nj7KdH6Z3Hr52TG8RKt6lw1FxV83Yywy tH6Uh8Zle+jkVzA6GhaV0YGhfl+7/XtmpebJ9vkEZzKZqkHMK906S3VcEjBwyNK/bsuJ GXkw== X-Gm-Message-State: AC+VfDxHKRhs/gGtZ9WLUbCFZ+M2TsOnIEVKiZYgqMc5/Mu1P2eYw1K/ Am29mGPgoisL+N0y+H1tD6/fywVdF1LD8BQa74I= X-Received: by 2002:a05:6a20:159:b0:f3:33fb:a62b with SMTP id 25-20020a056a20015900b000f333fba62bmr59777pzs.9.1686277465099; Thu, 08 Jun 2023 19:24:25 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:b071:df63:5761:f449]) by smtp.gmail.com with ESMTPSA id x25-20020a62fb19000000b0063afb08afeesm1686458pfm.67.2023.06.08.19.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 19:24:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: ardb@kernel.org, berrange@redhat.com, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com Subject: [PATCH v2 24/38] target/i386: Use aesenc_SB_SR_MC_AK Date: Thu, 8 Jun 2023 19:23:47 -0700 Message-Id: <20230609022401.684157-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609022401.684157-1-richard.henderson@linaro.org> References: <20230609022401.684157-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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 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); } }