Share to: share facebook share twitter share wa share telegram print page

Intrinsic function

In computer software, in compiler theory, an intrinsic function, also called built-in function or builtin function, is a function (subroutine) available for use in a given programming language whose implementation is handled specially by the compiler. Typically, it may substitute a sequence of automatically generated instructions for the original function call, similar to an inline function.[1] Unlike an inline function, the compiler has an intimate knowledge of an intrinsic function and can thus better integrate and optimize it for a given situation.

Compilers that implement intrinsic functions may enable them only when a program requests optimization, otherwise falling back to a default implementation provided by the language runtime system (environment).

Vectorization and parallelization

Intrinsic functions are often used to explicitly implement vectorization and parallelization in languages which do not address such constructs. Some application programming interfaces (API), for example, AltiVec and OpenMP, use intrinsic functions to declare, respectively, vectorizable and multiprocessing-aware operations during compiling. The compiler parses the intrinsic functions and converts them into vector math or multiprocessing object code appropriate for the target platform. Some intrinsics are used to provide additional constraints to the optimizer, such as values a variable cannot assume.[2]

By programming language

C and C++

Compilers for C and C++, of Microsoft,[3] Intel,[1] and the GNU Compiler Collection (GCC)[4] implement intrinsics that map directly to the x86 single instruction, multiple data (SIMD) instructions (MMX, Streaming SIMD Extensions (SSE), SSE2, SSE3, SSSE3, SSE4, AVX, AVX2, AVX512, FMA, ...). The Microsoft Visual C++ compiler of Microsoft Visual Studio does not support inline assembly for x86-64.[5][6][7][8] To compensate for this, new intrinsics have been added that map to standard assembly instructions that are not normally accessible through C/C++, e.g., bit scan.

Some C and C++ compilers provide non-portable platform-specific intrinsics. Other intrinsics (such as GNU built-ins) are slightly more abstracted, approximating the abilities of several contemporary platforms, with portable fall back implementations on platforms with no appropriate instructions.[9] It is common for C++ libraries, such as glm or Sony's vector maths libraries,[10] to achieve portability via conditional compilation (based on platform specific compiler flags), providing fully portable high-level primitives (e.g., a four-element floating-point vector type) mapped onto the appropriate low level programming language implementations, while still benefiting from the C++ type system and inlining; hence the advantage over linking to hand-written assembly object files, using the C application binary interface (ABI).

Examples

 uint64_t __rdtsc        ();                                                          // return internal CPU clock counter
 uint64_t __popcnt64     (uint64_t n);                                                // count of bits set in n
 uint64_t _umul128       (uint64_t Factor1, uint64_t Factor2, uint64_t* HighProduct); // 64 bit * 64 bit => 128 bit multiplication
 __m512   _mm512_add_ps  (__m512 a, __m512 b);                                        // calculates a + b for two vectors of 16 floats
 __m512   _mm512_fmadd_ps(__m512 a, __m512 b, __m512 c);                              // calculates a*b + c for three vectors of 16 floats

[11]

Java

The HotSpot Java virtual machine's (JVM) just-in-time compiler also has intrinsics for specific Java APIs.[12] Hotspot intrinsics are standard Java APIs which may have one or more optimized implementation on some platforms.

PL/I

ANSI/ISO PL/I defines nearly 90 builtin functions.[13] These are conventionally grouped as follows:[14]: 337–338 

  • String-handling builtin functions such as INDEX, LENGTH
  • Arithmetic builtin functions such as ABS, CEIL, ROUND
  • Mathematical builtin functions like SIN, COS, LOG, ERF
  • Array-handling builtin functions, for example ANY, ALL, PROD
  • Condition-handling builtin functions like ONCODE, ONFILE
  • Storage Control builtin functions, for example ADDR, POINTER
  • Input-Output builtins: LINENO
  • Miscellaneous builtin functions like DATE and TIME

Individual compilers have added additional builtins specific to a machine architecture or operating system.

A builtin function is identified by leaving its name undeclared and allowing it to default, or by declaring it BUILTIN. A user-supplied function of the same name can be substituted by declaring it as ENTRY.

References

  1. ^ a b "Intel® C++ Compiler 19.1 Developer Guide and Reference". Intel® C++ Compiler Documentation. 16 December 2019. Retrieved 2020-01-17.
  2. ^ The Clang Team (2020). "Clang Language Extensions". Clang 11 documentation. Retrieved 2020-01-17. Builtin Functions
  3. ^ MSDN. "Compiler Intrinsics". Microsoft. Retrieved 2012-06-20.
  4. ^ GCC documentation. "Built-in Functions Specific to Particular Target Machines". Free Software Foundation. Retrieved 2012-06-20.
  5. ^ MSDN. "Intrinsics and Inline Assembly". Microsoft. Archived from the original on 2018-01-02. Retrieved 2010-04-16.
  6. ^ MSDN. "Intrinsics and Inline Assembly". Microsoft. Retrieved 2011-09-28.
  7. ^ MSDN. "Intrinsics and Inline Assembly". Microsoft. Retrieved 2011-09-28.
  8. ^ MSDN. "Intrinsics and Inline Assembly". Microsoft. Retrieved 2011-09-28.
  9. ^ "Vector Extensions". Using the GNU Compiler Collection (GCC). Retrieved 2020-01-16.
  10. ^ "Sony open sources Vector Math and SIMD math libraries (Cell PPU/SPU/other platforms)". Beyond3D Forum. Retrieved 2020-01-17.
  11. ^ Intel Intrinsics
  12. ^ Mok, Kris (25 February 2013). "Intrinsic Methods in HotSpot VM". Slideshare. Retrieved 2014-12-20.
  13. ^ ANSI X3 Committee (1976). American National Standard programming language PL/I.{{cite book}}: CS1 maint: numeric names: authors list (link)
  14. ^ IBM Corporation (1995). IBM PL/I for MVS & VM Language Reference.

Read other articles:

Залізна сотняThe Company of Heroes Жанр бойовиквійськовийдрамаРежисер Олесь ЯнчукПродюсер Юрій БорецьСценарист Василь ПортякМихайло ШаєвичУ головних ролях Микола БокланОлег ПримогеновІгор ПіснийОлексій ЗубковВ'ячеслав ВасилюкДмитро ТерещукКатерина КістеньОлеся Жураківськ

Переписна місцевість Гай-Аманаангл. High Amana Координати 41°48′12″ пн. ш. 91°56′17″ зх. д. / 41.80334000002777373° пн. ш. 91.93823000002778656° зх. д. / 41.80334000002777373; -91.93823000002778656Координати: 41°48′12″ пн. ш. 91°56′17″ зх. д. / 41.80334000002777373° пн. ш. 91.93823000002778656

Artikel ini perlu diwikifikasi agar memenuhi standar kualitas Wikipedia. Anda dapat memberikan bantuan berupa penambahan pranala dalam, atau dengan merapikan tata letak dari artikel ini. Untuk keterangan lebih lanjut, klik [tampil] di bagian kanan. Mengganti markah HTML dengan markah wiki bila dimungkinkan. Tambahkan pranala wiki. Bila dirasa perlu, buatlah pautan ke artikel wiki lainnya dengan cara menambahkan [[ dan ]] pada kata yang bersangkutan (lihat WP:LINK untuk keterangan lebih lanjut). …

Clos Lucé adalah sebuah rumah besar di Amboise, Prancis, yang terletak 500 meter dari kerajaan Château d'Amboise, untuk yang dihubungkan oleh sebuah lorong bawah tanah. Dibangun oleh Étienne le Loup di pertengahan abad kelima belas, gedung itu diakuisisi pada 1490 oleh Charles VIII dari Prancis untuk istrinya, Anne de Bretagne. Kemudian, gedung itu digunakan oleh Francis I, juga adiknya Marguerite de Navarre, yang mulai menulis buku berjudul L'Heptaméron saat tinggal di sana. Pada tahun 1516…

Women's role in Islamic culture This article may be too long to read and navigate comfortably. Its current readable prose size is 135 kilobytes. Please consider splitting content into sub-articles, condensing it, or adding subheadings. Please discuss this issue on the article's talk page. (May 2023) Part of a series onIslam Beliefs Oneness of God Prophets Revealed Books Angels Day of Resurrection Predestination Practices Profession of Faith Prayer Almsgiving Fasting Pilgrimage TextsFoundations Q…

Cartoon museum located on the Ohio State University campus Billy Ireland Cartoon Library & Museum39°59′58″N 83°00′32″W / 39.9995°N 83.0088°W / 39.9995; -83.0088LocationColumbus, OhioTypeResearch libraryScopeComic artEstablished1977Branch ofOhio State University LibrariesOther informationDirectorJenny E. Robb, Curator and Associate ProfessorLucy Caswell, Founder and former CuratorWendy Pflug, Associate Curator and Assistant ProfessorCaitlin McGurk, Associat…

Село Бежиціпол. Bierzyce Координати 51°14′18″ пн. ш. 17°10′59″ сх. д. / 51.23861111002777591° пн. ш. 17.183333330028° сх. д. / 51.23861111002777591; 17.183333330028Координати: 51°14′18″ пн. ш. 17°10′59″ сх. д. / 51.23861111002777591° пн. ш. 17.183333330028° сх. д. / 51.23861111002777591; 17…

Sicilian artist (1941–2021) A major contributor to this article appears to have a close connection with its subject. It may require cleanup to comply with Wikipedia's content policies, particularly neutral point of view. Please discuss further on the talk page. (March 2021) (Learn how and when to remove this template message) Arturo Di ModicaDi Modica and Charging Bull in 2014Born(1941-01-26)January 26, 1941Vittoria, Sicily, ItalyDiedFebruary 19, 2021(2021-02-19) (aged 80)Vittoria, Sicily…

New Mexico United Basisdaten Name New Mexico United Sitz Albuquerque, New Mexico, USA Gründung 2018 Farben gelb-schwarz Eigentümer Peter Trevisani Website www.newmexicoutd.com Erste Fußballmannschaft Cheftrainer Vereinigte Staaten Zach Prince Spielstätte Isotopes Park Plätze 13.500 Liga USL Championship 2021 8. Platz (Western Conference) Heim Auswärts New Mexico United ist ein US-amerikanisches Fußball-Franchise der USL Championship aus Albuquerque, New Mexico. Inhaltsverzeichnis 1 Geschi…

2004 EP by the American math rock band Battles B EPEP by BattlesReleasedSeptember 14, 2004GenreMath rockLength29:28LabelDim Mak RecordsProducerBattlesBattles chronology EP C(2004) B EP(2004) EP C/B EP(2006) Professional ratingsReview scoresSourceRatingAllMusic[1]Pitchfork(8.3/10)[2] B EP is a 2004 EP by the American math rock band Battles.[3] It was part of a trio of EPs released by Battles over the course of three months, and has been called another sketchbook reveal…

Manga by Kiyohiko Azuma Azumanga DaiohCover of the first manga tankōbon volume, featuring from left to right: Sakaki, Chiyo, Tomo, Yomi, and Osakaあずまんが大王(Azumanga Daiō)GenreSlice of life[1][2]Surreal comedy[3] MangaWritten byKiyohiko AzumaPublished byMediaWorksShogakukan (re-release)English publisherNA: Yen PressADV Manga (former)MagazineDengeki DaiohDemographicShōnenOriginal runFebruary 1999 – May 2002Volumes4 (List of volumes) Original net a…

Georg-Christof Bertsch Georg-Christof Bertsch (* 30. Mai 1959 in Seeheim-Jugenheim) ist ein deutscher Corporate Identityberater und Publizist. Dieser Artikel oder nachfolgende Abschnitt ist nicht hinreichend mit Belegen (beispielsweise Einzelnachweisen) ausgestattet. Angaben ohne ausreichenden Beleg könnten demnächst entfernt werden. Bitte hilf Wikipedia, indem du die Angaben recherchierst und gute Belege einfügst. Begründung s. Disk Inhaltsverzeichnis 1 Leben 2 Lehrtätigkeit 3 Ehrenamt 4 W…

證券及期貨事務上訴審裁處Securities and Futures Appeals Tribunal  香港特別行政區政府機構證券及期貨事務上訴審裁處標誌主席夏正民法官、韋毅志法官、司徒冕法官部門資訊成立日期2003年所屬部門財經事務及庫務局財經事務科總部香港金鐘金鐘道66號金鐘道政府合署高座5樓聯絡資訊網站www.sfat.gov.hk 證券及期貨事務上訴審裁處(英語:Securities and Futures Appeals Tribunal,簡稱 SFAT)是…

Russian daily newspaper Not to be confused with Pravda or Komsomolskaya Pravda in Ukraine. Komsomolskaya PravdaFirst issue on 24 May 1925TypeDaily newspaperFormatTabloidOwner(s)Media PartnerPublisherIzdatelsky Dom Komsomolskaya PravdaEditor-in-chiefOlesya NosovadFounded24 May 1925; 98 years ago (1925-05-24)LanguageRussianHeadquartersMoscow, Stary Petrovsko-Razumovsky Proezd 1/23, Building 1Country Soviet Union (1925–1991) Russia (1991–present)Circulation660,000 (March 2008)…

1962 film AartiPosterDirected byPhani MajumdarScreenplay byVishwamitter AdilBased onSanskar Lakshmiby Prafulla DesaiProduced byTarachand BarjatyaStarringAshok KumarMeena KumariPradeep KumarShashikalaCinematographyPandurang NaikEdited byG. G. MayekarMusic byRoshanProductioncompanyRajshri ProductionsRelease date 10 August 1962 (1962-08-10) Running time156 minutesCountryIndiaLanguageHindiBox office₹75 lakh (equivalent to ₹64 crore or US$8.0 million in 2023)[…

この項目には性的な表現や記述が含まれます。免責事項もお読みください。 まつもと いちか松本 いちか (2023年)プロフィール別名 五木あいみ愛称 カタツムリ生年月日 2000年2月19日現年齢 23歳出身地 日本・宮城県仙台市血液型 不明公称サイズ(2019年[1]時点)身長 / 体重 153 cm / ― kgスリーサイズ 83 - 50 - 83 cmブラサイズ A[2]靴のサイズ 23.5 cm 単位系換算身長 / …

This article does not cite any sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Taungoo University – news · newspapers · books · scholar · JSTOR (April 2015) (Learn how and when to remove this template message) University of Taungooတောင်ငူတက္ကသိုလ်Mottoပညာဝေစည် ကေတုမတီTypePublicEstablished2001;&…

City municipality in Vojvodina, SerbiaCity municipality of Novi Sad Градска општина Нови СадGradska opština Novi SadCity municipalityCity municipality of Novi SadLocation within Novi SadShow map of Novi SadCity municipality of Novi SadCity municipality of Novi Sad (Vojvodina)Show map of VojvodinaCity municipality of Novi SadCity municipality of Novi Sad (Serbia)Show map of SerbiaCity municipality of Novi SadCity municipality of Novi Sad (Europe)Show map of EuropeCoordinates…

Indian web series ImMatureGenreRomantic comedyWritten byD. Krishna PrasadAbhishek YadavNishaad ZaveriSuprith KundarDirected byPrem MistryStarringRashmi Agdekar Omkaar Kulkarni Chinmay Chandraunshuh Visshesh TiwariComposerVaibhav BundhooCountry of originIndiaOriginal languageHindiNo. of episodes10ProductionProducerPraver MalhotraCinematographyJerin PaulEditorSahil VermaProduction companyThe Viral FeverOriginal releaseNetworkMX PlayerRelease20 February 2019 (2019-02-20) ImMature is …

Pour les articles homonymes, voir Brel (homonymie). Ne doit pas être confondu avec Jacques Bral ou Jacques Borel. Jacques BrelJacques Brel en 1962.BiographieNaissance 8 avril 1929Schaerbeek (Région de Bruxelles-Capitale, Belgique)Décès 9 octobre 1978 (à 49 ans)Hôpital Avicenne (Bobigny, Seine-Saint-Denis, Île-de-France, France)Sépulture Cimetière Calvaire (en)Nom de naissance Jacques Romain Georges BrelNationalité belgeActivités Chanteur, réalisateur, acteur, poète, écrivain, …

Kembali kehalaman sebelumnya

Lokasi Pengunjung: 18.227.46.189