From patchwork Wed Jun 13 12:55:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 138457 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp687824lji; Wed, 13 Jun 2018 05:59:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1XliFXue3tKYc3SB7XwDRrUUex88nHRUozvj9gKzkk+ymDUhjbt+o7ZS+2y66t7cD7RIx X-Received: by 2002:a37:b603:: with SMTP id g3-v6mr4306903qkf.208.1528894745385; Wed, 13 Jun 2018 05:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528894745; cv=none; d=google.com; s=arc-20160816; b=VlQS221saL5dwGYpOuPwpcWvE0SYwa4ByctqoAa7Pr4jO4NhOSLpYJYACdv9uaAdMT IGplFZe2wIQhXVqktaFESS5pVWX67HGLVtklPEculu8+W/2+iZWwM+7uLIsIqJ1TNKch 3mWtW3asYOrppFyBhOQtMWOsB8pVxuWiPdcdqIV6YNENFMZRqeidVsOGX9UX2wOkgY84 J81Ecw/sdGjJoyqoVRmsuTCHOI7406ND1iuLj/dwnR4p2luKbVlvzo9qG3ft0KuS3N0f mOR653yvKqNpq99dFZuOJmkBJm+YFFOwTAE3NflWIa+uEaE4R3pE+TAu15i5q1JtlQOE vSug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=IEGZXFnFNMOWMxKC/DUaSek0uOvs3FGzAO/YFETY3Ak=; b=P5rsNdqLWY0lEwbW6sqiKbJpF6SCH/I1bAy3ftbm4R2NjkPJ7SiHpoH5/bd979gFbn 5W3JUyNL6x/Yj5WUaFgZzb+9m/EqM/aGZKQ3g0oUZVxtoqMijXgix9tjgxpI4QrfdAbp JpvchTDCIMOiQLNxSQrIWXV4acS0T6+e9u5XETN2dGmVqZdPqyya/u/48UwQyZUyypB/ OZNpO3gftTrnnGOlRB+eoit7WX2VmFGXVa6F3B6PgFuD8Mp7rPTtDblnX2wPoPSZqlsv XMGYVGwL91GgNxfWNtzF/HNhxS6AWa/dTF9Cj1eCkPW4WuHDGgAhwfEDpaDpIZwaoloH 3FXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DN5YSijr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f40-v6si2554580qvd.37.2018.06.13.05.59.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Jun 2018 05:59:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DN5YSijr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT5Me-000574-PN for patch@linaro.org; Wed, 13 Jun 2018 08:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fT5Jr-0002dA-Dc for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fT5Jp-00058g-WD for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:11 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fT5Jp-00056B-It for qemu-devel@nongnu.org; Wed, 13 Jun 2018 08:56:09 -0400 Received: by mail-wr0-x244.google.com with SMTP id e18-v6so2661432wrs.5 for ; Wed, 13 Jun 2018 05:56:09 -0700 (PDT) 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=IEGZXFnFNMOWMxKC/DUaSek0uOvs3FGzAO/YFETY3Ak=; b=DN5YSijroUHvacyh/WvkV3e+goPsvFNQlpmYyNFXNzmnBf7XiPDWvsd/vjXwfHp8qc JeZNR4CxJjcrJyQ1b1vR4fqa9r9ZzIYqLG0hDAYnfQ4dXj0OeuvIxUhPafygBFqxJXje smUfAQJCxiarxMr2OfyDcVgdatwStNF9HcU+g= 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=IEGZXFnFNMOWMxKC/DUaSek0uOvs3FGzAO/YFETY3Ak=; b=KDIEXqygWxMx9An+3zoKc/sYOUsnnNcn4d9Ay3WchInBpJFh7LAtcvBRjQPnWzwZHI mqkv3JCkwp0D+g4t4mlf3d4/we6xsNSAe+3GU+iJ8aRl9zTxcnTKYFjS5i+2BW10Pq+b FaNwQs0/9n1QJWqM6ZTxJ3K9R5UVdOgovSQq4hPbca/kjDDBdv61Gl8ybn8FYpfZbKor uVd+GejUpALXhrgvqCPiOahw5PvW6xFrOmO6qu+yQBsEBIKHgmCb2Arly5gwFXZ1GfMg ctOg/as4azbCDXlGMts5I4Jr5YghxWMyrUTMi4ALJKXzOaczvPXa/KKtOpf8vXE88wN6 wtEA== X-Gm-Message-State: APt69E2ksAqQsOh3wjpvjQQXy18/bbpvjSfQpoaZ7UUZ2hHrc5QxTA3w 6gI4NMrLjvu7ucbBDRMghC1+Jw== X-Received: by 2002:adf:a982:: with SMTP id b2-v6mr4106040wrd.122.1528894568415; Wed, 13 Jun 2018 05:56:08 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n23-v6sm2705505wmh.6.2018.06.13.05.56.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Jun 2018 05:56:05 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 875D53E119C; Wed, 13 Jun 2018 13:56:01 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Wed, 13 Jun 2018 13:55:46 +0100 Message-Id: <20180613125601.14371-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613125601.14371-1-alex.bennee@linaro.org> References: <20180613125601.14371-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [RISU PATCH v3 07/22] risugen: add --sve support 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_Benn=C3=A9e?= , qemu-arm@nongnu.org, richard.henderson@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is similar to the approach used by the FP/simd data in so far as we generate a block of random data and then load into it. The loading is actually done by the current vector length but that is implicit in the run anyway. Signed-off-by: Alex Bennée --- v2 - only one SIMD/FP/SVE block as they alias - move efficient loading as suggested by Dave --- risugen | 3 +++ risugen_arm.pm | 56 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/risugen b/risugen index 488d804..de3f5ea 100755 --- a/risugen +++ b/risugen @@ -319,6 +319,7 @@ sub main() my $condprob = 0; my $fpscr = 0; my $fp_enabled = 1; + my $sve_enabled = 1; my $big_endian = 0; my ($infile, $outfile); @@ -336,6 +337,7 @@ sub main() }, "be" => sub { $big_endian = 1; }, "no-fp" => sub { $fp_enabled = 0; }, + "sve" => sub { $sve_enabled = 1; }, ) or return 1; # allow "--pattern re,re" and "--pattern re --pattern re" @pattern_re = split(/,/,join(',',@pattern_re)); @@ -363,6 +365,7 @@ sub main() 'fpscr' => $fpscr, 'numinsns' => $numinsns, 'fp_enabled' => $fp_enabled, + 'sve_enabled' => $sve_enabled, 'outfile' => $outfile, 'details' => \%insn_details, 'keys' => \@insn_keys, diff --git a/risugen_arm.pm b/risugen_arm.pm index 2f10d58..bb3ee90 100644 --- a/risugen_arm.pm +++ b/risugen_arm.pm @@ -472,14 +472,51 @@ sub write_random_aarch64_fpdata() } } -sub write_random_aarch64_regdata($) +sub write_random_aarch64_svedata() { - my ($fp_enabled) = @_; + # Load SVE registers + my $align = 16; + my $vq = 16; # quadwords per vector + my $datalen = (32 * $vq * 16) + $align; + + write_pc_adr(0, (3 * 4) + ($align - 1)); # insn 1 + write_align_reg(0, $align); # insn 2 + write_jump_fwd($datalen); # insn 3 + + # align safety + for (my $i = 0; $i < ($align / 4); $i++) { + # align with nops + insn32(0xd503201f); + }; + + for (my $rt = 0; $rt <= 31; $rt++) { + for (my $q = 0; $q < $vq; $q++) { + write_random_fpreg_var(4); # quad + } + } + + # Reset all the predicate registers to all true + for (my $p = 0; $p < 16; $p++) { + insn32(0x2518e3e0 | $p); + } + + for (my $rt = 0; $rt <= 31; $rt++) { + # ldr z$rt, [x0, #$rt, mul vl] + insn32(0x85804000 + $rt + (($rt & 7) << 10) + (($rt & 0x18) << 13)); + } +} + +sub write_random_aarch64_regdata($$) +{ + my ($fp_enabled, $sve_enabled) = @_; # clear flags insn32(0xd51b421f); # msr nzcv, xzr - if ($fp_enabled) { - # load floating point / SIMD registers + # Load floating point / SIMD registers + # (one or the other as they overlap) + if ($sve_enabled) { + write_random_aarch64_svedata(); + } elsif ($fp_enabled) { write_random_aarch64_fpdata(); } @@ -490,12 +527,12 @@ sub write_random_aarch64_regdata($) } } -sub write_random_register_data($) +sub write_random_register_data($$) { - my ($fp_enabled) = @_; + my ($fp_enabled, $sve_enabled) = @_; if ($is_aarch64) { - write_random_aarch64_regdata($fp_enabled); + write_random_aarch64_regdata($fp_enabled, $sve_enabled); } else { write_random_arm_regdata($fp_enabled); } @@ -893,6 +930,7 @@ sub write_test_code($$$$$$$$) my $fpscr = $params->{ 'fpscr' }; my $numinsns = $params->{ 'numinsns' }; my $fp_enabled = $params->{ 'fp_enabled' }; + my $sve_enabled = $params->{ 'sve_enabled' }; my $outfile = $params->{ 'outfile' }; my %insn_details = %{ $params->{ 'details' } }; @@ -918,7 +956,7 @@ sub write_test_code($$$$$$$$) write_memblock_setup(); } # memblock setup doesn't clean its registers, so this must come afterwards. - write_random_register_data($fp_enabled); + write_random_register_data($fp_enabled, $sve_enabled); write_switch_to_test_mode(); for my $i (1..$numinsns) { @@ -930,7 +968,7 @@ sub write_test_code($$$$$$$$) # Rewrite the registers periodically. This avoids the tendency # for the VFP registers to decay to NaNs and zeroes. if ($periodic_reg_random && ($i % 100) == 0) { - write_random_register_data($fp_enabled); + write_random_register_data($fp_enabled, $sve_enabled); write_switch_to_test_mode(); } progress_update($i);