From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16611 invoked by alias); 29 Jan 2013 11:27:02 -0000 Received: (qmail 16600 invoked by uid 22791); 29 Jan 2013 11:27:01 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wi0-f170.google.com (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 29 Jan 2013 11:26:57 +0000 Received: by mail-wi0-f170.google.com with SMTP id cb5so1615417wib.5 for ; Tue, 29 Jan 2013 03:26:56 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.174.234 with SMTP id bv10mr1621411wjc.47.1359458807241; Tue, 29 Jan 2013 03:26:47 -0800 (PST) Received: by 10.194.179.130 with HTTP; Tue, 29 Jan 2013 03:26:47 -0800 (PST) In-Reply-To: <50FD4297.1090107@gjlay.de> References: <50FD4297.1090107@gjlay.de> Date: Tue, 29 Jan 2013 11:27:00 -0000 Message-ID: Subject: Re: [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST From: Richard Biener To: Georg-Johann Lay Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2013-01/txt/msg01365.txt.bz2 On Mon, Jan 21, 2013 at 2:28 PM, Georg-Johann Lay wrote: > This is tentative patch as discussed in > > http://gcc.gnu.org/ml/gcc/2013-01/msg00187.html > > fold-const.c gets 2 new function native_encode_fixed and > native_interpret_fixed. Code common with the integer case is factored out and > moved to the new constructor-like function double_int::from_buffer. > > The code bootstraps fine on x86-linux-gnu and I have test coverage from > avr-unknown-none. > > Ok to apply? Ok. Thanks, Richard. > There are less intrusive solutions that only handle the int <-> fixed cases, > for example fold-const.c:fold_view_convert_expr() could test for these cases > and use double_int directly without serializing / deserializing through a > memory buffer. > > Johann > > > PR tree-optimization/56064 > * fixed-value.c (const_fixed_from_double_int): New function. > * fixed-value.h (const_fixed_from_double_int): New prototype. > * fold-const.c (native_interpret_fixed): New static function. > (native_interpret_expr) : Use it. > (can_native_interpret_type_p) : Return true. > (native_encode_fixed): New static function. > (native_encode_expr) : Use it. > (native_interpret_int): Move double_int worker code to... > * double-int.c (double_int::from_buffer): ...this new static method. > * double-int.h (double_int::from_buffer): Prototype it. > > testsuite/ > PR tree-optimization/56064 > * gcc.dg/fixed-point/view-convert.c: New test.