From patchwork Tue Nov 2 08:40:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 46946 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E8EE3858C60 for ; Tue, 2 Nov 2021 08:41:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E8EE3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635842498; bh=zcy794Z/nP+tZ/pW+Nm3kTf8Exr4FnkoMpPTX0FrYPc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OD0kgdWEl8NrQn4405MOb1YnLD3wq1DEC1MXpOMeUtl6IasxxEQuJsYomaOe3IXFV ydKwCVqUxtd/FnKR7DkxkALJE1bJkvbv7YPe810vu5d3Z5SA0poosSanCEutrJkVE2 ymOAniEMm6OVngO2BJl18bUbwsyG+HQq3u8Ie7Jk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 500263858C60 for ; Tue, 2 Nov 2021 08:41:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 500263858C60 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-cvlZo3J7PdWB0JWz1lJnww-1; Tue, 02 Nov 2021 04:41:04 -0400 X-MC-Unique: cvlZo3J7PdWB0JWz1lJnww-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B46C110A8E00; Tue, 2 Nov 2021 08:41:03 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CE335DEFA; Tue, 2 Nov 2021 08:41:03 +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 1A28f0up1019736 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 2 Nov 2021 09:41:00 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 1A28ex3S1019735; Tue, 2 Nov 2021 09:40:59 +0100 Date: Tue, 2 Nov 2021 09:40:59 +0100 To: Uros Bizjak Subject: [PATCH] ia32: Disallow mode(V1TI) [PR103020] Message-ID: <20211102084059.GB304296@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.7 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! As discussed in the PR, TImode isn't supported for -m32 on x86 (for the same reason as on most 32-bit targets, no support for > 2 * BITS_PER_WORD precision integers), but since PR32280 V1TImode is allowed with -msse in SSE regs, V2TImode with -mavx or V4TImode with -mavx512f. typedef __int128 V __attribute__((vector_size ({16,32,64})); will not work, neither typedef int I __attribute__((mode(TI))); but mode(V1TI), mode(V2TI) etc. are accepted with a warning when those ISAs are enabled. But they are certainly not fully supported, for some optabs maybe, but most of them will not. And, veclower lowering those ops to TImode scalar operations will not work either because TImode isn't supported. So, this patch keeps V1TImode etc. in VALID*_MODE macros so that we can use it in certain instructions, but disallows it in targetm.vector_mode_supported_p, so that we don't offer those modes to the user as supported. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2021-11-02 Jakub Jelinek PR target/103020 * config/i386/i386.c (ix86_vector_mode_supported_p): Reject vector modes with TImode inner mode if 32-bit. * gcc.target/i386/pr103020.c: New test. Jakub --- gcc/config/i386/i386.c.jj 2021-10-28 11:29:01.827722053 +0200 +++ gcc/config/i386/i386.c 2021-11-01 11:01:44.123587169 +0100 @@ -21989,6 +21989,10 @@ ix86_libgcc_floating_mode_supported_p (s static bool ix86_vector_mode_supported_p (machine_mode mode) { + /* For ia32, scalar TImode isn't supported and so V1TImode shouldn't be + either. */ + if (!TARGET_64BIT && GET_MODE_INNER (mode) == TImode) + return false; if (TARGET_SSE && VALID_SSE_REG_MODE (mode)) return true; if (TARGET_SSE2 && VALID_SSE2_REG_MODE (mode)) --- gcc/testsuite/gcc.target/i386/pr103020.c.jj 2021-11-01 11:03:34.498017247 +0100 +++ gcc/testsuite/gcc.target/i386/pr103020.c 2021-11-01 11:11:10.794527161 +0100 @@ -0,0 +1,11 @@ +/* PR target/103020 */ +/* { dg-do compile { target { ! int128 } } } */ +/* { dg-additional-options "-mavx512f" } */ + +typedef int TI __attribute__((mode (TI))); /* { dg-error "unable to emulate" } */ +typedef int V1TI __attribute__((mode (V1TI))); /* { dg-error "unable to emulate" } */ +typedef int V2TI __attribute__((mode (V2TI))); /* { dg-error "unable to emulate" } */ +typedef int V4TI __attribute__((mode (V4TI))); /* { dg-error "unable to emulate" } */ +/* { dg-warning "is deprecated" "V1TI" { target *-*-* } .-3 } */ +/* { dg-warning "is deprecated" "V2TI" { target *-*-* } .-3 } */ +/* { dg-warning "is deprecated" "V4TI" { target *-*-* } .-3 } */