From patchwork Wed Mar 14 23:15:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 146767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A450FB6EEA for ; Thu, 15 Mar 2012 10:15:57 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332371757; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=23zKwL256hZATk17n5wxLRLfm6A=; b=XlO7T9t3kgcRied mkQWpUP4NTB198mgXRwTufF3P2bb3pNG5nXHZls/um/KFkeAm2RBvXWgVUHGEOsf rxodsNmtpaivOfH7rdc59s5zdmjDgiN4yZ9f3q05+WqP8fwheLef8pRlboStZ8lI T1hl0qrFjZ7J5Y3tLX/wR3q+vZxg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=GuNirYOAy44lvfWu2jMQ5iasUAfQr0fxojffYdILpPlM2KkVa8yJs9V8CtfHV/ DCvE3Fy6Y6fcWeJTTdAdHcPDXCTo14a/iR4SKYBXimdEqhoKl/tvc7m6S4M4VsVS vE9suz80FsK2f5UB5crVt1Ts5k+wgLTKiz0zU4fFywifY=; Received: (qmail 7268 invoked by alias); 14 Mar 2012 23:15:54 -0000 Received: (qmail 7259 invoked by uid 22791); 14 Mar 2012 23:15:53 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout04.t-online.de (HELO mailout04.t-online.de) (194.25.134.18) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 23:15:38 +0000 Received: from fwd24.aul.t-online.de (fwd24.aul.t-online.de ) by mailout04.t-online.de with smtp id 1S7xPr-0004RQ-4x; Thu, 15 Mar 2012 00:15:35 +0100 Received: from [192.168.0.104] (SUQVj-ZpohznCoqmOM7PEDvXXtxV8qwveX1NisJioLoXOcHjh71OhbsSRPXRQdLZ54@[93.218.154.208]) by fwd24.t-online.de with esmtp id 1S7xPk-1G540u0; Thu, 15 Mar 2012 00:15:28 +0100 Subject: Re: [SH] Add FPUL usage testcase From: Oleg Endo To: Kaz Kojima Cc: gcc-patches@gcc.gnu.org In-Reply-To: <20120315.081236.494309155.kkojima@rr.iij4u.or.jp> References: <1331762482.1876.110.camel@yam-132-YW-E178-FTW> <20120315.081236.494309155.kkojima@rr.iij4u.or.jp> Date: Thu, 15 Mar 2012 00:15:27 +0100 Message-ID: <1331766927.1876.112.camel@yam-132-YW-E178-FTW> Mime-Version: 1.0 X-IsSubscribed: yes 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 On Thu, 2012-03-15 at 08:12 +0900, Kaz Kojima wrote: > Oleg Endo wrote: > > I'd like to add an SH target testcase which is supposed to check the > > usage of the FPUL register when float values are treated as int and vice > > versa. Does this make sense? > > > > Tested against rev 185360 with the usual > > > > make -k check RUNTESTFLAGS="--target_board=sh-sim > > \{-m2/-ml,-m2/-mb,-m2a-single/-mb, > > -m4-single/-ml,-m4-single/-mb, > > -m4a-single/-ml,-m4a-single/-mb}" > > > > and individually with some of the sub-target variations that do not have > > an FPU (for which the test is skipped). > > ENOPATCH. Sounds a good idea though. Argh, sorry .. now there is. Index: gcc/testsuite/gcc.target/sh/fpul-usage-1.c =================================================================== --- gcc/testsuite/gcc.target/sh/fpul-usage-1.c (revision 0) +++ gcc/testsuite/gcc.target/sh/fpul-usage-1.c (revision 0) @@ -0,0 +1,24 @@ +/* Check that the FPUL register is used when reading a float as an int and + vice versa, as opposed to pushing and popping the values over the stack. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } } */ +/* { dg-final { scan-assembler "fpul" } } */ +/* { dg-final { scan-assembler-not "r15" } } */ + +int +float_as_int (float val) +{ + union { float f; int i; } u; + u.f = val; + return u.i; +} + +float +int_as_float (int val) +{ + union { float f; int i; } u; + u.i = val; + return u.f; +} +