From patchwork Wed Sep 11 16:50:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 827455 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp891286wrc; Wed, 11 Sep 2024 09:52:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU8nH17vW5+Bg8FCPi2pmwZrz/542bkowSI5XpYFRHGsl1gGkeTCNi08ieSRi7uM9MyhttwfA==@linaro.org X-Google-Smtp-Source: AGHT+IHIghfbPM9U/dxDjgdLAtz9BRM+gZDbarGXVQlg0dNijQ3FuCC8PpKIfhCsL35+2a1M5QFh X-Received: by 2002:a05:622a:88:b0:456:77c3:c0f0 with SMTP id d75a77b69052e-4580c689948mr249872221cf.17.1726073522471; Wed, 11 Sep 2024 09:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726073522; cv=none; d=google.com; s=arc-20240605; b=JiYfyBwryWHEZa3YpNciHc0cMeXWANnZu4tN+7pZNjdCeOGFli1ROOk5ORBUA9UFry 26k/CtQPZaLEMtW4wdMzg6piNDivczXf+aT7Mff1Ux9+ncFVMJfa5+TSUVkKw6I9r2De gnNkbF5B+W6bVKs1qcUGiEwNjHCI2Zk8WxVDgqW3ROVLv64h2uFi6caikommenJgZ+qm mu2Ox9gZA59BkHy6yQt8aA73HU1mC8XhVs2eIW05I4QYyfbSimhSaqumv2JSzw5CG+1e Ep4l83Co7FDLY1NHUopXk8i/C6bBTgMJl0mXT5UAsjjCqwVieu8aCJ2ZfbyjntvwXlSs An0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=TJpoTzM9GbnBdLmIf7a0iA6SVKMaRDRJnRgQ7RT4sOU=; fh=gW8xxqNJ+GKzLr7OBpcms3Apqae8iNJSKgK4r5swIT4=; b=LkFXVCJovEUnqTNBgGQ+otXb2yz9zkjasMwMLHmrvQpn7xzxh178K4p0ZCodnPaSgw whJsMjQsfl4I+PPTtUsyw5+MLlzfPE3+/BZ4PCYKbQvANAjOSLO/pyas962CXbt9u0w+ Tz4YI3w6lJhkS0kxuzUBXKODmX0tTOSuY+kAyqw8Gg1yTV07Vra3jrg41IUmBQPx2Hdg jcM08xJH8J4nFEU/7WjnKjcanrqeoT25zgiGLC3pVk6bLddZSkAICjiTBV/I+v8FuRFs asMDtsfnUDBhQW2/uJ0/TgU/Z4/yxK6vS8c3YBRLNrfsK1OEXD1TW9rXRIB46QHqMl1W kR5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbO2QEu+; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4582301d151si111178091cf.740.2024.09.11.09.52.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 09:52: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=wbO2QEu+; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soQYR-0001uZ-5i; Wed, 11 Sep 2024 12:50:55 -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 1soQYO-0001qj-Rp for qemu-devel@nongnu.org; Wed, 11 Sep 2024 12:50:52 -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 1soQYN-0003dy-5q for qemu-devel@nongnu.org; Wed, 11 Sep 2024 12:50:52 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7191901abd6so833309b3a.3 for ; Wed, 11 Sep 2024 09:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726073449; x=1726678249; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TJpoTzM9GbnBdLmIf7a0iA6SVKMaRDRJnRgQ7RT4sOU=; b=wbO2QEu+TngZjQLXSIloHUUajp8iTBA20/1DDlS1wOjbJO7wCxxoR9xkV0nW/jhuFj 6WNECMlYCH/tzASPlQyXxVBEiIqG4rYHOXVK61EN8IbCGU0u44Omju5aadFQOmBMWXpe ssgvUGd0KksBXxMtt4bwkbZVXyu3my/jM2viurt+X0AwfQW27RGcB+OIOyBu1UzALqqw gjq3zyszEH7h85GgSirI/ps9ybcnJMXCQvrhQBW45M87ixJnBtGOEVCSxTJR32w2nrzh QIvK1oX/B4dkfFiG0VJxTuBCxX3VwNLLiR9iQWNi8bIlJZ4cge8N9LpJR9bB6+GhQSWU B0DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726073449; x=1726678249; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TJpoTzM9GbnBdLmIf7a0iA6SVKMaRDRJnRgQ7RT4sOU=; b=bqtsB5CYwDoX0I82RVqQ2O5EVBWXkM5sDjYWZmOakLIEW+Pcu/hAWRFZUHJCyh2XKS WZRmdVU+u4FKBFI4W+D+jew1J7rkSFjKJil1eLZ4SfL+iFmmSntfCzsyTpMann0l0oLk 10Dy0VSu+Pi0vebQNxWoOjTNEhxKGqDXSAxkYrDVhvhT7V5b5aROZyuhz/j3f3/mx777 do0j4CtDGrYabjrPfUIgcdvlEhYDea9yFqiCPVQTGh0XC2CxASWAOfrjb6npALkWltsr fJWXYoQenDoOIDN/oTiaT0ClQDdPf+EUKSc7ZYnSEzjrGgWS1wIqVbzuarDsOMp7yz3M 6Okg== X-Gm-Message-State: AOJu0YwsowQu4p4eboF5DdqPWbfN8Nu73i6u7kqln6Iznvh1TuNyulCW nnocGsQCEcJxola/ib6mqtKmdQjHFQnQyQkzDfQAmrARxQ0p2XSe5D/DtnVetPEvNauyXzpG6YA 9 X-Received: by 2002:a05:6a00:1396:b0:706:67c9:16d0 with SMTP id d2e1a72fcca58-718d5f15fe8mr20748288b3a.26.1726073448927; Wed, 11 Sep 2024 09:50:48 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71908fe4e7esm3186947b3a.80.2024.09.11.09.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 09:50:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: zhiwei_liu@linux.alibaba.com, tangtiancheng.ttc@alibaba-inc.com, philmd@linaro.org Subject: [PATCH v2 00/18] tcg: Improve support for cmpsel_vec Date: Wed, 11 Sep 2024 09:50:29 -0700 Message-ID: <20240911165047.1035764-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 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 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 The patches to optimize cmp_vec and cmpsel_vec -- particularly canonicalizing immediate operands -- are directed toward helping the in flight tcg/riscv vector backend. In order for that to happen, the i386, ppc and s390x backends must be changed so that they do not rely upon choices made during early expansion, before optimization changes things. While I was looking at the issues i386 was attempting to solve during early expansion, I realized that avx512 does not have the same issues. Expansion of vector cmp and cmpsel become trivial. Changes for v2: - Update ppc and s390x backends. - Fix avx512 tsteq cut-and-paste error (philmd). r~ Richard Henderson (18): tcg: Export vec_gen_6 tcg/i386: Split out tcg_out_vex_modrm_type tcg/i386: Do not expand cmp_vec early tcg/i386: Do not expand cmpsel_vec early tcg/ppc: Do not expand cmp_vec early tcg/s390x: Do not expand cmp_vec early tcg/optimize: Fold movcond with true and false values identical tcg/optimize: Optimize cmp_vec and cmpsel_vec tcg/optimize: Optimize bitsel_vec tcg/i386: Optimize cmpsel with constant 0 operand 3. tcg/i386: Implement cmp_vec with avx512 insns tcg/i386: Add predicate parameters to tcg_out_evex_opc tcg/i386: Implement cmpsel_vec with avx512 insns tcg/i386: Implement vector TST{EQ,NE} for avx512 tcg/ppc: Implement cmpsel_vec tcg/ppc: Optimize cmpsel with constant 0/-1 arguments tcg/s390x: Implement cmpsel_vec tcg/s390x: Optimize cmpsel with constant 0/-1 arguments tcg/i386/tcg-target-con-set.h | 1 + tcg/i386/tcg-target-con-str.h | 1 + tcg/i386/tcg-target.h | 4 +- tcg/i386/tcg-target.opc.h | 1 - tcg/ppc/tcg-target-con-set.h | 1 + tcg/ppc/tcg-target.h | 2 +- tcg/s390x/tcg-target-con-set.h | 2 + tcg/s390x/tcg-target-con-str.h | 1 + tcg/s390x/tcg-target.h | 2 +- tcg/tcg-internal.h | 2 + tcg/optimize.c | 99 +++++++ tcg/tcg-op-vec.c | 4 +- tcg/i386/tcg-target.c.inc | 488 +++++++++++++++++++++------------ tcg/ppc/tcg-target.c.inc | 254 +++++++++++------ tcg/s390x/tcg-target.c.inc | 195 +++++++------ 15 files changed, 695 insertions(+), 362 deletions(-)