From patchwork Fri Aug 12 12:04:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 73846 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp138254qga; Fri, 12 Aug 2016 05:05:07 -0700 (PDT) X-Received: by 10.98.147.156 with SMTP id r28mr26704520pfk.154.1471003507389; Fri, 12 Aug 2016 05:05:07 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id x69si8683933pfi.273.2016.08.12.05.05.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Aug 2016 05:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-433890-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; spf=pass (google.com: domain of gcc-patches-return-433890-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-433890-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=nfIQH2J7slto3xL 5LV/B8UxtMfzpfsxfzkG6hCmWhkjlj6r3CCDYlpdOH9eKIC0nO+bBX+jZXcC2UdF WX3FiW/ABsfGnNUJ6s0XwfC1hHBBlhr3bYykAVKHmsNfO9PFfZmGNUkYU2w8PhQV UrvXbSzYaksQ6Xkj4VX0tyAziJ3Y= 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 :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; s=default; bh=bXWgc6QEVUuAg8gFOuJiP 38+ui4=; b=tUlMcaWrPtsGdPAcTd5glHtwx2Xw1hspE8sr5PmKek3pfhnCxaoD/ 5ottJ0NRXWe8buCYsdLrkCboYkEOXr0hHoL4HqcSdeGy6AmZyZsYx/xe/f32mRem Jw87vjsg/3jpDE8ioWSVQX1SW6BC5uVeiCGmrNh7O3/J+NNGsok+Bg= Received: (qmail 120661 invoked by alias); 12 Aug 2016 12:04:52 -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 120635 invoked by uid 89); 12 Aug 2016 12:04:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=MOD, UNKNOWN X-HELO: mail-it0-f50.google.com Received: from mail-it0-f50.google.com (HELO mail-it0-f50.google.com) (209.85.214.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Aug 2016 12:04:36 +0000 Received: by mail-it0-f50.google.com with SMTP id u186so9959494ita.0 for ; Fri, 12 Aug 2016 05:04:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cCNPEiGlT2/zbRxsHnzXzI+RRRFJv/z2TqRulu7VS9k=; b=ZZZ9SQmrNvMeG3yntsD/Mkd5uOJWaDy6IycOpfxV/tIeXNRswCztBVQcpv7ccUctpT 6RR24n0bJ9wJUGbpLt0NB75w1y/IVWFVs+oLpSPxhZxZ4Tj20IIVgmLAq7R3NujKePly Eo6A4OKChqiEXgH1rWzWHW5a8gUV74hqJ0qC6DX0m4EBSl6lep/4BB1v9+V+4sheFxdn vLOClBNYjdI77yZmobvhuYsYiipjNtIQmZk/uSLH52KDSJxYG/qRyaN2bacurKOLQyqr yejCBsS9GqG8heiofULOVZBI9GrFbqgOxVJZ8wFDri7+lXl4tFvF94zYXUMKGQKFxxTf 4+Lg== X-Gm-Message-State: AEkoouvz6+lqg72UAkrgS2GuZmGk79BZB/gJ9gDiCQWsPlOqTEGbUNXjpVGnbQvPJfbg2JcL3Ja4HDQkwu+9PRXi X-Received: by 10.36.40.144 with SMTP id h138mr2946410ith.31.1471003474905; Fri, 12 Aug 2016 05:04:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.208.18 with HTTP; Fri, 12 Aug 2016 05:04:34 -0700 (PDT) In-Reply-To: References: <79c18b59-6335-e307-53e0-98c0bb2bab2f@redhat.com> From: Prathamesh Kulkarni Date: Fri, 12 Aug 2016 17:34:34 +0530 Message-ID: Subject: Re: divmod transform: add test-cases To: Richard Biener Cc: Jeff Law , Kugan Vivekanandarajah , Jim Wilson , Ramana Radhakrishnan , gcc Patches X-IsSubscribed: yes On 12 August 2016 at 12:47, Richard Biener wrote: > On Thu, 11 Aug 2016, Jeff Law wrote: > >> On 08/09/2016 04:58 AM, Prathamesh Kulkarni wrote: >> > ping https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01869.html >> This seems to be dependent upon other patches, this is not OK until all >> prereqs are resolved. >> >> You're using SI/DI in the descriptions, but then using more traditional C >> types like int, unsigned, long long in the actual test. >> >> If you intent is really to nail down SI/DI mode testing, then the way to go >> will be to define typedefs that correspond directly to SI and DI modes: >> >> typedef unsigned int u32 __attribute__((mode(SI))); >> typedef signed int s32 __attribute__((mode(SI))); >> >> You can do something similar for DImode. >> >> It may not matter because of your effective-target {divmod,divmod_simode} >> selectors, but it still seems cleaner. >> >> With that change, this is OK when its prereqs are resolved. > > Note that for the main patch I don't like the current state of the > divmod libcall issue. I think we need to solve this in a more > reasonable manner and not expose this oddness to a GIMPLE level pass. > > Any ideas welcome - I don't have a very good one :/ > > The best idea I have is to not lie about libfunc availability in > the optab handler. Hi, In the attached patch I set libfunc entry for sdivmod_optab to NULL and verified that optab_libfunc (sdivmod_optab, DImode) returns NULL_RTX if it's not overriden by the target. AFAIU this issue could be latent in expand_twoval_binop_libfunc, and apparently never got triggered for the default case, where target doesn't override optab_libfunc (sdivmod_optab, DImode) else it could have generated call to __divmoddi4() which doesn't exist Bootstrapped and tested on ppc64le-linux-gnu, Cross-tested on arm*-*-*, aarch64*-*-*. Bootstrap+test in progress on x86_64-unknown-linux-gnu. OK to commit if passes ? Thanks, Prathamesh > > Richard. diff --git a/gcc/optabs.def b/gcc/optabs.def index 8875e30..305f8c0 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -116,7 +116,7 @@ OPTAB_NL(ssdiv_optab, "ssdiv$Q$a3", SS_DIV, "ssdiv", '3', gen_signed_fixed_libfu OPTAB_NL(udiv_optab, "udiv$I$a3", UDIV, "udiv", '3', gen_int_unsigned_fixed_libfunc) OPTAB_NX(udiv_optab, "udiv$Q$a3") OPTAB_NL(usdiv_optab, "usdiv$Q$a3", US_DIV, "usdiv", '3', gen_unsigned_fixed_libfunc) -OPTAB_NL(sdivmod_optab, "divmod$a4", UNKNOWN, "divmod", '4', gen_int_libfunc) +OPTAB_NL(sdivmod_optab, "divmod$a4", UNKNOWN, "divmod", '4', NULL) OPTAB_NL(udivmod_optab, "udivmod$a4", UNKNOWN, "udivmod", '4', gen_int_libfunc) OPTAB_NL(smod_optab, "mod$a3", MOD, "mod", '3', gen_int_libfunc) OPTAB_NL(umod_optab, "umod$a3", UMOD, "umod", '3', gen_int_libfunc)