From patchwork Wed Aug 23 12:02:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 804960 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-460794-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="lX/vEzUr"; 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 3xcmFx5Yblz9s9Y for ; Wed, 23 Aug 2017 22:00:17 +1000 (AEST) 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=TgD536+N9jXW0LX7 k/npz4X85IvCcCWNgRlxQgQoWIf48AOW2n3adO6mE11tAu+6mryIM43lTBMqAWn+ gh1nUn8IbOzDgk7NQRlBT10Tuz8vD2dc2AsXzsEBgAm2R6/WDTcjJD6KH0k78GFu yLglOu9bIHMAVV7PmSKlbD5aQ8w= 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=Z6VP3SDc8pr6el1B57UXQr eyQXQ=; b=lX/vEzUrfaDy32MxdBXGSM03Je2i8RQ8l3me3zes9Jydoj873nD9fX LjgBhQX8C8GYFky4YP+18kNW+JzxksixgeT/7PovBcQTOK6W1GkfNJGTdc0exKMH FyDmK+KxnvJ/mmty88JvH0MbdjZpPpP6Mtst0oAUNQ7Avra2ECkao= Received: (qmail 36473 invoked by alias); 23 Aug 2017 12:00:02 -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 36405 invoked by uid 89); 23 Aug 2017 11:59:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=dozen, H*M:home, H*MI:home, documents 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; Wed, 23 Aug 2017 11:59:58 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id F242F82415 for ; Wed, 23 Aug 2017 13:59:55 +0200 (CEST) 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 EZmpzlDhOU61 for ; Wed, 23 Aug 2017 13:59:55 +0200 (CEST) Received: from arcturus.home (182667ea.cst.lightpath.net [24.38.103.234]) (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 C5EDB82402 for ; Wed, 23 Aug 2017 13:59:54 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [i386] Document a dozen of IA-32 builtins Date: Wed, 23 Aug 2017 14:02:27 +0200 Message-ID: <13670177.1rkYhTe5NM@arcturus.home> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Hi, it seems that there are many undocumented IA-32 builtins. This patch starts small and documents the builtins corresponding to the basic instrinsics which are declared in ia32intrin.h. Tested with 'make doc', OK for all active branches? 2017-08-23 Eric Botcazou * doc/extend.texi (x86 Built-in Functions): Document basic builtins. Index: doc/extend.texi =================================================================== --- doc/extend.texi (revision 251141) +++ doc/extend.texi (working copy) @@ -19702,14 +19702,51 @@ Similar to @code{__builtin_nans}, except the retur @findex __builtin_nansq @end table -The following built-in function is always available. +The following built-in function are always available. @table @code +@item unsigned long long __builtin_ia32_rdtsc (void) +Generates the @code{rdtsc} machine instruction. + +@item unsigned long long __builtin_ia32_rdtscp (unsigned int *) +Generates the @code{rdtscp} machine instruction. + @item void __builtin_ia32_pause (void) Generates the @code{pause} machine instruction with a compiler memory barrier. + +@item unsigned long long __builtin_ia32_rdpmc (unsigned int) +Generates the @code{rdpmc} machine instruction. + +@item int __builtin_ia32_bsrsi (int) +Generates the 32-bit @code{bsr} machine instruction. + +@item unsigned char __builtin_ia32_rolqi (unsigned char, int) +Generates the 8-bit @code{rol} machine instruction. + +@item unsigned char __builtin_ia32_rorqi (unsigned char, int) +Generates the 8-bit @code{ror} machine instruction. + +@item unsigned short __builtin_ia32_rolhi (unsigned short, int) +Generates the 16-bit @code{rol} machine instruction. + +@item unsigned short __builtin_ia32_rorhi (unsigned short, int) +Generates the 16-bit @code{ror} machine instruction. @end table +The following built-in function are always available in 64-bit mode. + +@table @code +@item int __builtin_ia32_bsrdi (long long) +Generates the 64-bit @code{bsr} machine instruction. + +@item unsigned long long __builtin_ia32_readeflags_u64 (void) +Reads the flags register. + +@item void __builtin_ia32_writeeflags_u64 (unsigned long long) +Writes the flags register. +@end table + The following built-in functions are always available and can be used to check the target platform type.