From nobody Tue Feb 10 05:44:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581382770903731.1462173599907; Mon, 10 Feb 2020 16:59:30 -0800 (PST) Received: from localhost ([::1]:41788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1Jth-0004io-EZ for importer@patchew.org; Mon, 10 Feb 2020 19:59:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33600) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1Jcf-0002BN-2j for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1Jcd-0000qc-0p for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:52 -0500 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:3639) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1Jcc-0004qc-Kg for qemu-devel@nongnu.org; Mon, 10 Feb 2020 19:41:50 -0500 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) 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 ironmsg01-sd.qualcomm.com with ESMTP; 10 Feb 2020 16:41:01 -0800 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id D803D1BB2; Mon, 10 Feb 2020 18:41:01 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1581381710; x=1612917710; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2pmGeTEVS2eLtFrkbjY0IdbS79XZMQ/6ufQSL15EcWg=; b=QsxFZPTqjq2UhdsosNnha/r5KIbCxotfc997La42fzLYL7ZACGexIHm9 vJUb10j4rsbL70l9L0I3RKL9ZH/swm4CrunJoaj5mphrm2nfWQCkg3VWm IPBnsvIfEz+BS24mqF6NIn48ekauqWumryCswXa/PrMDD0enrFNjBB7v8 g=; From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [RFC PATCH 49/66] Hexagon TCG generation - step 12 Date: Mon, 10 Feb 2020 18:40:27 -0600 Message-Id: <1581381644-13678-50-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Override miscellaneous instructions identified during profiling Signed-off-by: Taylor Simpson --- target/hexagon/helper_overrides.h | 296 ++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 296 insertions(+) diff --git a/target/hexagon/helper_overrides.h b/target/hexagon/helper_over= rides.h index 259716f..d13a878 100644 --- a/target/hexagon/helper_overrides.h +++ b/target/hexagon/helper_overrides.h @@ -1551,4 +1551,300 @@ #define fWRAP_J2_jumptnewpt(GENHLPR, SHORTCODE) \ gen_cond_jump(PuN, riV) =20 +/* + * New value compare & jump instructions + * if ([!]COND(r0.new, r1) jump:t address + * if ([!]COND(r0.new, #7) jump:t address + */ +#define fWRAP_J4_cmpgt_f_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_LE, NsX, RtV, riV) +#define fWRAP_J4_cmpeq_f_jumpnv_nt(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_NE, NsX, RtV, riV) +#define fWRAP_J4_cmpgt_t_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_GT, NsX, RtV, riV) +#define fWRAP_J4_cmpeqi_t_jumpnv_nt(GENHLPR, SHORTCODE) \ + gen_cmpi_jumpnv(TCG_COND_EQ, NsX, UiV, riV) +#define fWRAP_J4_cmpltu_f_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_GEU, NsX, RtV, riV) +#define fWRAP_J4_cmpgtui_t_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmpi_jumpnv(TCG_COND_GTU, NsX, UiV, riV) +#define fWRAP_J4_cmpeq_f_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_NE, NsX, RtV, riV) +#define fWRAP_J4_cmpeqi_f_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmpi_jumpnv(TCG_COND_NE, NsX, UiV, riV) +#define fWRAP_J4_cmpgtu_t_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_GTU, NsX, RtV, riV) +#define fWRAP_J4_cmpgtu_f_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_LEU, NsX, RtV, riV) +#define fWRAP_J4_cmplt_t_jumpnv_t(GENHLPR, SHORTCODE) \ + gen_cmp_jumpnv(TCG_COND_LT, NsX, RtV, riV) + +/* r0 =3D r1 ; jump address */ +#define fWRAP_J4_jumpsetr(GENHLPR, SHORTCODE) \ + do { \ + tcg_gen_mov_tl(RdV, RsV); \ + gen_jump(riV); \ + } while (0) + +/* r0 =3D lsr(r1, #5) */ +#define fWRAP_S2_lsr_i_r(GENHLPR, SHORTCODE) \ + fLSHIFTR(RdV, RsV, IMMNO(0), 4_4) + +/* r0 +=3D lsr(r1, #5) */ +#define fWRAP_S2_lsr_i_r_acc(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + fLSHIFTR(tmp, RsV, IMMNO(0), 4_4); \ + tcg_gen_add_tl(RxV, RxV, tmp); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 ^=3D lsr(r1, #5) */ +#define fWRAP_S2_lsr_i_r_xacc(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + fLSHIFTR(tmp, RsV, IMMNO(0), 4_4); \ + tcg_gen_xor_tl(RxV, RxV, tmp); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 =3D asr(r1, #5) */ +#define fWRAP_S2_asr_i_r(GENHLPR, SHORTCODE) \ + fASHIFTR(RdV, RsV, IMMNO(0), 4_4) + +/* r0 =3D addasl(r1, r2, #3) */ +#define fWRAP_S2_addasl_rrri(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + fASHIFTL(tmp, RsV, IMMNO(0), 4_4); \ + tcg_gen_add_tl(RdV, RtV, tmp); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 |=3D asl(r1, r2) */ +#define fWRAP_S2_asl_r_r_or(GENHLPR, SHORTCODE) \ + gen_asl_r_r_or(RxV, RsV, RtV) + +/* r0 =3D asl(r1, #5) */ +#define fWRAP_S2_asl_i_r(GENHLPR, SHORTCODE) \ + fASHIFTL(RdV, RsV, IMMNO(0), 4_4) + +/* r0 |=3D asl(r1, #5) */ +#define fWRAP_S2_asl_i_r_or(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + fASHIFTL(tmp, RsV, IMMNO(0), 4_4); \ + tcg_gen_or_tl(RxV, RxV, tmp); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 =3D vsplatb(r1) */ +#define fWRAP_S2_vsplatrb(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + int i; \ + tcg_gen_movi_tl(RdV, 0); \ + tcg_gen_andi_tl(tmp, RsV, 0xff); \ + for (i =3D 0; i < 4; i++) { \ + tcg_gen_shli_tl(RdV, RdV, 8); \ + tcg_gen_or_tl(RdV, RdV, tmp); \ + } \ + tcg_temp_free(tmp); \ + } while (0) + +#define fWRAP_SA1_seti(GENHLPR, SHORTCODE) \ + tcg_gen_movi_tl(RdV, IMMNO(0)) + +#define fWRAP_S2_insert(GENHLPR, SHORTCODE) \ + tcg_gen_deposit_i32(RxV, RxV, RsV, IMMNO(1), IMMNO(0)) + +#define fWRAP_S2_extractu(GENHLPR, SHORTCODE) \ + tcg_gen_extract_i32(RdV, RsV, IMMNO(1), IMMNO(0)) + +#define fWRAP_A2_combinew(GENHLPR, SHORTCODE) \ + tcg_gen_concat_i32_i64(RddV, RtV, RsV) +#define fWRAP_A2_combineii(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp_lo =3D tcg_const_tl(SiV); \ + TCGv tmp_hi =3D tcg_const_tl(siV); \ + tcg_gen_concat_i32_i64(RddV, tmp_lo, tmp_hi); \ + tcg_temp_free(tmp_lo); \ + tcg_temp_free(tmp_hi); \ + } while (0) +#define fWRAP_A4_combineri(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp_lo =3D tcg_const_tl(siV); \ + tcg_gen_concat_i32_i64(RddV, tmp_lo, RsV); \ + tcg_temp_free(tmp_lo); \ + } while (0) +#define fWRAP_A4_combineir(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp_hi =3D tcg_const_tl(siV); \ + tcg_gen_concat_i32_i64(RddV, RsV, tmp_hi); \ + tcg_temp_free(tmp_hi); \ + } while (0) +#define fWRAP_A4_combineii(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp_lo =3D tcg_const_tl(UiV); \ + TCGv tmp_hi =3D tcg_const_tl(siV); \ + tcg_gen_concat_i32_i64(RddV, tmp_lo, tmp_hi); \ + tcg_temp_free(tmp_lo); \ + tcg_temp_free(tmp_hi); \ + } while (0) + +#define fWRAP_SA1_combine0i(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp_lo =3D tcg_const_tl(uiV); \ + TCGv zero =3D tcg_const_tl(0); \ + tcg_gen_concat_i32_i64(RddV, tmp_lo, zero); \ + tcg_temp_free(tmp_lo); \ + tcg_temp_free(zero); \ + } while (0) + +/* r0 =3D or(#8, asl(r1, #5)) */ +#define fWRAP_S4_ori_asl_ri(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + tcg_gen_shli_tl(tmp, RxV, IMMNO(1)); \ + tcg_gen_ori_tl(RxV, tmp, IMMNO(0)); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 =3D add(r1, sub(#6, r2)) */ +#define fWRAP_S4_subaddi(GENHLPR, SHORTCODE) \ + do { \ + tcg_gen_sub_tl(RdV, RsV, RuV); \ + tcg_gen_addi_tl(RdV, RdV, IMMNO(0)); \ + } while (0) + +#define fWRAP_SA1_inc(GENHLPR, SHORTCODE) \ + tcg_gen_addi_tl(RdV, RsV, 1) + +#define fWRAP_SA1_dec(GENHLPR, SHORTCODE) \ + tcg_gen_subi_tl(RdV, RsV, 1) + +/* if (p0.new) r0 =3D #0 */ +#define fWRAP_SA1_clrtnew(GENHLPR, SHORTCODE) \ + do { \ + TCGv mask =3D tcg_temp_new(); \ + TCGv zero =3D tcg_const_tl(0); \ + tcg_gen_movi_tl(RdV, 0); \ + tcg_gen_movi_tl(mask, 1 << insn->slot); \ + tcg_gen_or_tl(mask, hex_slot_cancelled, mask); \ + tcg_gen_movcond_tl(TCG_COND_EQ, hex_slot_cancelled, \ + hex_new_pred_value[0], zero, \ + mask, hex_slot_cancelled); \ + tcg_temp_free(mask); \ + tcg_temp_free(zero); \ + } while (0) + +/* r0 =3D add(r1 , mpyi(#6, r2)) */ +#define fWRAP_M4_mpyri_addr_u2(GENHLPR, SHORTCODE) \ + do { \ + tcg_gen_muli_tl(RdV, RsV, IMMNO(0)); \ + tcg_gen_add_tl(RdV, RuV, RdV); \ + } while (0) + +/* Predicated add instructions */ +#define WRAP_padd(PRED, ADD) \ + do { \ + TCGv LSB =3D tcg_temp_new(); \ + TCGv mask =3D tcg_temp_new(); \ + TCGv zero =3D tcg_const_tl(0); \ + PRED; \ + ADD; \ + tcg_gen_movi_tl(mask, 1 << insn->slot); \ + tcg_gen_or_tl(mask, hex_slot_cancelled, mask); \ + tcg_gen_movcond_tl(TCG_COND_NE, hex_slot_cancelled, LSB, zero, \ + hex_slot_cancelled, mask); \ + tcg_temp_free(LSB); \ + tcg_temp_free(mask); \ + tcg_temp_free(zero); \ + } while (0) + +#define fWRAP_A2_paddt(GENHLPR, SHORTCODE) \ + WRAP_padd(fLSBOLD(PuV), tcg_gen_add_tl(RdV, RsV, RtV)) +#define fWRAP_A2_paddf(GENHLPR, SHORTCODE) \ + WRAP_padd(fLSBOLDNOT(PuV), tcg_gen_add_tl(RdV, RsV, RtV)) +#define fWRAP_A2_paddit(GENHLPR, SHORTCODE) \ + WRAP_padd(fLSBOLD(PuV), tcg_gen_addi_tl(RdV, RsV, IMMNO(0))) +#define fWRAP_A2_paddif(GENHLPR, SHORTCODE) \ + WRAP_padd(fLSBOLDNOT(PuV), tcg_gen_addi_tl(RdV, RsV, IMMNO(0))) +#define fWRAP_A2_padditnew(GENHLPR, SHORTCODE) \ + WRAP_padd(fLSBNEW(PuN), tcg_gen_addi_tl(RdV, RsV, IMMNO(0))) + +/* Conditional move instructions */ +#define fWRAP_COND_MOVE(VAL, COND) \ + do { \ + TCGv LSB =3D tcg_temp_new(); \ + TCGv zero =3D tcg_const_tl(0); \ + TCGv mask =3D tcg_temp_new(); \ + TCGv value =3D tcg_const_tl(siV); \ + VAL; \ + tcg_gen_movcond_tl(COND, RdV, LSB, zero, value, zero); \ + tcg_gen_movi_tl(mask, 1 << insn->slot); \ + tcg_gen_movcond_tl(TCG_COND_EQ, mask, LSB, zero, mask, zero); \ + tcg_gen_or_tl(hex_slot_cancelled, hex_slot_cancelled, mask); \ + tcg_temp_free(LSB); \ + tcg_temp_free(zero); \ + tcg_temp_free(mask); \ + tcg_temp_free(value); \ + } while (0) + +#define fWRAP_C2_cmoveit(GENHLPR, SHORTCODE) \ + fWRAP_COND_MOVE(fLSBOLD(PuV), TCG_COND_NE) +#define fWRAP_C2_cmovenewit(GENHLPR, SHORTCODE) \ + fWRAP_COND_MOVE(fLSBNEW(PuN), TCG_COND_NE) +#define fWRAP_C2_cmovenewif(GENHLPR, SHORTCODE) \ + fWRAP_COND_MOVE(fLSBNEWNOT(PuN), TCG_COND_NE) + +/* p0 =3D tstbit(r0, #5) */ +#define fWRAP_S2_tstbit_i(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + tcg_gen_andi_tl(tmp, RsV, (1 << IMMNO(0))); \ + gen_8bitsof(PdV, tmp); \ + tcg_temp_free(tmp); \ + } while (0) + +/* p0 =3D !tstbit(r0, #5) */ +#define fWRAP_S4_ntstbit_i(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + tcg_gen_andi_tl(tmp, RsV, (1 << IMMNO(0))); \ + gen_8bitsof(PdV, tmp); \ + tcg_gen_xori_tl(PdV, PdV, 0xff); \ + tcg_temp_free(tmp); \ + } while (0) + +/* r0 =3D setbit(r1, #5) */ +#define fWRAP_S2_setbit_i(GENHLPR, SHORTCODE) \ + tcg_gen_ori_tl(RdV, RsV, 1 << IMMNO(0)) + +/* r0 +=3D add(r1, #8) */ +#define fWRAP_M2_accii(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + tcg_gen_add_tl(tmp, RxV, RsV); \ + tcg_gen_addi_tl(RxV, tmp, IMMNO(0)); \ + tcg_temp_free(tmp); \ + } while (0) + +/* p0 =3D bitsclr(r1, #6) */ +#define fWRAP_C2_bitsclri(GENHLPR, SHORTCODE) \ + do { \ + TCGv tmp =3D tcg_temp_new(); \ + TCGv zero =3D tcg_const_tl(0); \ + tcg_gen_andi_tl(tmp, RsV, IMMNO(0)); \ + gen_compare(TCG_COND_EQ, PdV, tmp, zero); \ + tcg_temp_free(tmp); \ + tcg_temp_free(zero); \ + } while (0) + +#define fWRAP_SL2_jumpr31(GENHLPR, SHORTCODE) \ + gen_write_new_pc(hex_gpr[HEX_REG_LR]) + +#define fWRAP_SL2_jumpr31_tnew(GENHLPR, SHORTCODE) \ + gen_cond_jumpr(hex_new_pred_value[0], hex_gpr[HEX_REG_LR]) + #endif --=20 2.7.4