From patchwork Thu May 25 19:10:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Ricardo Ziviani X-Patchwork-Id: 9748985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B739D601E9 for ; Thu, 25 May 2017 19:12:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A782328285 for ; Thu, 25 May 2017 19:12:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C15A28396; Thu, 25 May 2017 19:12:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4968B28285 for ; Thu, 25 May 2017 19:12:41 +0000 (UTC) Received: from localhost ([::1]:33325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDyBc-0003rz-Cm for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 May 2017 15:12:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDyAV-0003qj-0v for qemu-devel@nongnu.org; Thu, 25 May 2017 15:11:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDyAQ-0001hA-2b for qemu-devel@nongnu.org; Thu, 25 May 2017 15:11:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54465 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDyAP-0001h6-TR for qemu-devel@nongnu.org; Thu, 25 May 2017 15:11:26 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4PJ8gk5037032 for ; Thu, 25 May 2017 15:11:25 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0b-001b2d01.pphosted.com with ESMTP id 2anxjnff55-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 May 2017 15:11:24 -0400 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 May 2017 16:11:22 -0300 Received: from d24relay04.br.ibm.com (9.18.232.146) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 May 2017 16:11:19 -0300 Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v4PJBB355964102 for ; Thu, 25 May 2017 16:11:19 -0300 Received: from d24av02.br.ibm.com (localhost [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v4PJAlSZ013577 for ; Thu, 25 May 2017 16:10:47 -0300 Received: from pacoca.ibm.com ([9.85.147.99]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v4PJAfwZ013205; Thu, 25 May 2017 16:10:45 -0300 From: Jose Ricardo Ziviani To: qemu-devel@nongnu.org Date: Thu, 25 May 2017 16:10:20 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495739423-32326-1-git-send-email-joserz@linux.vnet.ibm.com> References: <1495739423-32326-1-git-send-email-joserz@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17052519-0020-0000-0000-000002AD13BF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052519-0021-0000-0000-000030CA9145 Message-Id: <1495739423-32326-2-git-send-email-joserz@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-25_15:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705250348 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH Risu v3 1/4] risugen_ppc64: Load random 128-bit data to vector registers 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: peter.maydell@linaro.org, nikunj@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jose Ricardo Ziviani --- risugen_ppc64.pm | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/risugen_ppc64.pm b/risugen_ppc64.pm index 341478c..1a3cd59 100644 --- a/risugen_ppc64.pm +++ b/risugen_ppc64.pm @@ -99,6 +99,29 @@ sub write_mov_ri64($$) insn32((0x3e << 26) | (20 << 21) | (1 << 16) | 0x10); } +sub write_mov_ri128($$$$) +{ + my ($imhh, $imh, $iml, $imll) = @_; + + # store the lowest 32 bits + write_mov_ri32(20, $imll); + # stw r20, 16(r1) + insn32((0x24 << 26) | (20 << 21) | (1 << 16) | 0x10); + # store the lower 32 bits + write_mov_ri32(20, $iml); + # stw r20, 20(r1) + insn32((0x24 << 26) | (20 << 21) | (1 << 16) | 0x14); + # store the higher 32 bits + write_mov_ri32(20, $imh); + # stw r20, 24(r1) + insn32((0x24 << 26) | (20 << 21) | (1 << 16) | 0x18); + # store the highest 32 bits + write_mov_ri32(20, $imhh); + # stw r20, 28(r1) + insn32((0x24 << 26) | (20 << 21) | (1 << 16) | 0x1c); + +} + sub write_random_ppc64_fpdata() { for (my $i = 0; $i < 32; $i++) { @@ -106,22 +129,18 @@ sub write_random_ppc64_fpdata() write_mov_ri64(rand(0xfffff), rand(0xfffff)); # since the EA is r1+16, load such value in FP reg insn32((0x32 << 26) | ($i << 21) | (0x1 << 16) | 0x10); - insn32((0x39 << 26) | ($i << 21) | (0x1 << 16) | 0x12); - } } -sub write_random_ppc64_fpdata_i() +sub write_random_ppc64_vrdata() { - # get an space from the stack - insn32(0x3ac10020); # addi r22, r1, 32 - insn32(0x3ee03ff0); # lis r23, 0x3ff0 - insn32(0x3af70000); # addi r23, r23, 0 - insn32(0xfaf60000); # std r23, 0(r22) - for (my $i = 0; $i < 32; $i++) { - # lfd f$i, 0(r22) - insn32((0x32 << 26 | $i << 21 | 0x16 << 16)); + # load a random doubleword value at r0 + write_mov_ri128(rand(0xffff), rand(0xffff), rand(0xfffff), rand(0xfffff)); + # li r0, 16 + write_mov_ri16(0, 0x10); + # lvx vr$i, r1, r0 + insn32((0x1f << 26) | ($i << 21) | (0x1 << 16) | 0x2ce); } } @@ -172,6 +191,7 @@ sub write_random_register_data($) clear_vr_registers(); + write_random_ppc64_vrdata(); if ($fp_enabled) { # load floating point / SIMD registers write_random_ppc64_fpdata();