From patchwork Tue Feb 11 00:40:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 11374469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C3E3186E for ; Tue, 11 Feb 2020 00:56:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 534992072C for ; Tue, 11 Feb 2020 00:56:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Ih1onvau" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 534992072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=quicinc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1JrG-0001xl-GZ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 10 Feb 2020 19:56:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33244) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1JcV-0001ym-Uq for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1JcT-0008WM-FD for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:43 -0500 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:3651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1JcT-0004uE-1r for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1581381701; x=1612917701; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XbtMmHHKy9IdsEl46Mz89eb4fCaCb3TSmn0EhgVl7Us=; b=Ih1onvaug9M62R3zgm5jH/H5wDHoYpHKIJRYibl5lslQVcaXEZVn5A7m usf0r+oJgiBheZBDRwNmyZnkGiJV4aHpbTV9fo8anGO0Ezn+mjP7idD0G Nu06vW30ADZ+R2synWPGuuWiW0ZlUP2C7caiBMRyFgXxlE33USeb7sAMG 4=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 10 Feb 2020 16:41:02 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg03-sd.qualcomm.com with ESMTP; 10 Feb 2020 16:41:01 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 9DF7C1B48; Mon, 10 Feb 2020 18:41:01 -0600 (CST) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH 46/66] Hexagon TCG generation - step 09 Date: Mon, 10 Feb 2020 18:40:24 -0600 Message-Id: <1581381644-13678-47-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581381644-13678-1-git-send-email-tsimpson@quicinc.com> References: <1581381644-13678-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 199.106.114.38 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: riku.voipio@iki.fi, richard.henderson@linaro.org, laurent@vivier.eu, Taylor Simpson , philmd@redhat.com, aleksandar.m.mail@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Override instructions to speed up qemu Signed-off-by: Taylor Simpson --- target/hexagon/helper_overrides.h | 97 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/target/hexagon/helper_overrides.h b/target/hexagon/helper_overrides.h index e544dd5..52e4a47 100644 --- a/target/hexagon/helper_overrides.h +++ b/target/hexagon/helper_overrides.h @@ -1230,4 +1230,101 @@ gen_helper_vacsh_pred(PeV, cpu_env, RxxV, RssV, RttV); \ } while (0) +/* + * The following fWRAP macros are to speed up qemu + * We can add more over time + */ + +/* + * Add or subtract with carry. + * Predicate register is used as an extra input and output. + * r5:4 = add(r1:0, r3:2, p1):carry + */ +#define fWRAP_A4_addp_c(GENHLPR, SHORTCODE) \ + do { \ + TCGv LSB = tcg_temp_new(); \ + TCGv_i64 LSB_i64 = tcg_temp_new_i64(); \ + TCGv_i64 tmp_i64 = tcg_temp_new_i64(); \ + TCGv tmp = tcg_temp_new(); \ + tcg_gen_add_i64(RddV, RssV, RttV); \ + fLSBOLD(PxV); \ + tcg_gen_extu_i32_i64(LSB_i64, LSB); \ + tcg_gen_add_i64(RddV, RddV, LSB_i64); \ + fCARRY_FROM_ADD(RssV, RttV, LSB_i64); \ + tcg_gen_extrl_i64_i32(tmp, RssV); \ + f8BITSOF(PxV, tmp); \ + tcg_temp_free(LSB); \ + tcg_temp_free_i64(LSB_i64); \ + tcg_temp_free_i64(tmp_i64); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r5:4 = sub(r1:0, r3:2, p1):carry */ +#define fWRAP_A4_subp_c(GENHLPR, SHORTCODE) \ + do { \ + TCGv LSB = tcg_temp_new(); \ + TCGv_i64 LSB_i64 = tcg_temp_new_i64(); \ + TCGv_i64 tmp_i64 = tcg_temp_new_i64(); \ + TCGv tmp = tcg_temp_new(); \ + tcg_gen_not_i64(tmp_i64, RttV); \ + tcg_gen_add_i64(RddV, RssV, tmp_i64); \ + fLSBOLD(PxV); \ + tcg_gen_extu_i32_i64(LSB_i64, LSB); \ + tcg_gen_add_i64(RddV, RddV, LSB_i64); \ + fCARRY_FROM_ADD(RssV, tmp_i64, LSB_i64); \ + tcg_gen_extrl_i64_i32(tmp, RssV); \ + f8BITSOF(PxV, tmp); \ + tcg_temp_free(LSB); \ + tcg_temp_free_i64(LSB_i64); \ + tcg_temp_free_i64(tmp_i64); \ + tcg_temp_free(tmp); \ + } while (0) + +/* + * Compare each of the 8 unsigned bytes + * The minimum is places in each byte of the destination. + * Each bit of the predicate is set true if the bit from the first operand + * is greater than the bit from the second operand. + * r5:4,p1 = vminub(r1:0, r3:2) + */ +#define fWRAP_A6_vminub_RdP(GENHLPR, SHORTCODE) \ + do { \ + TCGv BYTE = tcg_temp_new(); \ + TCGv left = tcg_temp_new(); \ + TCGv right = tcg_temp_new(); \ + TCGv tmp = tcg_temp_new(); \ + int i; \ + tcg_gen_movi_tl(PeV, 0); \ + tcg_gen_movi_i64(RddV, 0); \ + for (i = 0; i < 8; i++) { \ + fGETUBYTE(i, RttV); \ + tcg_gen_mov_tl(left, BYTE); \ + fGETUBYTE(i, RssV); \ + tcg_gen_mov_tl(right, BYTE); \ + tcg_gen_setcond_tl(TCG_COND_GT, tmp, left, right); \ + fSETBIT(i, PeV, tmp); \ + fMIN(tmp, left, right); \ + fSETBYTE(i, RddV, tmp); \ + } \ + tcg_temp_free(BYTE); \ + tcg_temp_free(left); \ + tcg_temp_free(right); \ + tcg_temp_free(tmp); \ + } while (0) + +#define fWRAP_J2_call(GENHLPR, SHORTCODE) \ + gen_call(riV) +#define fWRAP_J2_callr(GENHLPR, SHORTCODE) \ + gen_callr(RsV) + +#define fWRAP_J2_loop0r(GENHLPR, SHORTCODE) \ + gen_loop0r(RsV, riV, insn) +#define fWRAP_J2_loop1r(GENHLPR, SHORTCODE) \ + gen_loop1r(RsV, riV, insn) + +#define fWRAP_J2_endloop0(GENHLPR, SHORTCODE) \ + gen_endloop0() +#define fWRAP_J2_endloop1(GENHLPR, SHORTCODE) \ + gen_endloop1() + #endif