From patchwork Fri Apr 26 17:24:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162953 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1008625jan; Fri, 26 Apr 2019 10:30:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9xuWBPQJbh279UqRMWEqYUc+zGdV4+djNIicisYe2P0rfNn/2+XeCmmJFCGsJPVhfM/fK X-Received: by 2002:a1c:6783:: with SMTP id b125mr8931177wmc.41.1556299818632; Fri, 26 Apr 2019 10:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556299818; cv=none; d=google.com; s=arc-20160816; b=iv6LCC0z9gTsvLb4CDGqh8fpxrGUCdrUzsF77nVmVPhaT9QmpxGSPTbFzecciPbVsf EvZoIzt/D9de4Oct+W2oOI2HCeeHloN5oD/ttAqnsPBcaaiCSlDFNhKcknXTzn+SKiAx nbAQWnQCk5He2zCcjsK5JmM9a4ZBV5TzzF13ZQZIqL0UGZ39IPXcTe15Ns+K8A+nZpSg waJiok4q5mcU53FxrIEQMeKnZ3SuOt2FUNg3Aut0ivqjUYyMLrQwTtiF4uYfPTK5eT3o JwdoI1AFsXur3W8ybyjh7fa02vwNAQBnODSOmw5Wcjp5z/BE8PzqgWN+LwRAuM8w5OsD WgXg== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=NUjDwC8rJFYEblahVxs6YiCANModiBNxtQ+zHc0oNPM=; b=L9Pjk7Q2K13M+wMb5qIlNBnijT74SCkcVK6qUFUmAIFK/nSDXEaJAt+6l7zwd3HxJx NKR3qH7hioeFVfhCB0P/9KjRtnexlSN/NDCJLJq/QGD9OwaF0uEDT73VeBLwADJpPxmt du+o9fqzZ+3NJeSV2iVKzouHv0TgyDFRDJj5zAEtHBTjd6C/s8PzxnLZVKwUAHQjjlN/ K9tFmbOfQ2jSgO7Fc1DHTZJvxIMsjHojJbeGVCLOXEV2b/tB3BgSHgnOasSuRU6qzbnZ J22T+61NCxFIW289DXJhzuiGBLjiHTwuGEk/9HCA+iAKch+pqwHN+w30XZ29zeDDjFVB j4gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XCyaTyYk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id v1si6282097wmc.1.2019.04.26.10.30.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 26 Apr 2019 10:30:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XCyaTyYk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:49993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hK4fx-00059h-Is for patch@linaro.org; Fri, 26 Apr 2019 13:30:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hK4aN-0008QG-CE for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hK4aM-0006KL-Dd for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:31 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:40739) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hK4aM-0006I7-7S for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:30 -0400 Received: by mail-pg1-x52d.google.com with SMTP id d31so1929522pgl.7 for ; Fri, 26 Apr 2019 10:24:30 -0700 (PDT) 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; bh=NUjDwC8rJFYEblahVxs6YiCANModiBNxtQ+zHc0oNPM=; b=XCyaTyYkv+JIF3rby6W/Z1TMey13mh7VXZDoUkH2SZsBSX9LOeO5Nd35mP5Kgt4oO/ jpiAGoZmQfZBWYXpke1v2CvdFBMNpFZ0ID/UOg1pvETx27woW0jO52PbCtQBl7WFZmSg u9bdPLQA0Inu54KHZx/rYDsiBEVleqw6KdnsPLXvayDVifEvTmpTQl4KnmJPbuapBjwI fNjv5TI2L49O9CTeKyjjHpYsctfpv5y1AaB8Y/SRl/VxbGoG75mmgpUU/UAdj2dQzg7/ +zjaZlqJgJmjRlzJqzxCHDlgwIwGI1ygkEGu6BLpKl+3z8rZtFud+prq8NSfBeuPA0os VhcQ== 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; bh=NUjDwC8rJFYEblahVxs6YiCANModiBNxtQ+zHc0oNPM=; b=daG5bAsFKsQrqs3V1WrQgDc5yOiUrO+ezzP11Wktdzmy38siNT8sDjYhq5/5hzRFfb VDd/11AOSTOPqFmEDSjYhzjngiRUFHg/GcYcFmpCeIG7NcozeReyUwQDzvOcndamC3uV pF0ASLbL+xPIKbosRfNenRwRxspJJvJT7HmrzkT0ptlQKTTR9MehVG+hO4o+0RH30H2v 4tOpmefAnwW72vGt310W8ConD9FCpSSwRFaXTjvygQ28ruvP2L0Lh1hAoPB0NYf7vqnt Sq5txowO+rq2Nc1BvKHzSFTbVG2bb5miWYYY01a0dtg2uZcXIZjVxJzF3hHuVwRFi/nc v8dw== X-Gm-Message-State: APjAAAUcslubNSkFGWNi7BAoPoL+mvX8BdY19ywk7akhylmUN15hzVLL yA6sbnPOLijisaaXY7Lg9APzugoOID0= X-Received: by 2002:a63:e045:: with SMTP id n5mr42541292pgj.230.1556299468293; Fri, 26 Apr 2019 10:24:28 -0700 (PDT) Received: from localhost.localdomain (97-113-179-147.tukw.qwest.net. [97.113.179.147]) by smtp.gmail.com with ESMTPSA id j5sm7901762pfg.186.2019.04.26.10.24.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 10:24:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2019 10:24:10 -0700 Message-Id: <20190426172421.27133-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190426172421.27133-1-richard.henderson@linaro.org> References: <20190426172421.27133-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52d Subject: [Qemu-devel] [PULL 04/15] tcg: Use extract2 in tcg_gen_deposit_{i32, i64} 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/tcg-op.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index fbc70649dd..a00d1df37e 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -611,9 +611,22 @@ void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2, return; } - mask = (1u << len) - 1; t1 = tcg_temp_new_i32(); + if (TCG_TARGET_HAS_extract2_i32) { + if (ofs + len == 32) { + tcg_gen_shli_i32(t1, arg1, len); + tcg_gen_extract2_i32(ret, t1, arg2, len); + goto done; + } + if (ofs == 0) { + tcg_gen_extract2_i32(ret, arg1, arg2, len); + tcg_gen_rotli_i32(ret, ret, len); + goto done; + } + } + + mask = (1u << len) - 1; if (ofs + len < 32) { tcg_gen_andi_i32(t1, arg2, mask); tcg_gen_shli_i32(t1, t1, ofs); @@ -622,7 +635,7 @@ void tcg_gen_deposit_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2, } tcg_gen_andi_i32(ret, arg1, ~(mask << ofs)); tcg_gen_or_i32(ret, ret, t1); - + done: tcg_temp_free_i32(t1); } @@ -2024,9 +2037,22 @@ void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2, } } - mask = (1ull << len) - 1; t1 = tcg_temp_new_i64(); + if (TCG_TARGET_HAS_extract2_i64) { + if (ofs + len == 64) { + tcg_gen_shli_i64(t1, arg1, len); + tcg_gen_extract2_i64(ret, t1, arg2, len); + goto done; + } + if (ofs == 0) { + tcg_gen_extract2_i64(ret, arg1, arg2, len); + tcg_gen_rotli_i64(ret, ret, len); + goto done; + } + } + + mask = (1ull << len) - 1; if (ofs + len < 64) { tcg_gen_andi_i64(t1, arg2, mask); tcg_gen_shli_i64(t1, t1, ofs); @@ -2035,7 +2061,7 @@ void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2, } tcg_gen_andi_i64(ret, arg1, ~(mask << ofs)); tcg_gen_or_i64(ret, ret, t1); - + done: tcg_temp_free_i64(t1); }