From patchwork Tue Jan 28 14:16:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazu_Hirata@mentor.com X-Patchwork-Id: 314726 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 3CACF2C00AE for ; Wed, 29 Jan 2014 01:16:56 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:to:subject:mime-version:content-type:from; q=dns; s= default; b=Kx3QweNmSWqGaxnU2hNVZa8w51KIddlzm+mecevWD89i3q0Eoxnd2 gkVwSuRUTbVdaJ7Haojb2x/wgfb3gZQJJmlGkpW9Ejkr5WFDCi1Xsryfw+sg79GH iJyhi++59FgRcXvLT896jvRN/vqvqa/KdbWtrWnTN0HtAF1ug/0e2o= 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:date :message-id:to:subject:mime-version:content-type:from; s= default; bh=Di9cK8LkVoT+0kXe+JIsDeZwGo4=; b=SmBnTu8mNcu9Yk0iSIMR 5X1H5etZsR3xFFXUeQOQFqU2i9wXQZYnI0taR8ywTU7RempJrenYq9QSyWoM4wO3 bv1Q8qk3YqHviuWyU5XcNPDqmspHsse/tKyCr4jcWEo2FwTLmqL7KM9gqjsLsMVR I7w4SZofHk3C+/fejB1wGsY= Received: (qmail 26848 invoked by alias); 28 Jan 2014 14:16:48 -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 26836 invoked by uid 89); 28 Jan 2014 14:16:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2014 14:16:44 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1W89Sz-0000OX-1A from Kazu_Hirata@mentor.com for gcc-patches@gcc.gnu.org; Tue, 28 Jan 2014 06:16:41 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 28 Jan 2014 06:16:40 -0800 Received: from build5-lucid-cs.sje.mentorg.com (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Tue, 28 Jan 2014 06:16:40 -0800 Date: Tue, 28 Jan 2014 06:16:39 -0800 Message-ID: To: Subject: [patch] Fix gcc.target/arm/thumb-cbranchqi.c. MIME-Version: 1.0 From: Hi, Attached is a patch to fix gcc.target/arm/thumb-cbranchqi.c. Without this patch, the testcase fails because these days gcc generates: ldrb: ldrb r3, [r0, #8] mov r0, #2 cmp r3, #127 bls .L2 mov r0, #5 .L2: @ sp needed bx lr Note that we see the "bls" instruction instead of the "bhi" instruction that the testcase expects to see. The patch fixes the problem by accepting "bhi" also. Note that this patch does not miss the point of the original issue, namely PR target/40603: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40603 The point is to take advantage of the "[Rn+imm5]" addressing mode for ldrb, which is not available for ldrsb, and an unsigned comparison against 127. Since we are loading an unsigned byte and performing an unsigned comparison, we must have "bls" or "bhi". Tested on arm-none-eabi. OK to apply? Kazu Hirata gcc/testsuite/ 2014-01-27 Kazu Hirata * gcc.target/arm/thumb-cbranchqi.c: Accept bls also. Index: gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c =================================================================== --- gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c (revision 207119) +++ gcc/testsuite/gcc.target/arm/thumb-cbranchqi.c (working copy) @@ -12,4 +12,4 @@ int ldrb(unsigned char* p) /* { dg-final { scan-assembler "127" } } */ -/* { dg-final { scan-assembler "bhi" } } */ +/* { dg-final { scan-assembler "bhi|bls" } } */