From patchwork Fri Feb 28 16:43:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 11412953 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 74518924 for ; Fri, 28 Feb 2020 17:10:22 +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 4BE4824691 for ; Fri, 28 Feb 2020 17:10:22 +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="Kz+AiOtK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BE4824691 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]:51016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7j9Z-0002mx-Aj for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Feb 2020 12:10:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58143) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7ilM-0004J8-NN for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7ilK-0006RS-GA for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:19 -0500 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:27026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7ikw-0005U4-38 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:45:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1582908294; x=1614444294; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hl3c1PPffgT0DZUEFvDjHJlbmHMk6/W2TQ7gMUsroKo=; b=Kz+AiOtKdYZsddYNGATrWtbav3kZA7x+si312lpirBSFmXM2t1y1WKez U35LwKOSq0Vk7iKgN80c4dH8JP5hArX6Tal5Evzj5EHKvz4ZUFOMtSimV rkL9inN6JJ6PDgEBXgzmDfY0cyTF3MxiwO4uz/B1GhBho7AqDFru1CtlI w=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Feb 2020 08:44:31 -0800 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 28 Feb 2020 08:44:31 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 062071110; Fri, 28 Feb 2020 10:44:31 -0600 (CST) From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 37/67] Hexagon TCG generation helpers - step 4 Date: Fri, 28 Feb 2020 10:43:33 -0600 Message-Id: <1582908244-304-38-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582908244-304-1-git-send-email-tsimpson@quicinc.com> References: <1582908244-304-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.39 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" Helpers referenced in macros.h Signed-off-by: Taylor Simpson --- target/hexagon/genptr_helpers.h | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/target/hexagon/genptr_helpers.h b/target/hexagon/genptr_helpers.h index 0e2d7b9..9917d72 100644 --- a/target/hexagon/genptr_helpers.h +++ b/target/hexagon/genptr_helpers.h @@ -463,4 +463,71 @@ static inline void gen_store8i(TCGv_env cpu_env, TCGv vaddr, int64_t src, tcg_temp_free_i64(tmp); } +static inline TCGv_i64 gen_carry_from_add64(TCGv_i64 result, TCGv_i64 a, + TCGv_i64 b, TCGv_i64 c) +{ + TCGv_i64 WORD = tcg_temp_new_i64(); + TCGv_i64 tmpa = tcg_temp_new_i64(); + TCGv_i64 tmpb = tcg_temp_new_i64(); + TCGv_i64 tmpc = tcg_temp_new_i64(); + + tcg_gen_mov_i64(tmpa, fGETUWORD(0, a)); + tcg_gen_mov_i64(tmpb, fGETUWORD(0, b)); + tcg_gen_add_i64(tmpc, tmpa, tmpb); + tcg_gen_add_i64(tmpc, tmpc, c); + tcg_gen_mov_i64(tmpa, fGETUWORD(1, a)); + tcg_gen_mov_i64(tmpb, fGETUWORD(1, b)); + tcg_gen_add_i64(tmpc, tmpa, tmpb); + tcg_gen_add_i64(tmpc, tmpc, fGETUWORD(1, tmpc)); + tcg_gen_mov_i64(result, fGETUWORD(1, tmpc)); + + tcg_temp_free_i64(WORD); + tcg_temp_free_i64(tmpa); + tcg_temp_free_i64(tmpb); + tcg_temp_free_i64(tmpc); + return result; +} + +static inline TCGv gen_8bitsof(TCGv result, TCGv value) +{ + TCGv zero = tcg_const_tl(0); + TCGv ones = tcg_const_tl(0xff); + tcg_gen_movcond_tl(TCG_COND_NE, result, value, zero, ones, zero); + tcg_temp_free(zero); + tcg_temp_free(ones); + + return result; +} + +static inline void gen_write_new_pc(TCGv addr) +{ + /* If there are multiple branches in a packet, ignore the second one */ + TCGv zero = tcg_const_tl(0); + tcg_gen_movcond_tl(TCG_COND_NE, hex_next_PC, hex_branch_taken, zero, + hex_next_PC, addr); + tcg_gen_movi_tl(hex_branch_taken, 1); + tcg_temp_free(zero); +} + +static inline void gen_set_usr_field(int field, TCGv val) +{ + tcg_gen_deposit_tl(hex_gpr[HEX_REG_USR], hex_gpr[HEX_REG_USR], val, + reg_field_info[field].offset, + reg_field_info[field].width); +} + +static inline void gen_set_usr_fieldi(int field, int x) +{ + TCGv val = tcg_const_tl(x); + gen_set_usr_field(field, val); + tcg_temp_free(val); +} + +static inline void gen_cond_return(TCGv pred, TCGv addr) +{ + TCGv zero = tcg_const_tl(0); + tcg_gen_movcond_tl(TCG_COND_NE, hex_next_PC, pred, zero, addr, hex_next_PC); + tcg_temp_free(zero); +} + #endif