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.129.124]) by sourceware.org (Postfix) with ESMTPS id 185913858C29 for ; Tue, 21 Nov 2023 08:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 185913858C29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 185913858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700554882; cv=none; b=r4YiFA4tzOxL2BVSo8MD/U2ElZIp9h7rifaXO9tLPW0Gro7jM+RcUdr2VgJUa6fkuhr/1zFuVpMhBZqqJqBKhleFtEYYAYT9Tl42rX8qaS1QJPcYxEeGv6Lz0VfQoexIHcKEKeZzbPhVxw4YYZXRXl3VlgEXrz2IZZydQce7CjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700554882; c=relaxed/simple; bh=BysBvPhNsvAtS642AXGkJwkEOBC2qA9iN2gP+C6HHG0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=X4tZR28Iq4Yyzz0yL1P9tpoy+/4xQeN0QN6h4/kAeij4Cwm5EdZcj/KIc96etwaJVgyb3TbM4Mej8vgxn3BQR/swf4HvNM984lWVtYxqxMxZucZOMaQHY7rpAfg20YqxBt+FcOBrcnJeD/CWM47rlejBLifYPf5yY/XwzsreRjg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700554880; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-to:resent-from:resent-message-id: in-reply-to:in-reply-to:references:references; bh=DGnHL5tNqYHnPmfuf6yfQ75AlC1TUGlSKjDb/xvzz+A=; b=MV+vmaoyWGpaIYciQ5pgCiZxHdyv97chRMuDyAfkbqYp07Ow0NrbEepQ3xu8lzqlqMQMiR ZjWl1gYIKRpQ4D1Bd5bBo69sFx6g35RmkA/f5HgMWw2JAiUakTDvDaxOuOrJYmD5I4SNNv VQbwqlQlIU8pPvtJ7jCU3c+SWROSe6s= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-_62XdeDqO8esHur8w-hNSQ-1; Tue, 21 Nov 2023 03:21:17 -0500 X-MC-Unique: _62XdeDqO8esHur8w-hNSQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A8153C108CB; Tue, 21 Nov 2023 08:21:17 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAD11492BFA; Tue, 21 Nov 2023 08:21:16 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3AL8LDiU4108968 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 09:21:13 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AL8LC8R4108966; Tue, 21 Nov 2023 09:21:12 +0100 Resent-From: Jakub Jelinek Resent-Date: Tue, 21 Nov 2023 09:21:11 +0100 Resent-Message-ID: Resent-To: Richard Biener , Joseph Myers , Jason Merrill , gcc-patches@gcc.gnu.org Date: Mon, 20 Nov 2023 10:41:17 +0100 From: Jakub Jelinek To: Richard Biener Cc: Joseph Myers , Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] middle-end, v2: Add new value for vector types for __builtin_classify_type Message-ID: Reply-To: Jakub Jelinek References: <788ba79-04d-f041-3bea-9172e33cd66@codesourcery.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Nov 20, 2023 at 08:03:18AM +0000, Richard Biener wrote: > OK. Do we have to adjust any of our documentation for this? I've done it this way. We don't really document the exact values in the documentation, so I think it is sufficient like that. Committed to trunk. 2023-11-20 Jakub Jelinek gcc/ * typeclass.h (enum type_class): Add vector_type_class. * builtins.cc (type_to_class): Return vector_type_class for VECTOR_TYPE. * doc/extend.texi (__builtin_classify_type): Mention bit-precise integer types and vector types. gcc/testsuite/ * c-c++-common/builtin-classify-type-1.c (main): Add tests for vector types. --- gcc/typeclass.h.jj 2023-09-06 17:28:24.238977355 +0200 +++ gcc/typeclass.h 2023-11-10 10:50:59.519007647 +0100 @@ -38,7 +38,7 @@ enum type_class record_type_class, union_type_class, array_type_class, string_type_class, lang_type_class, opaque_type_class, - bitint_type_class + bitint_type_class, vector_type_class }; #endif /* GCC_TYPECLASS_H */ --- gcc/builtins.cc.jj 2023-11-09 09:17:40.230182483 +0100 +++ gcc/builtins.cc 2023-11-10 11:19:29.669129855 +0100 @@ -1859,6 +1859,7 @@ type_to_class (tree type) case LANG_TYPE: return lang_type_class; case OPAQUE_TYPE: return opaque_type_class; case BITINT_TYPE: return bitint_type_class; + case VECTOR_TYPE: return vector_type_class; default: return no_type_class; } } --- gcc/doc/extend.texi.jj +++ gcc/doc/extend.texi @@ -14746,11 +14746,11 @@ The @code{__builtin_classify_type} returns a small integer with a category of @var{arg} argument's type, like void type, integer type, enumeral type, boolean type, pointer type, reference type, offset type, real type, complex type, function type, method type, record type, union type, array type, -string type, etc. When the argument is an expression, for -backwards compatibility reason the argument is promoted like arguments -passed to @code{...} in varargs function, so some classes are never returned -in certain languages. Alternatively, the argument of the built-in -function can be a typename, such as the @code{typeof} specifier. +string type, bit-precise integer type, vector type, etc. When the argument +is an expression, for backwards compatibility reason the argument is promoted +like arguments passed to @code{...} in varargs function, so some classes are +never returned in certain languages. Alternatively, the argument of the +built-in function can be a typename, such as the @code{typeof} specifier. @smallexample int a[2]; --- gcc/testsuite/c-c++-common/builtin-classify-type-1.c.jj 2023-09-26 09:25:30.019599039 +0200 +++ gcc/testsuite/c-c++-common/builtin-classify-type-1.c 2023-11-10 11:02:01.927776922 +0100 @@ -22,6 +22,10 @@ main () const char *p = (const char *) 0; float f = 0.0; _Complex double c = 0.0; + typedef int VI __attribute__((vector_size (4 * sizeof (int)))); + typedef float VF __attribute__((vector_size (4 * sizeof (int)))); + VI vi = { 0, 0, 0, 0 }; + VF vf = { 0.0f, 0.0f, 0.0f, 0.0f }; #ifdef __cplusplus struct T { void foo (); }; int &r = a[0]; @@ -43,6 +47,8 @@ main () static_assert (__builtin_classify_type (struct S) == 12, ""); static_assert (__builtin_classify_type (union U) == 13, ""); static_assert (__builtin_classify_type (int [2]) == 14, ""); + static_assert (__builtin_classify_type (VI) == 19, ""); + static_assert (__builtin_classify_type (VF) == 19, ""); static_assert (__builtin_classify_type (__typeof__ (a[0])) == 1, ""); static_assert (__builtin_classify_type (__typeof__ (e)) == 3, ""); static_assert (__builtin_classify_type (__typeof__ (b)) == 4, ""); @@ -57,6 +63,8 @@ main () static_assert (__builtin_classify_type (__typeof__ (s)) == 12, ""); static_assert (__builtin_classify_type (__typeof__ (u)) == 13, ""); static_assert (__builtin_classify_type (__typeof__ (a)) == 14, ""); + static_assert (__builtin_classify_type (__typeof__ (vi)) == 19, ""); + static_assert (__builtin_classify_type (__typeof__ (vf)) == 19, ""); #ifndef __cplusplus static_assert (__builtin_classify_type (a[0]) == 1, ""); static_assert (__builtin_classify_type (e) == 1, ""); @@ -102,4 +110,8 @@ main () abort (); if (__builtin_classify_type (a) != 5) abort (); + if (__builtin_classify_type (vi) != 19) + abort (); + if (__builtin_classify_type (vf) != 19) + abort (); } Jakub