From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24017 invoked by alias); 30 Jan 2013 10:36:50 -0000 Received: (qmail 23872 invoked by uid 22791); 30 Jan 2013 10:36:49 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f180.google.com (HELO mail-we0-f180.google.com) (74.125.82.180) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jan 2013 10:36:17 +0000 Received: by mail-we0-f180.google.com with SMTP id k14so1047325wer.39 for ; Wed, 30 Jan 2013 02:36:15 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.79.37 with SMTP id g5mr7777421wix.8.1359542175062; Wed, 30 Jan 2013 02:36:15 -0800 (PST) Received: by 10.194.179.130 with HTTP; Wed, 30 Jan 2013 02:36:14 -0800 (PST) In-Reply-To: <51082A51.9010501@gjlay.de> References: <50FD4297.1090107@gjlay.de> <51082A51.9010501@gjlay.de> Date: Wed, 30 Jan 2013 10:36:00 -0000 Message-ID: Subject: Re: [Patch] PR56064: Fold VIEW_CONVERT_EXPR with FIXED_CST, Take #2 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/msg01421.txt.bz2 On Tue, Jan 29, 2013 at 9:00 PM, Georg-Johann Lay wrote: > Richard Biener wrote: >> 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. > > Let me drop this, I don't like the name "const_fixed_from_double_int". It's > bad and I think "fixed_from_double_int" is better. Other constructor-like > functions for FIXED_VALUE_TYPE use fixed_from_* whereas const_fixed_* returns a > CONST_FIXED rtx. > > This is less confusing and fits better the naming convention. > > The new patch also adds const_fixed_from_double_int that actually returns a > CONST_FIXED rtx. It's unused, but I would use it in the avr back. > > Okay with that rename? (Or, at your option, without const_fixed_from_double_int). Ok. Thanks, Richard. > Johann > > > PR tree-optimization/56064 > * fixed-value.c (fixed_from_double_int): New function. > * fixed-value.h (fixed_from_double_int): New prototype. > (const_fixed_from_double_int): New static inline function. > * 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. > > > >> >>> 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. >> >