From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80437 invoked by alias); 26 May 2017 09:06:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 80424 invoked by uid 89); 26 May 2017 09:06:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 May 2017 09:06:47 +0000 Received: by mail-oi0-f50.google.com with SMTP id l18so5630414oig.2 for ; Fri, 26 May 2017 02:06:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eOQ78+3fPL3SJYDZU8tIjPPvoMD8udmEkXIJJsvRrXs=; b=nObWVTENq6QcaYo97MDGsavGkyjgqB/vUrph87g5znnhqkUo3rxv7HwH/ugSgCmVW3 fh52CsAG0C6zvhwX+UinwlCMXY+yTHp/4RJdarWPisAn7wtDd9Fg7VZUCeMSLJSBqrdg sIjoBVNIs8r4q2DVJZHiq7u34FwM2+bZ2v8kplnJLCNEWqJ/Ukfv2CUHw6gkEZawPj2x gPrEDpmSLDiwkSk0VMcfxLZK3GTERJbttGf0eFP/Dy6Srf6Vhx+CsNISOQ/NA9giOXC1 sqoHvGEgBO3Auh87Su6rR1vkLN0RG5QXTDCCMcAA9GV4hcvdnob6OGPabglsaPC8KwA4 ED0w== X-Gm-Message-State: AODbwcCLL1wyvMPaVyHgdt1+t4KuYGt4gpCYB45fgdU+QUOXVgnCGvgl 6B/W+Wa1mAo4dzxtD51dxqHDurLiaQ== X-Received: by 10.202.205.196 with SMTP id d187mr423770oig.6.1495789608513; Fri, 26 May 2017 02:06:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.51.83 with HTTP; Fri, 26 May 2017 02:06:48 -0700 (PDT) In-Reply-To: References: From: Richard Biener Date: Fri, 26 May 2017 09:13:00 -0000 Message-ID: Subject: Re: [i386] __builtin_ia32_stmxcsr could be pure To: Marc Glisse Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg02013.txt.bz2 On Fri, May 26, 2017 at 10:55 AM, Marc Glisse wrote: > Hello, > > glibc marks fegetround as a pure function. On x86, people tend to use > _MM_GET_ROUNDING_MODE instead, which could benefit from the same. I think it > is safe, but a second opinion would be welcome. Sounds good. The important part is to keep the dependency to SET_ROUNDING_MODE which is done via claiming both touch global memory. > I could have handled just this builtin, but it seemed better to provide > def_builtin_pure (like "const" already has) since there should be other > builtins that can be marked this way (maybe the gathers?). Should work for gathers. They could even use stronger guarantees, namely a fnspec with "..R" (the pointer argument is only read from directly). Similarly scatter can use ".W" (the pointer argument is only written to directly). Richard. > Bootstrap+testsuite on x86_64-pc-linux-gnu with default languages. > > 2017-05-29 Marc Glisse > > gcc/ > * config/i386/i386.c (struct builtin_isa): New field pure_p. > Reorder for compactness. > (def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p. > (def_builtin_pure, def_builtin_pure2): New functions. > (ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure. > > gcc/testsuite/ > * gcc.target/i386/getround.c: New file. > > -- > Marc Glisse