├── .github ├── README.adoc └── compiler-isa-config-model-EN.svg ├── themes ├── .tutorial.yml.swp └── la-doc-pdf.yml ├── fonts ├── CM_Unicode │ ├── cmunbi.ttf │ ├── cmunbx.ttf │ ├── cmunrm.ttf │ ├── cmuntb.ttf │ ├── cmunti.ttf │ ├── cmuntt.ttf │ └── OFL.txt ├── Ubuntu │ ├── Ubuntu-C.ttf │ └── ubuntu-font-licence-1.0.txt ├── Noto_Serif │ ├── NotoSerif-Bold.ttf │ ├── NotoSerif-Italic.ttf │ ├── NotoSerif-Regular.ttf │ ├── NotoSerif-BoldItalic.ttf │ └── OFL.txt └── Merriweather │ ├── Merriweather-Bold.ttf │ ├── Merriweather-Italic.ttf │ ├── Merriweather-Regular.ttf │ ├── Merriweather-BoldItalic.ttf │ └── OFL.txt ├── Makefile ├── LoongArch-toolchain-conventions-EN.adoc └── images └── compiler-isa-config-model-EN.svg /.github/README.adoc: -------------------------------------------------------------------------------- 1 | ../LoongArch-toolchain-conventions-EN.adoc -------------------------------------------------------------------------------- /themes/.tutorial.yml.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/themes/.tutorial.yml.swp -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmunbi.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmunbi.ttf -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmunbx.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmunbx.ttf -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmunrm.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmunrm.ttf -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmuntb.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmuntb.ttf -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmunti.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmunti.ttf -------------------------------------------------------------------------------- /fonts/CM_Unicode/cmuntt.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/CM_Unicode/cmuntt.ttf -------------------------------------------------------------------------------- /fonts/Ubuntu/Ubuntu-C.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Ubuntu/Ubuntu-C.ttf -------------------------------------------------------------------------------- /fonts/Noto_Serif/NotoSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Noto_Serif/NotoSerif-Bold.ttf -------------------------------------------------------------------------------- /fonts/Noto_Serif/NotoSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Noto_Serif/NotoSerif-Italic.ttf -------------------------------------------------------------------------------- /fonts/Noto_Serif/NotoSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Noto_Serif/NotoSerif-Regular.ttf -------------------------------------------------------------------------------- /fonts/Merriweather/Merriweather-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Merriweather/Merriweather-Bold.ttf -------------------------------------------------------------------------------- /fonts/Merriweather/Merriweather-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Merriweather/Merriweather-Italic.ttf -------------------------------------------------------------------------------- /fonts/Noto_Serif/NotoSerif-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Noto_Serif/NotoSerif-BoldItalic.ttf -------------------------------------------------------------------------------- /fonts/Merriweather/Merriweather-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Merriweather/Merriweather-Regular.ttf -------------------------------------------------------------------------------- /fonts/Merriweather/Merriweather-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loongson/la-toolchain-conventions/HEAD/fonts/Merriweather/Merriweather-BoldItalic.ttf -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION = 1.1 2 | 3 | PDF = la-tc-v$(VERSION).pdf 4 | 5 | SRC = LoongArch-toolchain-conventions-EN.adoc 6 | 7 | PDF_THEME = themes/la-doc-pdf.yml 8 | 9 | IMGS = images/compiler-isa-config-model-EN.svg 10 | 11 | .PHONY: all clean 12 | 13 | $(PDF): $(SRC) $(IMGS) $(PDF_THEME) 14 | cd "$$(realpath "`pwd`")"; \ 15 | asciidoctor-pdf \ 16 | -a compress \ 17 | -a date="$(DATE)" \ 18 | -a monthyear="$(MONTHYEAR)" \ 19 | -a pdf-style="$(PDF_THEME)" \ 20 | -a pdf-fontsdir=fonts \ 21 | -a imagesdir=images \ 22 | -v \ 23 | $(SRC) -o $@ 24 | 25 | html: $(patsubst %.adoc, %.html, $(SRC)) 26 | 27 | %.html: %.adoc 28 | asciidoctor $^ -o $@ 29 | 30 | clean: 31 | -rm -rf $(patsubst %.adoc, %.html, $(SRC)) 32 | -------------------------------------------------------------------------------- /themes/la-doc-pdf.yml: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # Asciidoctor PDF Theme for LoongArch documents. 3 | # ----------------------------------------------------------------------------- 4 | page: 5 | layout: portrait 6 | margin: [10mm, 15mm, 18mm, 11mm] 7 | size: a4 8 | 9 | base: 10 | font_color: #333333 11 | font_family: Noto Serif 12 | font_style: normal 13 | font_size: 10 14 | line_height: 1.1 15 | vertical_spacing: 11 16 | 17 | heading: 18 | font_color: #d71520 19 | font_family: Merriweather 20 | h1_font_family: CMU Serif 21 | h1_font_size: floor($base_font_size * 1.7) 22 | h2_font_size: floor($base_font_size * 1.3) 23 | h3_font_size: round($base_font_size * 1.1) 24 | h4_font_size: round($base_font_size * 1.0) 25 | font_style: bold 26 | line_height: 1 27 | margin_bottom: $vertical_spacing / 1.5 28 | margin_top: $vertical_spacing / 1.5 29 | 30 | code: 31 | font_color: #333333 32 | # font_family: Courier Prime Sans 33 | font_family: CMU Typewriter 34 | font_style: normal 35 | font_size: 10 36 | background_color: #f6f6f6 37 | # border_color: #0f80aa 38 | border_color: #333333 39 | border_radius: 2 40 | line_height: 1.1 41 | 42 | #caption: 43 | # font_family: CMU Serif 44 | # font_style: normal 45 | # font_size: 10 46 | 47 | literal: 48 | font_family: CMU Typewriter 49 | font_color: $heading_font_color 50 | font_style: normal 51 | 52 | link: 53 | font_color: #002FA7 54 | 55 | description_list: 56 | description_indent: $base_font_size * 2.5 57 | 58 | outline_list: 59 | indent: $base_font_size * 2.5 60 | 61 | title_page: 62 | font_family: Noto Serif 63 | font_color: #000000 64 | # background_color: #1d4e89 65 | background_color: #ffffff 66 | align: right 67 | #logo: 68 | # top: 10% 69 | # image: image:images/puzzle_stamp_white.svg[width=30%, align=center] 70 | title: 71 | top: 30% 72 | font_color: $heading_font_color 73 | font_size: $base_font_size * 4.25 74 | font_family: CMU Serif 75 | font_style: bold 76 | line_height: 0.9 77 | subtitle: 78 | font_size: $base_font_size * 2.00 79 | font_family: Noto Serif 80 | font_style: normal 81 | line_height: 1 82 | authors: 83 | margin_top: $base_font_size * 29.25 84 | font_size: $base_font_size * 1.5 85 | font_family: Noto Serif 86 | font_style: normal 87 | revision: 88 | margin_top: $base_font_size * 0.5 89 | font_family: Noto Serif 90 | font_style: normal 91 | 92 | toc: 93 | line_height: 1.25 94 | break-after: auto 95 | h1: 96 | font_style: bold 97 | dot_leader: 98 | content: ". " 99 | font_color: #A9A9A9 100 | levels: 1 2 3 101 | 102 | 103 | table: 104 | border_width: 1 105 | cell: 106 | padding: 3 107 | head: 108 | font_size: 10 109 | body: 110 | font_size: 9 111 | foot: 112 | font_size: 9 113 | 114 | footer: 115 | font_size: 8 116 | border_color: #dddddd 117 | border_width: 0.25 118 | height: 38.5 119 | line_height: 1 120 | padding: [5.5, 1, 0, 1] 121 | vertical_align: top 122 | recto: 123 | right: 124 | content: '{document-title} | © Loongson' 125 | left: 126 | content: '{page-number}' 127 | verso: 128 | left: 129 | content: $footer_recto_right_content 130 | right: 131 | content: '{page-number}' 132 | 133 | ## ---------------------------------------------------------------------------- 134 | ## Fonts 135 | ## ---------------------------------------------------------------------------- 136 | font: 137 | catalog: 138 | Noto Serif: 139 | normal: Noto_Serif/NotoSerif-Regular.ttf 140 | bold: Noto_Serif/NotoSerif-Bold.ttf 141 | italic: Noto_Serif/NotoSerif-Italic.ttf 142 | bold_italic: Noto_Serif/NotoSerif-BoldItalic.ttf 143 | 144 | Merriweather: 145 | normal: Merriweather/Merriweather-Regular.ttf 146 | bold: Merriweather/Merriweather-Bold.ttf 147 | italic: Merriweather/Merriweather-Italic.ttf 148 | bold_italic: Merriweather/Merriweather-BoldItalic.ttf 149 | 150 | CMU Serif: 151 | normal: CM_Unicode/cmunrm.ttf 152 | bold: CM_Unicode/cmunbx.ttf 153 | italic: CM_Unicode/cmunti.ttf 154 | bold_italic: CM_Unicode/cmunbi.ttf 155 | 156 | CMU Typewriter: 157 | normal: CM_Unicode/cmuntt.ttf 158 | bold: CM_Unicode/cmuntb.ttf 159 | 160 | Ubuntu Condensed: 161 | normal: Ubuntu/Ubuntu-C.ttf 162 | -------------------------------------------------------------------------------- /fonts/Noto_Serif/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012 Google Inc. All Rights Reserved. 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /fonts/Merriweather/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2016 The Merriweather Project Authors (https://github.com/EbenSorkin/Merriweather), with Reserved Font Name "Merriweather". 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /fonts/Ubuntu/ubuntu-font-licence-1.0.txt: -------------------------------------------------------------------------------- 1 | ------------------------------- 2 | UBUNTU FONT LICENCE Version 1.0 3 | ------------------------------- 4 | 5 | PREAMBLE 6 | This licence allows the licensed fonts to be used, studied, modified and 7 | redistributed freely. The fonts, including any derivative works, can be 8 | bundled, embedded, and redistributed provided the terms of this licence 9 | are met. The fonts and derivatives, however, cannot be released under 10 | any other licence. The requirement for fonts to remain under this 11 | licence does not require any document created using the fonts or their 12 | derivatives to be published under this licence, as long as the primary 13 | purpose of the document is not to be a vehicle for the distribution of 14 | the fonts. 15 | 16 | DEFINITIONS 17 | "Font Software" refers to the set of files released by the Copyright 18 | Holder(s) under this licence and clearly marked as such. This may 19 | include source files, build scripts and documentation. 20 | 21 | "Original Version" refers to the collection of Font Software components 22 | as received under this licence. 23 | 24 | "Modified Version" refers to any derivative made by adding to, deleting, 25 | or substituting -- in part or in whole -- any of the components of the 26 | Original Version, by changing formats or by porting the Font Software to 27 | a new environment. 28 | 29 | "Copyright Holder(s)" refers to all individuals and companies who have a 30 | copyright ownership of the Font Software. 31 | 32 | "Substantially Changed" refers to Modified Versions which can be easily 33 | identified as dissimilar to the Font Software by users of the Font 34 | Software comparing the Original Version with the Modified Version. 35 | 36 | To "Propagate" a work means to do anything with it that, without 37 | permission, would make you directly or secondarily liable for 38 | infringement under applicable copyright law, except executing it on a 39 | computer or modifying a private copy. Propagation includes copying, 40 | distribution (with or without modification and with or without charging 41 | a redistribution fee), making available to the public, and in some 42 | countries other activities as well. 43 | 44 | PERMISSION & CONDITIONS 45 | This licence does not grant any rights under trademark law and all such 46 | rights are reserved. 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a 49 | copy of the Font Software, to propagate the Font Software, subject to 50 | the below conditions: 51 | 52 | 1) Each copy of the Font Software must contain the above copyright 53 | notice and this licence. These can be included either as stand-alone 54 | text files, human-readable headers or in the appropriate machine- 55 | readable metadata fields within text or binary files as long as those 56 | fields can be easily viewed by the user. 57 | 58 | 2) The font name complies with the following: 59 | (a) The Original Version must retain its name, unmodified. 60 | (b) Modified Versions which are Substantially Changed must be renamed to 61 | avoid use of the name of the Original Version or similar names entirely. 62 | (c) Modified Versions which are not Substantially Changed must be 63 | renamed to both (i) retain the name of the Original Version and (ii) add 64 | additional naming elements to distinguish the Modified Version from the 65 | Original Version. The name of such Modified Versions must be the name of 66 | the Original Version, with "derivative X" where X represents the name of 67 | the new work, appended to that name. 68 | 69 | 3) The name(s) of the Copyright Holder(s) and any contributor to the 70 | Font Software shall not be used to promote, endorse or advertise any 71 | Modified Version, except (i) as required by this licence, (ii) to 72 | acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with 73 | their explicit written permission. 74 | 75 | 4) The Font Software, modified or unmodified, in part or in whole, must 76 | be distributed entirely under this licence, and must not be distributed 77 | under any other licence. The requirement for fonts to remain under this 78 | licence does not affect any document created using the Font Software, 79 | except any version of the Font Software extracted from a document 80 | created using the Font Software may only be distributed under this 81 | licence. 82 | 83 | TERMINATION 84 | This licence becomes null and void if any of the above conditions are 85 | not met. 86 | 87 | DISCLAIMER 88 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 89 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 90 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 91 | COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 92 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 93 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 94 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER 96 | DEALINGS IN THE FONT SOFTWARE. 97 | -------------------------------------------------------------------------------- /fonts/CM_Unicode/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) Authors of original metafont fonts: 2 | Donald Ervin Knuth (cm, concrete fonts) 3 | 1995, 1996, 1997 J"org Knappen, 1990, 1992 Norbert Schwarz (ec fonts) 4 | 1992-2006 A.Khodulev, O.Lapko, A.Berdnikov, V.Volovich (lh fonts) 5 | 1997-2005 Claudio Beccari (cb greek fonts) 6 | 2002 FUKUI Rei (tipa fonts) 7 | 2003-2005 Han The Thanh (Vietnamese fonts) 8 | 1996-2005 Walter Schmidt (cmbright fonts) 9 | 10 | Copyright (C) 2003-2009, Andrey V. Panov (panov@canopus.iacp.dvo.ru), 11 | with Reserved Font Family Name "Computer Modern Unicode fonts". 12 | 13 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 14 | This license is copied below, and is also available with a FAQ at: 15 | http://scripts.sil.org/OFL 16 | 17 | 18 | ----------------------------------------------------------- 19 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 20 | ----------------------------------------------------------- 21 | 22 | PREAMBLE 23 | The goals of the Open Font License (OFL) are to stimulate worldwide 24 | development of collaborative font projects, to support the font creation 25 | efforts of academic and linguistic communities, and to provide a free and 26 | open framework in which fonts may be shared and improved in partnership 27 | with others. 28 | 29 | The OFL allows the licensed fonts to be used, studied, modified and 30 | redistributed freely as long as they are not sold by themselves. The 31 | fonts, including any derivative works, can be bundled, embedded, 32 | redistributed and/or sold with any software provided that any reserved 33 | names are not used by derivative works. The fonts and derivatives, 34 | however, cannot be released under any other type of license. The 35 | requirement for fonts to remain under this license does not apply 36 | to any document created using the fonts or their derivatives. 37 | 38 | DEFINITIONS 39 | "Font Software" refers to the set of files released by the Copyright 40 | Holder(s) under this license and clearly marked as such. This may 41 | include source files, build scripts and documentation. 42 | 43 | "Reserved Font Name" refers to any names specified as such after the 44 | copyright statement(s). 45 | 46 | "Original Version" refers to the collection of Font Software components as 47 | distributed by the Copyright Holder(s). 48 | 49 | "Modified Version" refers to any derivative made by adding to, deleting, 50 | or substituting -- in part or in whole -- any of the components of the 51 | Original Version, by changing formats or by porting the Font Software to a 52 | new environment. 53 | 54 | "Author" refers to any designer, engineer, programmer, technical 55 | writer or other person who contributed to the Font Software. 56 | 57 | PERMISSION & CONDITIONS 58 | Permission is hereby granted, free of charge, to any person obtaining 59 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 60 | redistribute, and sell modified and unmodified copies of the Font 61 | Software, subject to the following conditions: 62 | 63 | 1) Neither the Font Software nor any of its individual components, 64 | in Original or Modified Versions, may be sold by itself. 65 | 66 | 2) Original or Modified Versions of the Font Software may be bundled, 67 | redistributed and/or sold with any software, provided that each copy 68 | contains the above copyright notice and this license. These can be 69 | included either as stand-alone text files, human-readable headers or 70 | in the appropriate machine-readable metadata fields within text or 71 | binary files as long as those fields can be easily viewed by the user. 72 | 73 | 3) No Modified Version of the Font Software may use the Reserved Font 74 | Name(s) unless explicit written permission is granted by the corresponding 75 | Copyright Holder. This restriction only applies to the primary font name as 76 | presented to the users. 77 | 78 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 79 | Software shall not be used to promote, endorse or advertise any 80 | Modified Version, except to acknowledge the contribution(s) of the 81 | Copyright Holder(s) and the Author(s) or with their explicit written 82 | permission. 83 | 84 | 5) The Font Software, modified or unmodified, in part or in whole, 85 | must be distributed entirely under this license, and must not be 86 | distributed under any other license. The requirement for fonts to 87 | remain under this license does not apply to any document created 88 | using the Font Software. 89 | 90 | TERMINATION 91 | This license becomes null and void if any of the above conditions are 92 | not met. 93 | 94 | DISCLAIMER 95 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 96 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 97 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 98 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 99 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 100 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 101 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 102 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 103 | OTHER DEALINGS IN THE FONT SOFTWARE. 104 | -------------------------------------------------------------------------------- /LoongArch-toolchain-conventions-EN.adoc: -------------------------------------------------------------------------------- 1 | = Toolchain Conventions of the LoongArch™ Architecture 2 | Version 1.1 3 | Copyright © Loongson Technology 2023-2024. All rights reserved. 4 | :doctype: article 5 | :title-page: 6 | :icons: font 7 | :toc: macro 8 | :toclevels: 3 9 | :toctitle: 10 | 11 | == Preamble 12 | 13 | This is the official documentation of the toolchain conventions of 14 | the LoongArch™ Architecture. 15 | 16 | The latest releases of this document are available at 17 | https://github.com/loongson/la-toolchain-conventions and are licensed under 18 | the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International 19 | (CC BY-NC-ND 4.0) License. 20 | 21 | To view a copy of this license, visit 22 | http://creativecommons.org/licenses/by-nc-nd/4.0/ 23 | or send a letter to Creative Commons, PO Box 1866, Mountain View, 24 | CA 94042, USA. 25 | 26 | This specification is written in both English and Chinese. In the event of any 27 | inconsistency between the same document version in two languages, the Chinese 28 | version shall prevail. 29 | 30 | NOTE: In this document, the terms "architecture", "instruction set architecture" 31 | and "ISA" are used synonymously to refer to a certain set of instructions and 32 | the set of registers they can operate upon. 33 | 34 | == Version History 35 | 36 | [%header,cols="^2,8"] 37 | |==== 38 | |Version 39 | ^|Description 40 | 41 | |1.0 42 | |initial version, separated from the original __LoongArch Documentation__ repo. 43 | 44 | |1.1 45 | |update the ISA description to include LoongArch v1.1; 46 | introduce the ISA versioning scheme for binary distributions. 47 | |==== 48 | 49 | toc::[] 50 | 51 | 52 | == Compiler Options 53 | 54 | === Rationale 55 | 56 | Compiler options that are specific to LoongArch should denote a change 57 | in the following compiler settings: 58 | 59 | - *Target architecture*: the allowed set of instructions and registers 60 | to be used by the compiler. 61 | 62 | - *Target ABI type*: the data model and calling conventions. 63 | 64 | - *Target microarchitecture*: microarchitectural features that guide 65 | compiler optimizations. 66 | 67 | - *Linking optimizations*: code model selection and linker relaxation. 68 | 69 | === List 70 | 71 | Below is the current list of all LoongArch-specific compiler options that 72 | are supported by a fully conforming compiler. The list will be updated 73 | as more LoongArch features are developed and implemented. 74 | 75 | .LoongArch-specific compiler options 76 | [%header,cols="^2m,^2,^5,^2"] 77 | |=== 78 | |Option 79 | |Possible values 80 | |Description 81 | |Note 82 | 83 | |-march= 84 | |`native` `la64v1.0` `la64v1.1` `loongarch64` `la464` `la664` 85 | |Select the target architecture, i.e. 86 | the basic collection of enabled <>. 87 | | 88 | 89 | |-mtune= 90 | |`native` `generic` `loongarch64` `la464` `la664` 91 | |Select the target microarchitecture, default to the value of `-march=` 92 | or `generic` if that is not possible. 93 | | 94 | 95 | |-mabi= 96 | |`lp64d` `lp64f` `lp64s` `ilp32d` `ilp32f` `ilp32s` 97 | |Select the base ABI type. 98 | | 99 | 100 | |-mfpu= 101 | |`64` `32` `0` `none` (equivalent to `0`) 102 | |Select the allowed set of basic floating-point instructions and registers. 103 | This option should not change the FP calling convention unless it is <>. 104 | (The implementation of this option is not mandatory. It is recommended to use 105 | `-m*-float` options in software projects and scripts.) 106 | | 107 | 108 | |-msimd= 109 | |`none` `lsx` `lasx` 110 | |Select the SIMD extension(s) to be enabled. 111 | |`lasx` implies `lsx` 112 | 113 | 114 | |-mcmodel= 115 | |`normal` `medium` `extreme` 116 | |Select the code model for computing global references. 117 | | 118 | 119 | |-mrelax 120 | |`-m[no-]relax` 121 | |Generate assembly code for linker relaxation. 122 | | 123 | 124 | |-mstrict-align 125 | |`-m[no-]strict-align` 126 | |Do not generate unaligned memory accesses. 127 | Useful for targets that do not support unaligned memory access. 128 | | 129 | 130 | 131 | |-msoft-float 132 | | 133 | |Prevent the compiler from generating hardware floating-point instructions, 134 | and adjust the selected base ABI type to use soft-float calling convention. 135 | (The adjusted base ABI identifier should have suffix `s`.) 136 | | 137 | 138 | |-msingle-float 139 | | 140 | |Enable generation of 32-bit floating-point instructions, 141 | and adjust the selected base ABI type to use 32-bit FP calling convention. 142 | (The adjusted base ABI identifier should have suffix `f`.) 143 | | 144 | 145 | |-mdouble-float 146 | | 147 | |Enable generation of 32- and 64-bit floating-point instructions. 148 | and adjust the selected base ABI type to use 64-bit FP calling convention. 149 | (The adjusted base ABI identifier should have suffix `d`.) 150 | | 151 | 152 | |-mlsx 153 | |`-m[no-]lsx` 154 | |Enable LSX (128-bit) SIMD instructions. 155 | | 156 | 157 | |-mlasx 158 | |`-m[no-]lasx` 159 | |Enable LASX (256-bit) SIMD instructions. 160 | | 161 | 162 | |-mfrecipe 163 | |`-m[no-]frecipe` 164 | |Enable generating approximate reciprocal divide and square root instructions 165 | (`frecipe.{s/d}` and `frsqrte.{s/d}`). 166 | |LoongArch V1.1 167 | 168 | |-mdiv32 169 | |`-m[no-]div32` 170 | |Assume `div.w[u]` and `mod.w[u]` can handle inputs that are not sign-extended. 171 | |LoongArch V1.1 172 | 173 | |-mlam-bh 174 | |`-m[no-]lam-bh` 175 | |Enable atomic operations `am{swap/add}[_db].{b/h}`. 176 | |LoongArch V1.1 177 | 178 | |-mlamcas 179 | |`-m[no-]lamcas` 180 | |Enable atomic compare-and-swap instructions `amcas[_db].{b/h/w/d}`. 181 | |LoongArch V1.1 182 | 183 | |-mld-seq-sa 184 | |`-m[no-]ld-seq-sa` 185 | |Assume no hardware reordering between load operations at the same address. 186 | In this case, do not generate load-load barrier instructions (`dbar 0x700`). 187 | |LoongArch V1.1 188 | 189 | |=== 190 | 191 | NOTE: Valid parameter values of `-march=` and `-mtune=` options should correspond to 192 | actual LoongArch processor models, IP cores, product families or ISA versions. 193 | 194 | For one compilation command, the effective order of all LoongArch-specific 195 | compiler options is computed with the following general rules: 196 | 197 | 1. Within each category in the above tables, only the last-seen option 198 | is effective (`-m*-float` falls into the same category). 199 | 2. `-march=` and `-mabi=` always precede other options. 200 | 3. On the basis of rule 1 and 2, any options with parameters 201 | (i.e. with `=`) precedes all options without parameters. 202 | 4. If the above rule failed to determine the effective order between 203 | two options, unless specified by the following table, they should 204 | have independent meanings. (i.e. the effective order between them 205 | does not affect the compiler's final configuration) 206 | 207 | .Special processing rules for certain compiler option combinations 208 | [%header,cols="^2m,^2,^4"] 209 | |=== 210 | |Option combination 211 | |Compiler behavior 212 | |Description 213 | 214 | |-mfpu=[none\|0\|32] [-ml[a]sx\|-msimd=l[a]sx] 215 | .2+|Abort 216 | .2+|The 64-bit FPU must be present with any SIMD extensions. 217 | 218 | |-m[soft\|single]-float [-ml[a]sx\|-msimd=l[a]sx] 219 | 220 | |-mlasx -mno-lasx 221 | |In this particular order, the two options are cancelled out. 222 | |If LSX was previously disabled by `-march=`, `-msimd=`, `-mno-lsx` 223 | or the compiler's default settings, it should still be disabled. 224 | |=== 225 | 226 | The compiler should reach the final target configuration by applying 227 | the options in their effective order. Options that appears later in 228 | the order can override existing configurations. 229 | 230 | The following sections will cover the details of 231 | the target ISA / ABI configuration items. 232 | 233 | === Configuring the Target ISA 234 | 235 | [[feature-subsets]] 236 | Certain features of the LoongArch ISA may evolve independently and combine freely 237 | in processor implementations. To support the possible variations of a LoongArch target 238 | with a consistent model, we make a modular abstraction of the target ISA, where 239 | an ISA implementation can always be identified as a combination of __feature subsets__. 240 | 241 | The feature subsets are divided into two categories: __base architectures__ and 242 | __ISA extensions__. A base architecture is the core component of the target ISA, 243 | which defines the basic integer and floating-point operations, and an __ISA extension__ 244 | may represent either the base of an extended ISA component or added features in an update. 245 | 246 | <> are some meaningful 247 | combinations of the ISA feature subsets. It is recommended to specify `-march=` first 248 | when composing compiler options for a given target platform. 249 | 250 | image::compiler-isa-config-model-EN.svg[] 251 | 252 | The compiler should at least implement one ISA configuration represented by an 253 | `-march=` parameter value, which includes a base architecture and a number of 254 | ISA extensions. The compiler options that relates to the control of these 255 | extensions should also be implemented. For unimplemented combinations of these 256 | options, the compiler may abort. 257 | 258 | .Base Architecture 259 | [%header,cols="^2,^1,^5"] 260 | |=== 261 | |Name 262 | |Symbol 263 | |Description 264 | 265 | |LoongArch64 base architecture 266 | |`la64` 267 | |ISA defined in __LoongArch Reference Manual - Volume 1: Basic Architecture__ v1.00. 268 | |=== 269 | 270 | The following table lists all ISA extensions that should be abstracted by the compiler 271 | and the options that enable/disable them. 272 | 273 | .ISA extensions 274 | [%header,cols="^2,^1,^2,^5"] 275 | |=== 276 | |Name 277 | |Symbol 278 | |Related option(s) 279 | |Description of the option(s) 280 | 281 | |Basic Floating-Point Processing Unit 282 | .^|`fpu64` `fpu32` `fpunone` 283 | .^|`-mfpu=[none\|32\|64]` 284 | |Selects the allowed set of basic floating-point instructions 285 | and floating-point registers. This is part of the base 286 | architecture, where it gets its default value, but may be 287 | adjusted independently. 288 | 289 | |Loongson SIMD extension 290 | .^|`lsx` 291 | .^|`-m[no-]lsx` 292 | |Allow or do not allow generating LSX 128-bit SIMD instructions. 293 | Enabling `lsx` requires `fpu64`. 294 | 295 | |Loongson Advanced SIMD extension 296 | .^|`lasx` 297 | .^|`-m[no-]lasx` 298 | |Allow or do not allow generating LASX 256-bit SIMD instructions. 299 | Enabling `lasx` requires `lsx`. 300 | 301 | |LoongArch V1.1 features 302 | .^|`v1.1` 303 | |`-m[no-]div32` + 304 | `-m[no-]frecipe` + 305 | `-m[no-]lam-bh` + 306 | `-m[no-]lamcas` + 307 | `-m[no-]ld-seq-sa` 308 | |Enable or disable features introduced by LoongArch V1.1. 309 | The LSX / LASX part of the LoongArch v1.1 update should only be 310 | enabled with `lsx` / `lasx` itself enabled. 311 | |=== 312 | 313 | [[target-presets]] 314 | The following table list the targets that represents specific 315 | LoongArch hardware with microarchitectural features to optimize 316 | for. These are valid parameters to either `-march=` or `-mtune=`. 317 | 318 | .Targets representing specific hardware 319 | [%header,cols="^2,^2,^2"] 320 | |=== 321 | |Name (`-march` parameter) 322 | |ISA feature subsets 323 | |Target of optimization 324 | 325 | |`native` 326 | |auto-detected + 327 | (native compilers only) 328 | |auto-detected microarchitecture model / features 329 | 330 | |`loongarch64` 331 | |`la64` [`fpu64`] 332 | |Generic LoongArch 64-bit (LA64) processors 333 | 334 | |`la464` 335 | |`la64` [`fpu64` `lsx` `lasx`] 336 | |LA464 processor core 337 | 338 | |`la664` 339 | |`la64` [`fpu64` `lsx` `lasx` `v1.1`] 340 | |LA664 processor core 341 | |=== 342 | 343 | Using the namespace of `-march=` targets, we also define a versioning scheme 344 | to promote binary compatibility between LoongArch programs and implementations. 345 | In addition to the IP core / product model names, __ISA versions__ can also be 346 | the parameter of `-march=` options, which are tags that identify sets of 347 | commonly agreed ISA features to be implemented by the processors and used by 348 | the software. It is advisable to use `-march=` as the only 349 | compiler option to describe the target ISA when building binary distributions 350 | of software. 351 | 352 | .ISA version targets 353 | [%header,cols="^1,^1,^1"] 354 | |=== 355 | |Name (`-march=` parameter) 356 | |ISA feature subsets 357 | |Version number (major.minor) 358 | 359 | |`la64v1.0` 360 | |`la64` [`fpu64` `lsx`] 361 | |`1.0` 362 | 363 | |`la64v1.1` 364 | |`la64` [`fpu64` `lsx` `v1.1`] 365 | |`1.1` 366 | |=== 367 | 368 | [[abi-types]] 369 | === Configuring the Target ABI 370 | 371 | Like configuring the target ISA, a complete ABI configuration of LoongArch 372 | consists of two parts, the *base ABI* and the *ABI extension*. The former 373 | describes the data model and calling convention in general, while the latter 374 | denotes an overall adjustment to the base ABI, which may require support 375 | from certain ISA extensions. 376 | 377 | Please be noted that there is only ONE ABI extension slot in an ABI 378 | configuration. They do not combine with one another, 379 | and are, in principle, mutually incompatible. 380 | 381 | A new ABI extension type will not be added to this document unless 382 | it implies certain significant performance / functional advantage 383 | that no compiler optimization techniques can provide without 384 | altering the ABI. 385 | 386 | There are six base ABI types, whose standard names are the same as 387 | the `-mabi` values that select them. The compiler may choose to implement 388 | one or more of these base ABI types, possibly according to the range of 389 | implemented target ISA variants. 390 | 391 | .Base ABI Types 392 | [%header,cols="^1,^1,^1"] 393 | |=== 394 | |Standard name |Data model 395 | |Bit-width of argument / return value GPRs / FPRs 396 | |`lp64d` |LP64 |64 / 64 397 | |`lp64f` |LP64 |64 / 32 398 | |`lp64s` |LP64 |64 / (none) 399 | |`ilp32d` |ILP32 |32 / 64 400 | |`ilp32f` |ILP32 |32 / 32 401 | |`ilp32s` |ILP32 |32 / (none) 402 | |=== 403 | 404 | The following table lists all ABI extension types and 405 | related compiler options. A compiler may choose to implement 406 | any subset of these extensions that contains `base`. 407 | 408 | The default ABI extension type is `base` when referring to 409 | an ABI type with only the "base" component. 410 | 411 | .ABI Extension Types 412 | [%header,cols="^1,^1,^1"] 413 | |=== 414 | |Name 415 | |Compiler options 416 | |Description 417 | 418 | |`base` 419 | |(none) 420 | |conforms to the https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html[LoongArch ELF psABI] 421 | |=== 422 | 423 | [[default-arch-abi]] 424 | The compiler should know the default ABI to use during its build time. 425 | If the ABI extension type is not explicitly configured, 426 | `base` should be used. 427 | 428 | In principle, the target ISA configuration should not affect the decision 429 | of the target ABI. When certain ISA feature required by explicit 430 | (i.e. from the compiler's command-line arguments) ABI configuration 431 | cannot be met due constraints imposed by ISA options, the compiler should 432 | abort with an error message to complain about the conflict. 433 | 434 | When the ABI is not fully constrained by the compiler options, the default 435 | configuration of either the base ABI or the ABI extension, whichever is missing 436 | from the command line, should be attempted. If this default ABI setting 437 | cannot be implemented by the explicitly configured target ISA, the expected 438 | behavior is *undefined* since the user is encouraged to specify which 439 | ABI to use when choosing a smaller instruction set than the default. 440 | 441 | [[abi-fallback]] 442 | In this case, it is suggested that the compiler should abort with 443 | an error message, however, for user-friendliness, it may also choose 444 | to ignore the default base ABI or ABI extension and select a viable 445 | fallback ABI for the currently enabled ISA feature subsets with caution. 446 | It is also recommended that the compiler should notify the user about the 447 | ABI change, optionally with a compiler warning. 448 | For example, passing `-mfpu=none` as the only command-line argument 449 | may cause a compiler configured with `lp64d` / `base` default ABI 450 | to automatically select `lp64s` / `base` instead. 451 | 452 | When the target ISA configuration cannot be uniquely decided from the given 453 | compiler options, the implementation-defined default values should be consulted first. 454 | If the default ISA setting is insufficient for implementing the ABI configuration, 455 | the compiler should try enabling the missing ISA feature subsets according to the 456 | following table, as long as they are not explicitly disabled or excluded from usage. 457 | 458 | .Minimal architecture requirements for implementing each ABI type. 459 | [%header,cols="^1,^1,^1"] 460 | |=== 461 | |Base ABI type 462 | |ABI extension type 463 | |Minimal required ISA feature subsets 464 | 465 | |`lp64d` 466 | |`base` 467 | |`la64` [`fpu64`] 468 | 469 | |`lp64f` 470 | |`base` 471 | |`la64` [`fpu32`] 472 | 473 | |`lp64s` 474 | |`base` 475 | |`la64` [`fpunone`] 476 | |=== 477 | 478 | == GNU Target Triplets and Multiarch Specifiers 479 | 480 | *Target triplet* is a core concept in the GNU build system. 481 | It describes a platform on which the code runs and mostly consists of three fields: 482 | the CPU family / model (`machine`), the vendor (`vendor`), and the operating 483 | system name (`os`). 484 | 485 | *Multiarch architecture apecifiers* are essentially standard directory names 486 | where libraries are installed on a multiarch-flavored filesystem. 487 | These strings are normalized GNU target triplets. See 488 | https://wiki.debian.org/Multiarch/Tuples[debian documentation] for details. 489 | 490 | This document recognizes the following `machine` strings 491 | for the GNU triplets of LoongArch: 492 | 493 | [[machine-strings]] 494 | .LoongArch `machine` strings 495 | [%header,cols="^1,^2"] 496 | |=== 497 | |`machine` 498 | |Description 499 | 500 | |`loongarch64` 501 | |LA64 base architecture (implies `lp64*` ABI) 502 | 503 | |`loongarch32` 504 | |LA32 base architecture (implies `ilp32*` ABI) 505 | |=== 506 | 507 | As standard library directory names, the canonical multiarch architecture specifiers 508 | of LoongArch should contain information about the ABI type of the libraries 509 | that are meant to be released in the binary form and installed there. 510 | 511 | While the integer base ABI is <>, 512 | the floating-point base ABI and the ABI extension type are encoded 513 | with two string suffices (``) to the `os` field of the 514 | specifier, respectively. 515 | 516 | .List of possible `` 517 | [%header,cols="^1,^2"] 518 | |=== 519 | |`` |Description 520 | |(empty string) |The base ABI uses 64-bit FPRs for parameter passing. (`lp64d`) 521 | |`f32` |The base ABI uses 32-bit FPRs for parameter passing. (`lp64f`) 522 | |`sf` |The base ABI uses no FPR for parameter passing. (`lp64s`) 523 | |=== 524 | 525 | .List of possible `` 526 | [%header,cols="^1,^2"] 527 | |=== 528 | |`` |ABI extension type 529 | |(empty string) |`base` 530 | |=== 531 | 532 | .List of LoongArch mulitarch specifiers 533 | [%header,cols="^2,^1,^1,^2"] 534 | |=== 535 | |ABI type + 536 | (Base ABI / ABI extension) 537 | |C Library | Kernel 538 | |Multiarch specifier 539 | 540 | |`lp64d` / `base` 541 | | glibc | Linux 542 | |`loongarch64-linux-gnu` 543 | 544 | |`lp64f` / `base` 545 | | glibc | Linux 546 | |`loongarch64-linux-gnuf32` 547 | 548 | |`lp64s` / `base` 549 | | glibc | Linux 550 | |`loongarch64-linux-gnusf` 551 | 552 | |`lp64d` / `base` 553 | | musl libc | Linux 554 | |`loongarch64-linux-musl` 555 | 556 | |`lp64f` / `base` 557 | | musl libc | Linux 558 | |`loongarch64-linux-muslf32` 559 | 560 | |`lp64s` / `base` 561 | | musl libc | Linux 562 | |`loongarch64-linux-muslsf` 563 | |=== 564 | 565 | == C/C++ Preprocessor Built-in Macro Definitions 566 | 567 | .LoongArch-specific C/C++ Built-in Macros 568 | [%header,cols="^2,^1,^3"] 569 | |=== 570 | |Name 571 | |Possible Values 572 | |Description 573 | 574 | |`\\__loongarch__` 575 | |`1` 576 | |Defined if the target is LoongArch. 577 | 578 | |`__loongarch_grlen` 579 | |`64` 580 | |Bit-width of general purpose registers. 581 | 582 | |`__loongarch_frlen` 583 | |`0` `32` `64` 584 | |Bit-width of floating-point registers (`0` if there is no FPU). 585 | 586 | |`__loongarch_arch` 587 | |`"loongarch64"` `"la464"` `"la664"` `"la64v1.0"` `"la64v1.1"` 588 | |Target ISA preset as specified by `-march=`. 589 | If `-march=` is not present, an implementation-defined default value should be 590 | used. If `-march=native` is enabled (user-specified or the default value), 591 | the result is automatically detected by the compiler. 592 | 593 | |`__loongarch_tune` 594 | |`"generic"` `"loongarch64"` `"la464"` `"la664"` 595 | |Processor model as specified by `-mtune` or its default value. 596 | If `-mtune=native` is enabled (either explicitly given or set with 597 | `-march=native`), the result is automatically detected by the compiler. 598 | 599 | |`__loongarch_lp64` 600 | |`1` or undefined 601 | |Defined if ABI uses the LP64 data model and 64-bit GPRs for parameter passing. 602 | 603 | |`__loongarch_hard_float` 604 | |`1` or undefined 605 | |Defined if floating-point/extended ABI type is `single` or `double`. 606 | 607 | |`__loongarch_soft_float` 608 | |`1` or undefined 609 | |Defined if floating-point/extended ABI type is `soft`. 610 | 611 | |`__loongarch_single_float` 612 | |`1` or undefined 613 | |Defined if floating-point/extended ABI type is `single`. 614 | 615 | |`__loongarch_double_float` 616 | |`1` or undefined 617 | |Defined if floating-point/extended ABI type is `double`. 618 | 619 | |`__loongarch_sx` 620 | |`1` or undefined 621 | |Defined if the compiler enables the `lsx` ISA extension. 622 | 623 | |`__loongarch_asx` 624 | |`1` or undefined 625 | |Defined if the compiler enables the `lasx` ISA extension. 626 | 627 | |`__loongarch_simd_width` 628 | |`128` `256` or undefined 629 | |The maximum SIMD bit-width enabled by the compiler. 630 | (`128` for `lsx`, and `256` for `lasx`) 631 | 632 | |`__loongarch_frecipe` 633 | |`1` or undefined 634 | |Defined if `-mfrecipe` is enabled. 635 | 636 | |`__loongarch_div32` 637 | |`1` or undefined 638 | |Defined if `-mdiv32` is enabled. 639 | 640 | |`__loongarch_lam_bh` 641 | |`1` or undefined 642 | |Defined if `-mlam-bh` is enabled. 643 | 644 | |`__loongarch_lamcas` 645 | |`1` or undefined 646 | |Defined if `-mlamcas` is enabled. 647 | 648 | |`__loongarch_ld_seq_sa` 649 | |`1` or undefined 650 | |Defined if `-mld-seq-sa` is enabled. 651 | 652 | |`__loongarch_version_major` 653 | |`1` or undefined 654 | |The minimally required LoongArch ISA version (major) to run the compiled program. 655 | Undefined if no such version is known to the compiler. 656 | 657 | |`__loongarch_version_minor` 658 | |`0` `1` or undefined 659 | |The minimally required LoongArch ISA version (minor) to run the compiled program. 660 | Undefined if and only if `__loongarch_version_major` is undefined. 661 | |=== 662 | 663 | The non-loongarch-specific macros listed below may also be helpful when composing 664 | code that need to differentiate between ABIs in an architecture-agnostic manner. 665 | 666 | .Non-LoongArch-specific C/C++ Built-in Macros 667 | [%header,cols="^1,^3"] 668 | |=== 669 | |Name 670 | |Description 671 | 672 | |`\\__BYTE_ORDER__` 673 | |Byte order 674 | 675 | |`\\__FLOAT_WORD_ORDER__` 676 | |Byte order for floating-point data 677 | 678 | |`\\__LP64__` `_LP64` 679 | |Whether the ABI passes arguments in 64-bit GPRs and uses the `LP64` data model 680 | 681 | |`\\__SIZEOF_SHORT__` 682 | |Width of C/C++ `short` type, in bytes 683 | 684 | |`\\__SIZEOF_INT__` 685 | |Width of C/C++ `int` type, in bytes 686 | 687 | |`\\__SIZEOF_LONG__` 688 | |Width of C/C++ `long` type, in bytes 689 | 690 | |`\\__SIZEOF_LONG_LONG__` 691 | |Width of C/C++ `long long` type, in bytes 692 | 693 | |`\\__SIZEOF_INT128__` 694 | |Width of C/C++ `__int128` type, in bytes 695 | 696 | |`\\__SIZEOF_POINTER__` 697 | |Width of C/C++ pointer types, in bytes 698 | 699 | |`\\__SIZEOF_PTRDIFF_T__` 700 | |Width of C/C++ `ptrdiff_t` type, in bytes 701 | 702 | |`\\__SIZEOF_SIZE_T__` 703 | |Width of C/C++ `size_t` type, in bytes 704 | 705 | |`\\__SIZEOF_WINT_T__` 706 | |Width of C/C++ `wint_t` type, in bytes 707 | 708 | |`\\__SIZEOF_WCHAR_T__` 709 | |Width of C/C++ `wchar_t` type, in bytes 710 | 711 | |`\\__SIZEOF_FLOAT__` 712 | |Width of C/C++ `float` type, in bytes 713 | 714 | |`\\__SIZEOF_DOUBLE__` 715 | |Width of C/C++ `double` type, in bytes 716 | 717 | |`\\__SIZEOF_LONG_DOUBLE__` 718 | |Width of C/C++ `long double` type, in bytes 719 | |=== 720 | 721 | The following built-in macro definitions are listed for compatibility 722 | with legacy code. New programs should not assume existence of these macros, 723 | and a conforming compiler may choose to implement none or all them. 724 | 725 | .C/C++ Built-in Macros Provided for Compatibility with Legacy Code 726 | [%header,cols="^1,^1,^2"] 727 | |=== 728 | |Name 729 | |Equivalent to 730 | |Description 731 | 732 | |`__loongarch64` 733 | |`__loongarch_grlen == 64` 734 | |Defined iff `__loongarch_grlen == 64`. 735 | 736 | |`_LOONGARCH_ARCH` 737 | |`__loongarch_arch` 738 | | 739 | 740 | |`_LOONGARCH_TUNE` 741 | |`__loongarch_tune` 742 | | 743 | 744 | |`_LOONGARCH_SIM` 745 | | 746 | |Data model of the current ABI. Possible values are `_ABILP64` (LP64 data model) and `_ABILP32` (ILP32 data model). 747 | 748 | |`_LOONGARCH_SZINT` 749 | |`\\__SIZEOF_INT__` multiplied by 8 750 | |Size of the `int` data type in bits. 751 | 752 | |`_LOONGARCH_SZLONG` 753 | |`\\__SIZEOF_LONG__` multiplied by 8 754 | |Size of the `long` data type in bits. 755 | 756 | |`_LOONGARCH_SZPTR` 757 | |`\\__SIZEOF_POINTER__` multiplied by 8 758 | |Size of the pointers in bits. 759 | |=== 760 | -------------------------------------------------------------------------------- /.github/compiler-isa-config-model-EN.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 33 | 39 | 40 | 43 | 47 | 48 | 51 | 55 | 56 | 64 | 70 | 71 | 79 | 85 | 86 | 95 | 101 | 102 | 111 | 117 | 118 | 126 | 132 | 133 | 141 | 147 | 148 | 156 | 162 | 163 | 172 | 178 | 179 | 187 | 193 | 194 | 202 | 208 | 209 | 218 | 224 | 225 | 233 | 239 | 240 | 248 | 254 | 255 | 263 | 269 | 270 | 271 | 300 | 302 | 303 | 305 | image/svg+xml 306 | 308 | 309 | 310 | 311 | 316 | 322 | 325 | 332 | 339 | 343 | 350 | 351 | LA32R 362 | LA32 373 | 377 | 384 | 385 | LA64 396 | 400 | 407 | 408 | 413 | FPU64 424 | 427 | 432 | 439 | Base Architecture 450 | 451 | Updates 462 | Instruction Set Extensions 483 | 490 | 497 | 500 | 507 | Future updates 518 | 525 | 532 | 533 | LSX 544 | LASX 555 | 560 | FPU32 571 | 578 | 581 | 586 | 593 | SIMD Extension 604 | 605 | -mfpu=none 616 | -mlsx 627 | -mlasx 638 | 643 | 650 | -mfpu=32 661 | 664 | Set of ISA modules (base and extensions) initially enabled by -march=* 677 | Incremental changes to the target ISA using options such as -mfpu=* 690 | 695 | 702 | 709 | 710 | 713 | 720 | v1.1 (scalar) 731 | 732 | 735 | 742 | v1.1 (LASX) 752 | 753 | 756 | 763 | v1.1 (LSX) 773 | 774 | 781 | 788 | 792 | 795 | -march=la64v1.0 805 | 812 | 813 | 816 | -march=la64v1.1 824 | 831 | 832 | 836 | 840 | 844 | 845 | 846 | 847 | -------------------------------------------------------------------------------- /images/compiler-isa-config-model-EN.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 33 | 39 | 40 | 43 | 47 | 48 | 51 | 55 | 56 | 64 | 70 | 71 | 79 | 85 | 86 | 95 | 101 | 102 | 111 | 117 | 118 | 126 | 132 | 133 | 141 | 147 | 148 | 156 | 162 | 163 | 172 | 178 | 179 | 187 | 193 | 194 | 202 | 208 | 209 | 218 | 224 | 225 | 233 | 239 | 240 | 248 | 254 | 255 | 263 | 269 | 270 | 271 | 300 | 302 | 303 | 305 | image/svg+xml 306 | 308 | 309 | 310 | 311 | 316 | 322 | 325 | 332 | 339 | 343 | 350 | 351 | LA32R 362 | LA32 373 | 377 | 384 | 385 | LA64 396 | 400 | 407 | 408 | 413 | FPU64 424 | 427 | 432 | 439 | Base Architecture 450 | 451 | Updates 462 | Instruction Set Extensions 483 | 490 | 497 | 500 | 507 | Future updates 518 | 525 | 532 | 533 | LSX 544 | LASX 555 | 560 | FPU32 571 | 578 | 581 | 586 | 593 | SIMD Extension 604 | 605 | -mfpu=none 616 | -mlsx 627 | -mlasx 638 | 643 | 650 | -mfpu=32 661 | 664 | Set of ISA modules (base and extensions) initially enabled by -march=* 677 | Incremental changes to the target ISA using options such as -mfpu=* 690 | 695 | 702 | 709 | 710 | 713 | 720 | v1.1 (scalar) 731 | 732 | 735 | 742 | v1.1 (LASX) 752 | 753 | 756 | 763 | v1.1 (LSX) 773 | 774 | 781 | 788 | 792 | 795 | -march=la64v1.0 805 | 812 | 813 | 816 | -march=la64v1.1 824 | 831 | 832 | 836 | 840 | 844 | 845 | 846 | 847 | --------------------------------------------------------------------------------