From patchwork Fri Jun 9 02:23: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: 690854 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp597812wru; Thu, 8 Jun 2023 19:25:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qE5D6xGh1OQsJLS5+g6wO/UE64vg8wQ1SQCwGKPw4gmUYZzfuXLccJ/Pi06bnrasHwzHD X-Received: by 2002:ad4:5d6a:0:b0:5e8:c098:2493 with SMTP id fn10-20020ad45d6a000000b005e8c0982493mr291151qvb.50.1686277531309; Thu, 08 Jun 2023 19:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686277531; cv=none; d=google.com; s=arc-20160816; b=tJkOXE+vhAlKULRn/Yroqz1gE1uCiBT+Hu9ehphAyIBRWUfWU0YDcaLohvpRCbbxgO WBSYdzJQHLstujumqILqlI3CAc3ep3Fb3BAcyRwd2MLqLZgYGNnv0WrT+OW3KQZmPX1K TslbObcpO4reqIwkXi6HOmQoHbKot/mznfAYyOlUv3Q8fE+OWuIuUZ4sT3QUOvck2AfT d+UxBTGsWgGne++qolXL42u0qoEnOvCXOg6SBF5E5+xMAa9FR/LALJOET8t0kG0rKnXK CJ64TrNmHG88VoKOcab4ZiVnlmtoRLJl2USlHgWhrRGuXBE5wZjD9W1EEd360F+Zrk9R eD5A== 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=xtPI4aq2jyFLtOkSRUNw1Edg2O5XrlHB9lkxc+y7YR8=; b=0GJDXkYNKL+LKsTwJmpBgPbyZ1THdmcgmZnCkaESNvCDRo8F3DDjgmd0QjPaVW2O7/ BlmpPxLu+V1u6vklC9PTZ0L9+CLrexnJSa0KXJkHv4TxLIejo0Ch1l0+4eo7N7BGeF5n 7xxWo10OesHsrEPD42UOYYxyMZ5nk2cYmEaMclKBspjAbgc9BjMdQTvWn/MQhEvj3g7O rRE1xMT3WYu0QZJRAbNkCrRNF3uKC6ERJSYVHzgcXWy/nWZRsstkwlX9tC/16tN9026a 75WkytTWG22YY0mhmrzwXv2ORBCu7pulSz6tVgsT/lnQbdhD9FjJ6Wdq9B+G918hU7uf xSnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3oyLNnH; 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 gw8-20020a0562140f0800b006282077b3easi1623667qvb.493.2023.06.08.19.25.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jun 2023 19:25:31 -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=k3oyLNnH; 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 1q7RnY-0002az-Jo; Thu, 08 Jun 2023 22:24:20 -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 1q7RnV-0002Ze-NK for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:24:18 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7RnP-0005ZJ-33 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:24:17 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-64d18d772bdso1318343b3a.3 for ; Thu, 08 Jun 2023 19:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686277449; x=1688869449; 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=xtPI4aq2jyFLtOkSRUNw1Edg2O5XrlHB9lkxc+y7YR8=; b=k3oyLNnHSLFITjqaFD+WjQp4W2cV4L1DXSSMI1PxyPdw7hM4oJoVHBmUztnIo6HJhj Ed4jzMvWPInSdibF3AOC7m4M18C6jjGIws9Za0Y73CtsGPzDbo13jh1faChQCBk3f/K/ plW8XYN8lOcgjEcaUptLiAhGOTjyaN3jO+kRoIIh1hHXxo61gHxebDh5JYW9MM48YFKl jvVfHG9KWL0QjNo6VYSlEjq0P+i5LOlcvDzczOwi27ZQgLRYSgOYt9pBXeGNbcOotHXk L6kOD7+xmM+M/JRaLR+AYQD/+1RhqCt7O6QoRp1iOLBcvraC+H2BV3m9Ano0p8rx1SrG LFeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686277449; x=1688869449; 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=xtPI4aq2jyFLtOkSRUNw1Edg2O5XrlHB9lkxc+y7YR8=; b=UMqDDg45wWb/gY5K/h0FqfevLlHQykfXlp1xQjgEUwe/4UOH6FRANaGYkIN2J7sss/ Y+vfTx+8FyBnaeGeHB9r8uVBHjH4xnOKZA6aqU4DdY3vgSmHh7AJltrhAX6TCwtsJgMe pwtoKCRC4ktc2Nv/e6S6ibTNl4AJ+kfGydysZIHXBO/3hxj6xP9TYl+8gzB/ItE+Z5f/ OoMn0PjNlYH8pQAerCGotSeS7AmJdIN6WPahWD5ORKM1ar2a/YgMQRUKGMVzGotd8yKQ Kop8u/g/pnnDAIdivxtMK1Mo/klxpAqKXkaRzrW5JKXgcH2JwWZKLlxB8rsmzp4V5fSL HLNw== X-Gm-Message-State: AC+VfDwFCEylyS+TTSrUJPBEMTDHbgbSOVmGZsc8waZwDStqiE8r9aAZ RJ57gjuozcZL+D9kbf9GlD19zbO4d4ZnojvuFvs= X-Received: by 2002:a05:6a00:1a87:b0:65b:a187:d433 with SMTP id e7-20020a056a001a8700b0065ba187d433mr48792pfv.6.1686277449662; Thu, 08 Jun 2023 19:24:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 19:24:09 -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 07/38] target/i386: Use aesenc_SB_SR_AK Date: Thu, 8 Jun 2023 19:23:30 -0700 Message-Id: <20230609022401.684157-8-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::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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 AESENCLAST instruction. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/i386/ops_sse.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index fb63af7afa..63fdecbe03 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -19,6 +19,7 @@ */ #include "crypto/aes.h" +#include "crypto/aes-round.h" #if SHIFT == 0 #define Reg MMXReg @@ -2202,12 +2203,12 @@ void glue(helper_aesenc, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s) void glue(helper_aesenclast, 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 < 8 << SHIFT; i++) { - d->B(i) = rk.B(i) ^ (AES_sbox[st.B(AES_shifts[i & 15] + (i & ~15))]); + aesenc_SB_SR_AK(ad, st, rk, false); } }