From patchwork Tue Dec 30 17:28:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 424670 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 035CD1400DE for ; Wed, 31 Dec 2014 04:28:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; q= dns; s=default; b=pTLK6mA5Hf8Dt3QjwMiej+uq+ZwK0miePjNCLKYVoxL9Sh fRmwn5G+PKsJCkoAkxxBTSIvSNzfZUfkDjbU6suqvgNShuaMFMj71Kve08JIMV5/ 91Sd8k4s4g71HMNZwKfN/whhzXgxaB9RYTTcki/KCA48dYqjOpvsRhp/DB/ZM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; s= default; bh=Ff9bEnyjGNbcJ8iP/KINOnf7yok=; b=WPDvnV6dRC7g3/00fB10 tqGEMiwwwRB5Q7Io9frCI9w0xMU5wfCoYMbQCq3ffcMTE0QR0KlS21S+BaAzc+jO jovCA5VpCpGFw1nDC09TgpsOi9VknF9+J5jeVkSMJ8eAYj/Y+/wyYDUJgNps+7YX oVKF8sH+gTf0hWOG3jG956s= Received: (qmail 5701 invoked by alias); 30 Dec 2014 17:28:51 -0000 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 Received: (qmail 5690 invoked by uid 89); 30 Dec 2014 17:28:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout08.t-online.de Received: from mailout08.t-online.de (HELO mailout08.t-online.de) (194.25.134.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 30 Dec 2014 17:28:48 +0000 Received: from fwd19.aul.t-online.de (fwd19.aul.t-online.de [172.20.27.65]) by mailout08.t-online.de (Postfix) with SMTP id 71168138DCB for ; Tue, 30 Dec 2014 18:28:44 +0100 (CET) Received: from [192.168.0.104] (VmDstvZdwhJA7hNechw3fpajGOye8RARKcKLKB56tzc5ljFTDYdHkn6E5uCiiOvg36@[84.180.102.58]) by fwd19.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1Y60b0-2kYRjU0; Tue, 30 Dec 2014 18:28:38 +0100 Message-ID: <1419960516.2473.10.camel@yam-132-YW-E178-FTW> Subject: [SH][committed] PR 53987 - Add some known to work tests From: Oleg Endo To: gcc-patches Date: Tue, 30 Dec 2014 18:28:36 +0100 Mime-Version: 1.0 X-IsSubscribed: yes Hi, This adds some known to work SH tests for PR 53987. Tested with make -k check-gcc RUNTESTFLAGS="sh.exp=pr53987-1.c --target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" Committed as r219110. Cheers, Oleg gcc/testsuite/ChangeLog: PR target/53987 * gcc.target/sh/pr53987-1.c: New. Index: gcc/testsuite/gcc.target/sh/pr53987-1.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr53987-1.c (revision 0) +++ gcc/testsuite/gcc.target/sh/pr53987-1.c (revision 0) @@ -0,0 +1,66 @@ +/* Check that no unnecessary sign/zero extensions are being emitted. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "extu.b" 2 } } */ +/* { dg-final { scan-assembler-not "extu.w" } } */ +/* { dg-final { scan-assembler-not "exts.b" } } */ +/* { dg-final { scan-assembler-not "exts.w" } } */ +/* { dg-final { scan-assembler-not "movu" } } */ +/* { dg-final { scan-assembler-not "tst\t#255" { xfail *-*-*} } } */ + +int +test_00 (unsigned char* x, char* xx, int y, int z) +{ + /* If x[0] / b is treated as a non-extended QImode subreg the zero + test will be a QImode subreg test, which is supposed to ignore + bits[31:8]. However, since the QImode memory load always sign + extends, it's also OK to test all the bits. Thus we don't want + to see a tst #255 here. */ + int b = x[0]; + xx[0] = b; + return b ? y : z; +} + +int +test_01 (unsigned char a, unsigned char b, int c, int d) +{ + /* 2x extu.b */ + if (a == b) + return c; + return d; +} + +int +test_02 (unsigned char* a, unsigned char* b, int c, int d) +{ + /* 2x mov.b */ + if (*a != 0 && *b == 0) + return c; + return d; +} + +int +test_03 (unsigned char* a) +{ + /* 1x mov.b */ + return *a == 0; +} + +int +test_04 (unsigned short* a) +{ + /* 1x mov.w */ + return *a == 0; +} + +unsigned char test_05_var; +int +test_05 (int a, int b, int c, int d) +{ + /* Must not see sign/zero extension here. */ + test_05_var = (a == b) | (b == c); + if (test_05_var) + return d; + + return 0; +}