From patchwork Sun Jul 14 11:12:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 168966 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3117493ilk; Sun, 14 Jul 2019 04:13:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4HSYkbBQgp62h6jiI96krn34Cz2Ap4ux0wXL/5HZySPIBsHkUSBgSlqr/jaWMt2Yk7NWG X-Received: by 2002:a50:fa05:: with SMTP id b5mr17643810edq.269.1563102799155; Sun, 14 Jul 2019 04:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563102799; cv=none; d=google.com; s=arc-20160816; b=JBMiZ6CUnyu85Y+5z4agnJA+3Pnd/Qmli7YfYg6rXwibGp64LiJ+Zc8/7uZnWQBcTy U5RMQcQ+RroQQJ1J3nbIwZfbIBQTfrb353NS5+4M4oaJWwbHD6IymQ12IQPoBNCSuDwL KS1Wzi5QtPd82nNAgCN/aAbpASnCJ6Z86hF1mFGXt8m1NLK9M0b7zzUeFbb1XSbVadkn 85Z1IebjhGAvTaPfiC9S+rhEGeswyFbJx6aAahUvF6iHILr8OA63UTkNSMIGqgDqhCgh CKN6NU0yIVxkNCCBRGJgztMj/oJYnFIjT4+BfZH7ZILjWTts+HNcgh2HOxfctHD54kE9 ln0A== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=QWcqefmxLRbmEUfSEqDtCzXI1bFjI9WN8pfzB0Jzwck=; b=G9EtNmJw9O3H3j8OPXVZPvEXbFyeRJZ5q0f7nLxtuZiQlEv+lT6yUCbW1h1lyj6Ybb PHlHH1VokgYsOj1Uqa26NF0ZX7clNOJhjm0lZUPXaRDptZrnVqZa01JAtMY8U5GGs/YB utmQqjWPR9wIRkZBazFwdHXv6IpGiqlGAqFWpPi0LwYZDOSUemFOi3so6LLbWLznI8JN DL4zMAWmeahjHPnGmnGUqUvEb4mn7epjM6OUTDjiP05UvpDO3e+jeLpugli4bcYEvTRN yMN6UZguc7d6OlLv5mHbmgOv9SjaRp0WrBz6g6HmR9SPi6HI6JwvBkYFsWpfLDzgwqMq ED6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yO8ROLXJ; 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 j33si8488303ede.413.2019.07.14.04.13.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jul 2019 04:13:19 -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=yO8ROLXJ; 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 ([::1]:59732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmcRQ-0005fg-Hy for patch@linaro.org; Sun, 14 Jul 2019 07:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60303) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmcR4-0005TY-ER for qemu-devel@nongnu.org; Sun, 14 Jul 2019 07:12:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmcR3-0006M8-9z for qemu-devel@nongnu.org; Sun, 14 Jul 2019 07:12:54 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hmcR3-0006Ld-3t for qemu-devel@nongnu.org; Sun, 14 Jul 2019 07:12:53 -0400 Received: by mail-wr1-x441.google.com with SMTP id n9so14202034wru.0 for ; Sun, 14 Jul 2019 04:12:53 -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 :mime-version:content-transfer-encoding; bh=QWcqefmxLRbmEUfSEqDtCzXI1bFjI9WN8pfzB0Jzwck=; b=yO8ROLXJyDL9A3nECDL4t13PvlssQCtGuq0AZBc8cK2TxiTHdE6FcIugdsxGumIdZq vD8r3BnSrk+8KZ10H/OYgWPHYjv2e/vk/pf7ciCyP6dkaxeappvffvQX6S9o3uiiGD2c v3qGaesrOoaA8OPOW1sde5O+snZNOtxe5SuqdsUAuvpvYPjb629vd4+bVwOZPwbrxkzP HAXk7mqtEkZhGz0iUutmniKhNf8mwd52WjaNzWbAszn/713VS6LEoRXQBp8jTQjr5ySj whR9bO+Gkcg2ChsOhGRlGAocd3s6n0+sC8KsS33Z27I4h6C9Yx9Y9ilZxeFBCCzZ7uWK NKsg== 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:mime-version:content-transfer-encoding; bh=QWcqefmxLRbmEUfSEqDtCzXI1bFjI9WN8pfzB0Jzwck=; b=YyrIUENhFGf/KFBCrxWBGxlkFEBHKbTexFLvEsQMkyU9TIXRgDNdRW7Nf+Pvb4yhu7 14B8YqZkpZ/imri41JP4paoRsaBKOfryrPIe/xsM0IK/cw1a/qrZf84cl3pgVvDeB30t Z5BJoJutfdbq09KddMDAKg4hSLILUgIiQVzlJYlhBhkpONkCof1E1R9qJaykJo7g4iE3 ArFv6MVDvCKfCoqm7YZkkWcxntNQyVHEN6HDN3O7apnOEguhrjixB2VOJU2CC5WK4UnS 8Jdod7UAbj/S6zXZKL2GkAL8cSaKX8OfI2/Tdj5P2nEf7ZBdn2RjEMHs5oBNE8nvmfpg MWEw== X-Gm-Message-State: APjAAAXhPoWyXI/U0WwGK+yEYF0myas1b7LPgFzqgDanholFTvFRtY+8 4Q1Ii60++HjQ8xwSA98RZiEEeHH7iI+4GA== X-Received: by 2002:a5d:42c5:: with SMTP id t5mr21875470wrr.5.1563102771773; Sun, 14 Jul 2019 04:12:51 -0700 (PDT) Received: from localhost.localdomain ([194.144.248.241]) by smtp.gmail.com with ESMTPSA id f17sm12675795wmf.27.2019.07.14.04.12.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 14 Jul 2019 04:12:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 14 Jul 2019 11:12:43 +0000 Message-Id: <20190714111249.13859-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714111249.13859-1-richard.henderson@linaro.org> References: <20190714111249.13859-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PULL for-4.1 1/7] tcg: Fix constant folding of INDEX_op_extract2_i32 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" On a 64-bit host, discard any replications of the 32-bit sign bit when performing the shift and merge. Fixes: https://bugs.launchpad.net/bugs/1834496 Tested-by: Christophe Lyon Tested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/optimize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/tcg/optimize.c b/tcg/optimize.c index d7c71a6085..d2424de4af 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1213,8 +1213,8 @@ void tcg_optimize(TCGContext *s) if (opc == INDEX_op_extract2_i64) { tmp = (v1 >> op->args[3]) | (v2 << (64 - op->args[3])); } else { - tmp = (v1 >> op->args[3]) | (v2 << (32 - op->args[3])); - tmp = (int32_t)tmp; + tmp = (int32_t)(((uint32_t)v1 >> op->args[3]) | + ((uint32_t)v2 << (32 - op->args[3]))); } tcg_opt_gen_movi(s, op, op->args[0], tmp); break;