From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7E82C3858D1E for ; Tue, 26 Apr 2022 06:53:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E82C3858D1E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-618-U7uPYNFwPieu8LakSynqvQ-1; Tue, 26 Apr 2022 02:53:51 -0400 X-MC-Unique: U7uPYNFwPieu8LakSynqvQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D2F7833975; Tue, 26 Apr 2022 06:53:51 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D22AC07F43; Tue, 26 Apr 2022 06:53:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 23Q6rms03657092 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 26 Apr 2022 08:53:49 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 23Q6rhfL3657091; Tue, 26 Apr 2022 08:53:43 +0200 Date: Tue, 26 Apr 2022 08:53:43 +0200 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Fix up ICE with -mveclibabi={acml,svml} [PR105367] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2022 06:53:56 -0000 Hi! The following testcase ICEs, because conversion between scalar float types which have the same mode are useless in GIMPLE, but for mathfn_built_in the exact type matters (it treats say double and _Float64 or float and _Float32 differently, using different suffixes and for the _Float* sometimes returning NULL when float/double do have a builtin). In ix86_veclibabi_{svml,acml} we are using mathfn_built_in just so that we don't have to translate the combined_fn and SFmode vs. DFmode into strings ourselfs, and we already earlier punt on anything but SFmode and DFmode. So, this patch just uses the double or float types depending on the modes, rather than the types we actually got and which might be _Float64 or _Float32 etc. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-04-26 Jakub Jelinek PR target/105367 * config/i386/i386.cc (ix86_veclibabi_svml, ix86_veclibabi_acml): Pass el_mode == DFmode ? double_type_node : float_type_node instead of TREE_TYPE (type_in) as first arguments to mathfn_built_in. * gcc.target/i386/pr105367.c: New test. --- gcc/config/i386/i386.cc.jj 2022-04-22 13:36:42.558150777 +0200 +++ gcc/config/i386/i386.cc 2022-04-25 12:30:09.862736906 +0200 @@ -18807,7 +18807,8 @@ ix86_veclibabi_svml (combined_fn fn, tre return NULL_TREE; } - tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn); + tree fndecl = mathfn_built_in (el_mode == DFmode + ? double_type_node : float_type_node, fn); bname = IDENTIFIER_POINTER (DECL_NAME (fndecl)); if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LOGF) @@ -18899,7 +18900,8 @@ ix86_veclibabi_acml (combined_fn fn, tre return NULL_TREE; } - tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn); + tree fndecl = mathfn_built_in (el_mode == DFmode + ? double_type_node : float_type_node, fn); bname = IDENTIFIER_POINTER (DECL_NAME (fndecl)); sprintf (name + 7, "%s", bname+10); --- gcc/testsuite/gcc.target/i386/pr105367.c.jj 2022-04-25 12:25:16.724809778 +0200 +++ gcc/testsuite/gcc.target/i386/pr105367.c 2022-04-25 12:24:34.004403339 +0200 @@ -0,0 +1,12 @@ +/* PR target/105367 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mveclibabi=acml" } */ + +_Float64 g; + +void +foo (void) +{ + _Float64 f = __builtin_sin (g); + g = __builtin_fmax (__builtin_sin (f), f); +} Jakub