From patchwork Tue Mar 20 22:02:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 147850 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 B7901B6EEC for ; Wed, 21 Mar 2012 09:03:21 +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=1332885803; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Subject:From:To:Content-Type:Date:Message-ID:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=1Q1/6fuwAtrOWepothQM EEILSxg=; b=urCcr+JuuKfP7/m1eeP1TE4EsgLYn8AiftPYmMtn19JXDQhgNb3O xV4CW4E9piECLEQHbsiTk2gwCrLcxja0qwexbXLsfZjNP0iRtzcQEamsEXRGAfaI 1cd8Ooz+Ne9PZ27i2ZScc+dleHcl/+u52/a8aewIGwWEit6bFPA51+Q= 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: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=mo4qbhUK6pGT6PbKRBDhQGLVRoeaANOvOA395BV3uRYEclRwnfazbvOl8laOO2 KP6eYy1cwy67WhXsc2vrv31oo/PJr3jSFMdhSYTAZ8/cuj91L/qRlEqVxYUde5zE vMOwWPkBpIAcPE09al0jg9ep3vb5CJogshabySAvj63hs=; Received: (qmail 7995 invoked by alias); 20 Mar 2012 22:03:16 -0000 Received: (qmail 7985 invoked by uid 22791); 20 Mar 2012 22:03:15 -0000 X-SWARE-Spam-Status: No, hits=-1.9 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 mailout03.t-online.de (HELO mailout03.t-online.de) (194.25.134.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Mar 2012 22:03:02 +0000 Received: from fwd00.aul.t-online.de (fwd00.aul.t-online.de ) by mailout03.t-online.de with smtp id 1SA78u-0001li-Bn; Tue, 20 Mar 2012 23:03:00 +0100 Received: from [192.168.0.104] (rXF2ecZJYh32qZOHoH3glQ8LfZKLVPeH3laN8Q9DJrnlRSUJ+Yt4xtyJANbXyL1Qm4@[93.218.156.249]) by fwd00.t-online.de with esmtp id 1SA78s-2AslN20; Tue, 20 Mar 2012 23:02:58 +0100 Subject: [SH] PR 50751 - some test cases From: Oleg Endo To: gcc-patches Date: Tue, 20 Mar 2012 23:02:52 +0100 Message-ID: <1332280972.1876.205.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 Hi, The attached patch adds some test cases for PR 50751 to check whether mov.b insns are generated. Tested on sh-sim with make check-gcc RUNTESTFLAGS="sh.exp=pr50751* --target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a-single/-mb,-m4-single/-ml, -m4-single/-mb,-m4a-single/-ml,-m4a-single/-mb}" to confirm that the tests pass as expected. Cheers, Oleg testsuite/ChangeLog: PR target/50751 * gcc/target/sh/pr50751-1.c: New. * gcc/target/sh/pr50751-2.c: New. * gcc/target/sh/pr50751-3.c: New. Index: gcc/testsuite/gcc.target/sh/pr50751-1.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr50751-1.c (revision 0) +++ gcc/testsuite/gcc.target/sh/pr50751-1.c (revision 0) @@ -0,0 +1,30 @@ +/* Check that the mov.b displacement addressing insn is generated. + If the insn is generated as expected, there should be no address + calculations outside the mov insns. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */ +/* { dg-final { scan-assembler-not "add|sub" } } */ + +void +testfunc_00 (const char* ap, char* bp, char val) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[15]; + bp[4] = val; + bp[14] = val; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp, char val) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[15]; + bp[4] = val; + bp[14] = val; +} + Index: gcc/testsuite/gcc.target/sh/pr50751-2.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr50751-2.c (revision 0) +++ gcc/testsuite/gcc.target/sh/pr50751-2.c (revision 0) @@ -0,0 +1,27 @@ +/* Check that the mov.b displacement addressing insn is generated and the + base address is adjusted only once. On SH2A this test is skipped because + there is a 4 byte mov.b insn that can handle larger displacements. Thus + on SH2A the base address will not be adjusted in this case. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */ +/* { dg-final { scan-assembler-times "add" 2 } } */ + +void +testfunc_00 (const char* ap, char* bp) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[25]; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp) +{ + bp[0] = ap[15]; + bp[2] = ap[5]; + bp[9] = ap[7]; + bp[0] = ap[25]; +} + Index: gcc/testsuite/gcc.target/sh/pr50751-3.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr50751-3.c (revision 0) +++ gcc/testsuite/gcc.target/sh/pr50751-3.c (revision 0) @@ -0,0 +1,26 @@ +/* Check that on SH2A the 4 byte mov.b displacement insn is generated to + handle larger displacements. If it is generated correctly, there should + be no base address adjustments outside the mov.b insns. */ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */ +/* { dg-final { scan-assembler-not "add|sub" } } */ + +void +testfunc_00 (const char* ap, char* bp) +{ + bp[100] = ap[15]; + bp[200] = ap[50]; + bp[900] = ap[71]; + bp[0] = ap[25]; +} + +void +testfunc_01 (volatile const char* ap, volatile char* bp) +{ + bp[100] = ap[15]; + bp[200] = ap[50]; + bp[900] = ap[71]; + bp[0] = ap[25]; +} +