From nobody Wed Oct 22 13:07:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519402449164198.9119410526796; Fri, 23 Feb 2018 08:14:09 -0800 (PST) Received: from localhost ([::1]:45488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFz6-0003Bm-7x for importer@patchew.org; Fri, 23 Feb 2018 11:14:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epFYE-0003j3-7m for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epFYC-0008FY-Oj for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:22 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:38580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epFYC-0008Cq-Gd for qemu-devel@nongnu.org; Fri, 23 Feb 2018 10:46:20 -0500 Received: by mail-wm0-x232.google.com with SMTP id z9so5366016wmb.3 for ; Fri, 23 Feb 2018 07:46:20 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k130sm2748806wmg.9.2018.02.23.07.46.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 07:46:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2AB873E0427; Fri, 23 Feb 2018 15:46:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/JQYDJTsx6TC/FxJeq/wGoiGNuBgAF5wmf8OnNbEaes=; b=MSBf7mbGN6uKVhUTAkddl84k5PHdztaG00kPMm3iBkwBMfG9jVpuCldWFyKETDgTIO M88ZsemOntcfJTN26megbMUmBgVpgTyudHWU1mSVJXcLQgJIvpz7uTOmxXnaaZmjOJyz Fy1c+EbBtYDudKAETJJVkFvGNXSqUnxP2+zCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/JQYDJTsx6TC/FxJeq/wGoiGNuBgAF5wmf8OnNbEaes=; b=ZlSQ90DU2qXGOokf1vrHFK+XDD8g5Cq+USnYtgYWmtjrXW5DXVP/heqZQscuxiMxOc rdYX2ZiTcQDIBsbnBUp5hxrs2TpfzXII7jQPH8v/mwqEcELZgN+uRb/WxefJT+AnaX3J w219BhrjtTReF6RVji/rUj9QYLsIM3Lxe30G5o3fIQBqiH3+SikjcR32xvBVn2L7E/7y YoO5YP/NJtILN4OvGqow++N6Iiizoc6sNnknj7CLzKWurc4P+kDuKbRIw44s9No22owo Nhg7GByJ/PfrBPrZBanfT3s6HFH1FIry4AMmsdprM4vY007cw20ht2+8KisGQQxyLB2H +yHg== X-Gm-Message-State: APf1xPCZMNfzoG+1XIFK/ja+FMdqVtmbW8ugPZI5hiaQwq/FtcHfkbS7 ELY6bcsdNDDJGKITyqIaZhslNg== X-Google-Smtp-Source: AH8x227oeXyqZjOYuXXqRJhDp9hN8Gs/jIWHTJVY73/UGqJg4yW3Xno/CHVaJmU7vs4xfHhwS4/eHA== X-Received: by 10.28.191.90 with SMTP id p87mr1667056wmf.145.1519400779199; Fri, 23 Feb 2018 07:46:19 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 23 Feb 2018 15:46:09 +0000 Message-Id: <20180223154613.2096-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180223154613.2096-1-alex.bennee@linaro.org> References: <20180223154613.2096-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [PATCH v1 4/8] new contrib/generate_all.sh: batch risugen script X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, richard.henderson@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This is a simple script for generating all instructions in a given RISU file. You can split up the batch size by passing a -n N command line options. For example: ./contrib/generate_all.sh -n 2 hp.risu testcases.armv8.2_hp Signed-off-by: Alex Benn=C3=A9e --- contrib/generate_all.sh | 96 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 96 insertions(+) create mode 100755 contrib/generate_all.sh diff --git a/contrib/generate_all.sh b/contrib/generate_all.sh new file mode 100755 index 0000000..1e6b847 --- /dev/null +++ b/contrib/generate_all.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Generate all patterns in a given RISU file +# +# Copyright (c) 2017 Linaro Limited +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Alex Benn=C3=A9e - initial implementation +# +# Usage: +# ./contrib/generate_all.sh + +set -e + +USAGE=3D"Usage: `basename $0` [-h] [-n x] " +SPLIT=3D4 +RISUGEN=3D$(CDPATH=3D cd -- "$(dirname -- "$0")/.." && pwd -P)/risugen + +# Parse command line options. +while getopts hn: OPT; do + case "$OPT" in + h) + echo $USAGE + exit 0 + ;; + n) + SPLIT=3D$OPTARG + ;; + \?) + # getopts issues an error message + echo $USAGE >&2 + exit 1 + ;; + esac +done + +# Remove the switches we parsed above. +shift `expr $OPTIND - 1` + +while [ $# -ne 0 ]; do + + if [ -f $1 ]; then + RISU_FILE=3D$1; + elif [ -d $1 ]; then + TARGET_DIR=3D$1; + elif [ ! -e $1 ]; then + TARGET_DIR=3D$1 + fi + + shift +done + +if test -z "${RISUGEN}" || test ! -x "${RISUGEN}"; then + echo "Couldn't find risugen (${RISUGEN})" + exit 1 +fi + +if [ -z "$RISU_FILE" ]; then + echo "Need to set a .risu file for patterns" + exit 1 +fi + +if [ -z "${TARGET_DIR}" ]; then + echo "Need to set a TARGET_DIR" + exit 1 +fi + + +mkdir -p ${TARGET_DIR} + +ALL_INSNS=3D$(cat ${RISU_FILE} | ag "^\w" | cut -f 1 -d " " | sort) +COUNT=3D$(cat ${RISU_FILE=3D} | ag "^\w" | cut -f 1 -d " " | wc -l) +set -- $ALL_INSNS + +GROUP=3D$((COUNT / ${SPLIT})) + +while test $# -gt 0 ; do + INSN_PATTERNS=3D"" + I_FILE=3D"${TARGET_DIR}/insn_" + for i in `seq 1 ${SPLIT}`; do + I=3D$1 + if test -n "${I}"; then + shift + INSN_PATTERNS=3D"${INSN_PATTERNS} --pattern ${I}" + I_FILE=3D"${I_FILE}${I}_" + fi + done + I_FILE=3D"${I_FILE}_INC.risu.bin" + CMD=3D"${RISUGEN} ${INSN_PATTERNS} ${RISU_FILE} ${I_FILE}" + echo "Running: $CMD" + $CMD +done --=20 2.15.1