From patchwork Wed Dec 20 13:00:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 122465 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5537202qgn; Wed, 20 Dec 2017 05:00:44 -0800 (PST) X-Google-Smtp-Source: ACJfBosQWeX8EWakaQFJFq/eIVgoJP13bBwWYy+2ztMw0lKnzh/KsFgypxsPNHaK6mDf1PgSfkRj X-Received: by 10.98.16.90 with SMTP id y87mr6947339pfi.116.1513774844501; Wed, 20 Dec 2017 05:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513774844; cv=none; d=google.com; s=arc-20160816; b=LY6TCbJy17GGXM21B+JAqlIKNz6esLNA0rakAjy/71rT9rOso3UTGpRy+ZSoConVls uDe95YNcSdvtBCgf3r9/rJTUjrHLoryEot0vheohaU+AKtDBqTD01WMHrtXOdEzJKEWF 4rtBhAHdoLRQOAisGI9rDHBZgpGcvbEfsuu74SJx8cWrGx6n6PLOC+GeoX9DXDVe/5EK E1l9iXiLVB7JgVBpSetgbwi1DXHIA2qk3YGRg+n+FqwtD3jcFDqujJPhu0C8ek5ew0bF NvBpruf72fy85VJVQLLvGsLPF9IJHw0JecZ7iNDg1X1JqWCA8Ji0ibJ7Pf90LPGNWc6o Fw0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=6IGy1QIJe0CGHzOvHX+yAR8NUxxFploNghGDoY8wtz0=; b=NDyRMuHihpCn8DbA3adAekKXwlKzt8jpnlr6ukSfomvd519lLYXJdC6qZZNrWjokf9 N4gsNpsjok+IyZ8XMTiXgp2CAA8CcjlQDhPlj16vUZ5tqKZm9WGynPLnXPJTpkZbKLbL pbcLsDw1QB3HJ/KYSWfitlfBYLrNVjtK/06LyC66x/pyX7oL6nwDHUO06FH6QN7bYLlb JTLyP2XstnEqj6O7koS9izUw6JZxAbWeEm/yp4knG7VcAmuadgtGizgxGXrK8mhSDUma 2MfTO5Ep8MywStryHR45XPSzpemWpGK44+wn/65v7rsd1dHwOUFIt6nbdIwNgVufjvRc secQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KslaHVDt; spf=pass (google.com: domain of gcc-patches-return-469650-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-469650-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 98si12748158pls.543.2017.12.20.05.00.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 05:00:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-469650-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KslaHVDt; spf=pass (google.com: domain of gcc-patches-return-469650-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-469650-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=Xw4yt1SbRSLsy7GaA76FH5k9Hy6Bf5YEdBhAViKf8yBFQigWlTSbn D5V9QWtl2orPVzPhhtv/jUkkh7U127IyRscFPf20d3Z8qmrsYyhRzJU1PHvKYf9D 7ZEYQU3UPecacRXc2p9yjISWu2uIFQSb0jusUON+ZVVwos/d7FP+NI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=2a3v0S6vFqjrS0k9vKqF1xPqkmY=; b=KslaHVDtalOQ3/jdVFCN iOM5bVqoMf3SjUNKoPZ6QKlvWCRKM1Np4Pw0cn8rNrQJLHVn2J2FN85Ddqlxghkd /gzMW/nMW75u4wXCu8egsFQeVNG+FtlgfJDwdKgenmSl2uO9dg7HCIhvUAC5ndCd RXKesQv1bqq8V4NXUR5JCYg= Received: (qmail 83599 invoked by alias); 20 Dec 2017 13:00:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 83438 invoked by uid 89); 20 Dec 2017 13:00:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f182.google.com Received: from mail-wr0-f182.google.com (HELO mail-wr0-f182.google.com) (209.85.128.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Dec 2017 13:00:15 +0000 Received: by mail-wr0-f182.google.com with SMTP id o2so22203740wro.5 for ; Wed, 20 Dec 2017 05:00:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=6IGy1QIJe0CGHzOvHX+yAR8NUxxFploNghGDoY8wtz0=; b=a3pHdRYP3F06oYZpyWMCPGRvnqwl6qcSFf/TdKcVOBZV864CF2djnA1Yf+U1s/f87w CJBw4AjV7pUAZUui/KLm7I+2A3xY5fFuzYOXPaHTl1/xYySV8iDIW4ZBGi/JEcwfE7N9 0eQpglbli4r9zjQ+/k2dnPPtF/Mzgj+nN1ukrlDaXbMfz/vv407HM3Y6XQ9p6zfaJ11f dbBTohz/x4tOLIR3xppd8YAPs9MEUzRSNenKKHfa0aJhGB2z2L7HITV+7PKoc6FKYXN7 GlFMHZ6+FJccHACOl9/p0R+0Yda23TXF9i8QnpvlvIUAPXGOjRP3opuPZnRqnwl39EpK BUcQ== X-Gm-Message-State: AKGB3mK4d20fGJbxh8sOpPjziwIVc7gtPfbUlg4LklGsih7zhbtXNCqJ FkMf7Vu+bG5VV9mrA46zH/G4CwsyUjU= X-Received: by 10.223.135.59 with SMTP id a56mr8290206wra.173.1513774810759; Wed, 20 Dec 2017 05:00:10 -0800 (PST) Received: from localhost ([2.25.234.26]) by smtp.gmail.com with ESMTPSA id 30sm8026381wrl.22.2017.12.20.05.00.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Dec 2017 05:00:09 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [committed] Fix multiple_p for two non-poly_ints Date: Wed, 20 Dec 2017 13:00:09 +0000 Message-ID: <878tdx367a.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Fix a stupid inversion. This function is very rarely used and was mostly to help split patches up, which is why it didn't get picked up during initial testing. Sorry for the mistake. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64-linux-gnu. Applied as obvious. Richard 2017-12-20 Richard Sandiford gcc/ * poly-int.h (multiple_p): Fix handling of two non-poly_ints. gcc/testsuite/ * gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New function. (test_nonpoly_type): Call it. Index: gcc/poly-int.h =================================================================== --- gcc/poly-int.h 2017-12-20 08:55:30.768462429 +0000 +++ gcc/poly-int.h 2017-12-20 08:55:55.911492315 +0000 @@ -2027,7 +2027,7 @@ constant_multiple_p (const poly_int_pod< inline typename if_nonpoly2::type multiple_p (Ca a, Cb b) { - return a % b != 0; + return a % b == 0; } /* Return true if A is a (polynomial) multiple of B. */ Index: gcc/testsuite/gcc.dg/plugin/poly-int-tests.h =================================================================== --- gcc/testsuite/gcc.dg/plugin/poly-int-tests.h 2017-12-14 00:05:54.955021396 +0000 +++ gcc/testsuite/gcc.dg/plugin/poly-int-tests.h 2017-12-20 08:55:55.912492276 +0000 @@ -4505,6 +4505,19 @@ test_uhwi () wi::uhwi (210, 16))); } +/* Test multiple_p for non-polynomial T. */ + +template +static void +test_nonpoly_multiple_p () +{ + ASSERT_TRUE (multiple_p (T (6), T (2))); + ASSERT_TRUE (multiple_p (T (6), T (3))); + ASSERT_FALSE (multiple_p (T (6), T (4))); + ASSERT_FALSE (multiple_p (T (7), T (4))); + ASSERT_TRUE (multiple_p (T (8), T (4))); +} + /* Test known_size_p for non-polynomial T. */ template @@ -4523,6 +4536,7 @@ test_nonpoly_known_size_p () static void test_nonpoly_type () { + test_nonpoly_multiple_p (); test_nonpoly_known_size_p (); }