From patchwork Fri Feb 9 10:28:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 871304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-472931-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UKqdBMzH"; dkim-atps=neutral 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 3zdB9l03Trz9s7M for ; Fri, 9 Feb 2018 21:28:42 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=IUciHxRTwSsGc6Mt OT+R4QhW17L0ciHh4Z+leLltgN2igrMisg3QMycpVR5hIKos/rnbvEZKESHeCIfv 3AR+W4mgihksCq+oAVQrVSNVi98nMD3IpUO2QDqqmuRt3QophXff1ErEsSTarImn IHPTXfmwHkaQ2bykNTtwKxS46/k= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=5Ubw+LUY2og8HMwguYLSJb XRkuQ=; b=UKqdBMzHeMVUEcNtG7ymw5c9f3uN4qBo1mE0bwNPgkcm/sgYCVaS5F NCWQKIG4gZKtcGJyQATNS5zzwxeYB2OiREQlBC4tGTGIEoMt9rGgdmEyr+MkF7Re ffHMD3FjigqISX16uNt/ma8wRQBmaFH4SmKKjSU0nPUgAI6zBkLPk= Received: (qmail 91666 invoked by alias); 9 Feb 2018 10:28:35 -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 91650 invoked by uid 89); 9 Feb 2018 10:28:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=D*inria.fr, certified X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Feb 2018 10:28:33 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0298281387 for ; Fri, 9 Feb 2018 11:28:31 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vEyfhfz07GAR for ; Fri, 9 Feb 2018 11:28:30 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id D6D8B81385 for ; Fri, 9 Feb 2018 11:28:30 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Do not generate libcalls to __unord[sd]f2 on PowerPC SPE Date: Fri, 09 Feb 2018 11:28:28 +0100 Message-ID: <5523688.bpAWfy1Iex@polaris> MIME-Version: 1.0 Hi, the change 2016-05-02 Marc Glisse * match.pd (X u< X, X u> X): New transformations. has an annoying effect on targets implementing (most) unordered comparisons in hardware but not the UNORDERED operator itself, e.g. PowerPC SPE, because it makes the compiler generate unnecessary libcalls to __unord[sd]f2. The attached patch contains a trick to undo the effect of the change at the RTL level for such targets. It was tested on PowerPC SPE with a certified version of VxWorks (which provides a minimal certified libgcc) where it fixes the link failure of ACATS c45242b with optimization enabled. OK for the mainline? 2018-02-09 Eric Botcazou * optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison instead of a libcall for UNORDERED. Index: optabs.c =================================================================== --- optabs.c (revision 257404) +++ optabs.c (working copy) @@ -3935,7 +3935,20 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx if (methods != OPTAB_LIB_WIDEN) goto fail; - if (!SCALAR_FLOAT_MODE_P (mode)) + if (SCALAR_FLOAT_MODE_P (mode)) + { + /* Small trick if UNORDERED isn't implemented by the hardware. */ + if (comparison == UNORDERED && rtx_equal_p (x, y)) + { + prepare_cmp_insn (x, y, UNLT, NULL_RTX, unsignedp, OPTAB_WIDEN, + ptest, pmode); + if (*ptest) + return; + } + + prepare_float_lib_cmp (x, y, comparison, ptest, pmode); + } + else { rtx result; machine_mode ret_mode; @@ -3982,8 +3995,6 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx prepare_cmp_insn (x, y, comparison, NULL_RTX, unsignedp, methods, ptest, pmode); } - else - prepare_float_lib_cmp (x, y, comparison, ptest, pmode); return;