From patchwork Tue Nov 7 15:05:55 2017 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: 118185 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp636542edm; Tue, 7 Nov 2017 07:10:15 -0800 (PST) X-Google-Smtp-Source: ABhQp+Sj4TMpb/jY/f6A9jm2bq947oRKTKrnDPp1/LdON3ez8Df2REEcOgAN4y9E4Ya15I4EbmCk X-Received: by 10.129.46.8 with SMTP id u8mr12531638ywu.511.1510067415280; Tue, 07 Nov 2017 07:10:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510067415; cv=none; d=google.com; s=arc-20160816; b=mCaNE4f+D+SqPyapXe7NnhpIsIuZqrz0Y7PpdBdsl15omd9zMvOtvP9GFNOja7xH+7 Jae7aHnTwxrb+LIYV2b7b2howbpgzPKpjc7CBR37vqcjy3/g5GLeQasWPmwgxuRNPMHk bC8JoW4TgtIVzk2fNWKIF602/H24CcXmb+xLsGaMUiGxjLzj7ckLhlCtAM6JI5DE+GUM YLaK2uCoRyg0syX+tM9NvxxHNaCeiz8yf0j3M6yllxVM7S+mMOP/WMhXXpB49ohbZ6on K6EUnUpcbEg5P0HMhggDLcO36dzA8ol07YjFBKC9eibtKZeFf8C6CmMccDg0FChGBuHg k3oA== 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=z2m0gD3rxhKF/g/UVnGrY2EDjOkD/amtIoVHJ+E7xpQ=; b=ot3SKS6n9hkxM5dlBjIdhJJGkyNpKRO5x2L6gI6ep9tVq1FatZaIFMa7pn3gxZHuDQ QFZEVVaNqmsPvwF/s59qLeCnZZq2nfSJoo3qBdMli0CxEFPg0o99qLk1HKyrFOwfIwFQ FG4yhyIsEnXhWupDYAYBb87Cl5sH5XbERanFjUoSdigWFuTXRn8CluOLd54BknoV5K1V 7zf5swpwGtEGcK/DvQId8/8IV4VKuPsiOD2VXM7tqh5HoYM1ULxU94b2rTOTYjElM50H GOs6JuyKJQ0qbzWx7iH7D4JuDX3nk20ubJArRYNtxsmS1VfsMw+180Hnwf9Ur1S8AQPr ubKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XsSZB67E; 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 c2si326996ywe.349.2017.11.07.07.10.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 Nov 2017 07:10:15 -0800 (PST) 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=XsSZB67E; 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]:53865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC5W2-0000BL-IS for patch@linaro.org; Tue, 07 Nov 2017 10:10:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC5SO-0005ul-Vf for qemu-devel@nongnu.org; Tue, 07 Nov 2017 10:06:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eC5SH-00007K-7h for qemu-devel@nongnu.org; Tue, 07 Nov 2017 10:06:28 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:45421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eC5SG-00006a-VB for qemu-devel@nongnu.org; Tue, 07 Nov 2017 10:06:21 -0500 Received: by mail-wr0-x244.google.com with SMTP id y9so12133703wrb.2 for ; Tue, 07 Nov 2017 07:06:20 -0800 (PST) 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=z2m0gD3rxhKF/g/UVnGrY2EDjOkD/amtIoVHJ+E7xpQ=; b=XsSZB67Ech6Urtx4sTKGgRRWsVkB9UIBhRXxJg3qXZwMXlUQeb0ZAW7WU0DXg6p5FU ANQQT9yJqY9DAS3Yuz+tdXeLRUQ2FpAsB+v6rzZXkXlRQB8yK+zBH6GSmuox0OAgSwXU BIMuHrnIKAdUJ6A7B6P/ASoKmCdRdyeIyx+0E= 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=z2m0gD3rxhKF/g/UVnGrY2EDjOkD/amtIoVHJ+E7xpQ=; b=HoWcNKTc0WMKhFQXT8999gJRTWK8TMLhEoZk5HPsBMfFi5+QhcNuxS3CZP6iQOWgEZ 9V5iyukVCsYlo/L679jfaMGrqL6XSIFU+1NrSCJenbRqRc8SeEw2jNf8qg+E75pS0nnM 99gl8x7Eoz9LKUJLA1DkgVA1UOyiAy0eczU/anzRjEKuXf8Rug48KRvo/Jg4WVL6KR+f soudXPpKoF9xXBA7AozMP5cwGeSZUfY341oMfeTL9ZFbXoB50LTnZz5kYw12HPfocDmn e+bx56zwu5BCFFb1pyrjHmv586UmK7W4Fhdk1hMLBdCKAE2mqJVQwGSUDKOKCdwEvJoB Es9A== X-Gm-Message-State: AMCzsaX13/YYCKTw9FxzwkSzY0QbPfRJkrbeudfTdYeoyG4D2nB6OC6Q HQO2eqxgQfpl+BI82bDovjolCA== X-Received: by 10.223.181.131 with SMTP id c3mr15596783wre.198.1510067179685; Tue, 07 Nov 2017 07:06:19 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g68sm1116653wmc.22.2017.11.07.07.06.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 07:06:16 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id D39323E0488; Tue, 7 Nov 2017 15:06:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 7 Nov 2017 15:05:55 +0000 Message-Id: <20171107150558.22131-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171107150558.22131-1-alex.bennee@linaro.org> References: <20171107150558.22131-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 07/10] 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: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Dave.Martin@arm.com, 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. As there are no post-index SVE operations we need to emit an additional incp instruction to generate our offset into the array. Signed-off-by: Alex Bennée --- risugen | 3 +++ risugen_arm.pm | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 53 insertions(+), 7 deletions(-) -- 2.14.2 diff --git a/risugen b/risugen index aba4bb7..0ac8e86 100755 --- a/risugen +++ b/risugen @@ -317,6 +317,7 @@ sub main() my $condprob = 0; my $fpscr = 0; my $fp_enabled = 1; + my $sve_enabled = 1; my $big_endian = 0; my ($infile, $outfile); @@ -334,6 +335,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)); @@ -361,6 +363,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..8d1e1fd 100644 --- a/risugen_arm.pm +++ b/risugen_arm.pm @@ -472,9 +472,47 @@ 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 $vl = 16; # number of vqs + my $datalen = (32 * $vl * 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 < $vl; $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); + } + + # there is no post index load so we do this by hand + write_mov_ri(1, 0); + for (my $rt = 0; $rt <= 31; $rt++) { + # ld1d z0.d, p0/z, [x0, x1, lsl #3] + insn32(0xa5e14000 | $rt); + # incp x1, p0.d + insn32(0x25ec8801); + } +} + +sub write_random_aarch64_regdata($$) +{ + my ($fp_enabled, $sve_enabled) = @_; # clear flags insn32(0xd51b421f); # msr nzcv, xzr @@ -483,6 +521,10 @@ sub write_random_aarch64_regdata($) write_random_aarch64_fpdata(); } + if ($sve_enabled) { + write_random_aarch64_svedata(); + } + # general purpose registers for (my $i = 0; $i <= 30; $i++) { # TODO full 64 bit pattern instead of 32 @@ -490,12 +532,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 +935,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 +961,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 +973,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);