From patchwork Tue Jun 18 08:50:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenqiang Chen X-Patchwork-Id: 252175 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B978D2C1DFC for ; Tue, 18 Jun 2013 18:50:55 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=yRqRNOxf/1kJdmnOCtKX2AmpBQVvzC3BUL1fWYnWYU3 lCTMcNl1j5UUfvSdDSxOBh6Yiw0H+wl8SeP7tpMOTaEwpoAmvUH/GQvrrEujO3Uc 22xvCPGfzE4dK6iZwOkfZVUfjKgMWqNliEOXY5C5grlmTpxiLOwbBsy/8t7g1Fvs = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=TtePuvlUQ5EQpRX4o7uRdYSIl44=; b=IJtsfp7m63+Usdiee d2K/c3/rvRLEeJJrZM8UUsrbpWJ2mMmYPHjNSDECKNa1vLpLBrgHg3FfvDiKhMyj VX7YFkGiJ3cgUCorjss/cDnWzPqciMZ8Cz7ku7l6AnCfSn4gyWyQtPkTP0ML36UY f8dHgHW7hZmKfk6MiOgWvdvdDM= Received: (qmail 1981 invoked by alias); 18 Jun 2013 08:50:49 -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 1968 invoked by uid 89); 18 Jun 2013 08:50:48 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from mail-la0-f49.google.com (HELO mail-la0-f49.google.com) (209.85.215.49) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 18 Jun 2013 08:50:47 +0000 Received: by mail-la0-f49.google.com with SMTP id ea20so3262923lab.36 for ; Tue, 18 Jun 2013 01:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=vNeZzO2NooHpAqaHuIC/taNl2+T6ohC0yZcUaH6CINc=; b=LRSUrMdwltAlq3Gq7jEvBiot+lxbI8AbJ+15F47YninTrlBdcILeV/hD1Tk5+23+BO ruCgg5e5o2IqhDF/tK4CuYAwlwosNvYlRurVsaTZv/gkDifb9ohOOpKNRkbpvRdQOqJx xQsR6atzPsMD/1EoP3yAcK2cgaZZhXiYRQK8s0l9JvlxHAj3gKLeSexT7epyE/XYPHsQ Vh3vCHMsvLwRWleGr7LiYTI5jt5oW9Q0pZa9NYxoAMvMyPtQAN1gQZ4H1YQqi+0C71QT ldNPuOwDmOox9K2LvMTpGp+ysc2QkBSN2hSFS8Gsa18xth0SxmZY9fhlzitXJgxiBdAe aR0g== MIME-Version: 1.0 X-Received: by 10.112.205.163 with SMTP id lh3mr621621lbc.45.1371545445211; Tue, 18 Jun 2013 01:50:45 -0700 (PDT) Received: by 10.112.162.229 with HTTP; Tue, 18 Jun 2013 01:50:45 -0700 (PDT) Date: Tue, 18 Jun 2013 16:50:45 +0800 Message-ID: Subject: [PATCH, ARM] Fix unrecognizable vector comparisons From: Zhenqiang Chen To: gcc-patches@gcc.gnu.org Cc: Ramana Radhakrishnan X-Gm-Message-State: ALoCoQmvfHZMX2tvw8KFdneJOSS05QFOKulxSat8TehUD41UUKzVbbGlrkR6F3u5RiZXieG38xO6 Hi, During expand, function vcond inverses some CMP, e.g. a LE b -> b GE a But if "b" is "CONST0_RTX", "b GE a" will be an illegal insn. (insn 933 932 934 113 (set (reg:V4SI 1027) (unspec:V4SI [ (const_vector:V4SI [ (const_int 0 [0]) (const_int 0 [0]) (const_int 0 [0]) (const_int 0 [0]) ]) (reg:V4SI 1023 [ vect_var_.49 ]) (const_int 1 [0x1]) ] UNSPEC_VCGE)) PUGHSlab/Mapping.c:567 -1 (nil)) Refer https://bugs.launchpad.net/linaro-toolchain-binaries/+bug/1189445 for more. And the bug also happens for FSF trunk. The similar issue (https://bugs.launchpad.net/linaro-toolchain-binaries/+bug/1163942) had fixed on AARCH64: http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00581.html The patch is similar to the fix for aarch64. Bootstrap and no make check regression on Panda Board. Is it OK for trunk and 4.8? Thanks! -Zhenqiang ChangeLog: 2013-06-18 Zhenqiang Chen * config/arm/neon.md (vcond): Fix floating-point vector comparisons against 0. diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index e814df0..9299ae5 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -1671,6 +1671,7 @@ ? 3 : 1; rtx magic_rtx = GEN_INT (magic_word); int inverse = 0; + int use_zero_form = 0; int swap_bsl_operands = 0; rtx mask = gen_reg_rtx (mode); rtx tmp = gen_reg_rtx (mode); @@ -1681,12 +1682,16 @@ switch (GET_CODE (operands[3])) { case GE: + case GT: case LE: + case LT: case EQ: - if (!REG_P (operands[5]) - && (operands[5] != CONST0_RTX (mode))) - operands[5] = force_reg (mode, operands[5]); - break; + if (operands[5] == CONST0_RTX (mode)) + { + use_zero_form = 1; + break; + } + /* Fall through. */ default: if (!REG_P (operands[5])) operands[5] = force_reg (mode, operands[5]); @@ -1737,7 +1742,26 @@ a GT b -> a GT b a LE b -> b GE a a LT b -> b GT a - a EQ b -> a EQ b */ + a EQ b -> a EQ b + Note that there also exist direct comparison against 0 forms, + so catch those as a special case. */ + if (use_zero_form) + { + inverse = 0; + switch (GET_CODE (operands[3])) + { + case LT: + base_comparison = gen_neon_vclt; + break; + case LE: + base_comparison = gen_neon_vcle; + break; + default: + /* Do nothing, other zero form cases already have the correct + base_comparison. */ + break; + } + } if (!inverse) emit_insn (base_comparison (mask, operands[4], operands[5], magic_rtx));