From patchwork Wed Aug 11 11:58:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 61472 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 61935B6F10 for ; Wed, 11 Aug 2010 21:59:02 +1000 (EST) Received: (qmail 16777 invoked by alias); 11 Aug 2010 11:59:00 -0000 Received: (qmail 16765 invoked by uid 22791); 11 Aug 2010 11:58:59 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Aug 2010 11:58:53 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7BBwpAn031680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Aug 2010 07:58:51 -0400 Received: from Gift.redhat.com (vpn2-10-21.ams2.redhat.com [10.36.10.21]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7BBwns9012959 for ; Wed, 11 Aug 2010 07:58:50 -0400 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: XStormy16: Add __cmpsi2 function Date: Wed, 11 Aug 2010 12:58:48 +0100 Message-ID: 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 Hi Guys, I am checking in the patch below to add an implementation of the __cmpsi2 function to xstormy's libgcc. I had thought that it would never be needed, but this turned out to be untrue. I am also changing the build optimization for libgcc (for the xstormy) from -Os to -O2 as this provides a better compromise between speed and size. Cheers Nick gcc/ChangeLog 2010-08-11 Nick Clifton * config/stormy16/stormy16-lib2.c (__cmpsi2): New function. * config/stormy16/stormy16-lib2-cmpsi2.c: New file. * config/stormy16/t-stormy16 (LIB2FUNCS_EXTRA): Add stormy16-lib2-cmpsi.c. * config/stormy16/t-stormy16 (TARGET_LIBGCC2_CFLAGS): Change to -O2. Index: gcc/config/stormy16/t-stormy16 =================================================================== --- gcc/config/stormy16/t-stormy16 (revision 163096) +++ gcc/config/stormy16/t-stormy16 (working copy) @@ -33,6 +33,7 @@ $(srcdir)/config/stormy16/stormy16-lib2-clzhi2.c \ $(srcdir)/config/stormy16/stormy16-lib2-ctzhi2.c \ $(srcdir)/config/stormy16/stormy16-lib2-ffshi2.c \ + $(srcdir)/config/stormy16/stormy16-lib2-cmpsi2.c \ $(srcdir)/config/stormy16/stormy16-lib2-ucmpsi2.c # Floating point emulation libraries. @@ -46,4 +47,4 @@ dp-bit.c: $(srcdir)/config/fp-bit.c cat $(srcdir)/config/fp-bit.c > dp-bit.c -TARGET_LIBGCC2_CFLAGS = -Os +TARGET_LIBGCC2_CFLAGS = -O2 Index: gcc/config/stormy16/stormy16-lib2-cmpsi2.c =================================================================== --- gcc/config/stormy16/stormy16-lib2-cmpsi2.c (revision 0) +++ gcc/config/stormy16/stormy16-lib2-cmpsi2.c (revision 0) @@ -0,0 +1,2 @@ +#define XSTORMY16_CMPSI2 +#include "stormy16-lib2.c" Index: gcc/config/stormy16/stormy16-lib2.c =================================================================== --- gcc/config/stormy16/stormy16-lib2.c (revision 163096) +++ gcc/config/stormy16/stormy16-lib2.c (working copy) @@ -332,3 +332,26 @@ return hi_a < hi_b ? 0 : 2; } #endif + +#ifdef XSTORMY16_CMPSI2 +/* Performs an signed comparison of two 32-bit values: A and B. + If A is less than B, then 0 is returned. If A is greater than B, + then 2 is returned. Otherwise A and B are equal and 1 is returned. */ + +word_type +__cmpsi2 (SItype a, SItype b) +{ + word_type hi_a = (a >> 16); + word_type hi_b = (b >> 16); + + if (hi_a == hi_b) + { + word_type low_a = (a & 0xffff); + word_type low_b = (b & 0xffff); + + return low_a < low_b ? 0 : (low_a > low_b ? 2 : 1); + } + + return hi_a < hi_b ? 0 : 2; +} +#endif