1# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14intrinsics_namespace: irtoc 15 16# WARNING: 'class_name' field should be `Irtoc` for all Irtoc intrinsics. If it needs to be changed, fix `is_irtoc?` 17# method in `compiler_intrinsics.rb` file 18 19intrinsics: 20- name: SlowPathEntry 21 class_name: Irtoc 22 method_name: 23 space: core 24 static: true 25 builtin: true 26 codegen_arch: [amd64, arm64, arm32] 27 codegen_func: "CreateIrtocIntrinsic" 28 llvm_codegen_func: EmitSlowPathEntry 29 signature: 30 ret: void 31 args: [] 32 description: Invoke slow path of the entrypoint from the irtoc'ed entrypoint 33 clear_flags: [require_state, can_throw, heap_inv] 34 35- name: SaveRegistersEp 36 class_name: Irtoc 37 method_name: 38 space: core 39 static: true 40 codegen_arch: [amd64, arm64, arm32] 41 codegen_func: "CreateIrtocIntrinsic" 42 llvm_codegen_func: EmitNothing 43 signature: 44 ret: void 45 args: [] 46 description: Save registers before native call 47 clear_flags: [require_state, can_throw, heap_inv] 48 49- name: RestoreRegistersEp 50 class_name: Irtoc 51 method_name: 52 space: core 53 static: true 54 codegen_arch: [amd64, arm64, arm32] 55 codegen_func: "CreateIrtocIntrinsic" 56 llvm_codegen_func: EmitNothing 57 signature: 58 ret: void 59 args: [] 60 description: Restore registers after native call 61 clear_flags: [require_state, can_throw, heap_inv] 62 63- name: Unreachable 64 class_name: Irtoc 65 method_name: 66 space: core 67 static: true 68 codegen_arch: [amd64, arm64, arm32] 69 codegen_func: "CreateIrtocIntrinsic" 70 llvm_codegen_func: EmitUnreachable 71 signature: 72 ret: void 73 args: [] 74 description: Encode trap instruction 75 set_flags: [terminator] 76 clear_flags: [require_state, can_throw, heap_inv] 77 78- name: TailCall 79 class_name: Irtoc 80 method_name: 81 space: core 82 static: true 83 codegen_arch: [ amd64, arm64, arm32 ] 84 codegen_func: "CreateIrtocIntrinsic" 85 llvm_codegen_func: EmitTailCall 86 signature: 87 ret: void 88 args: [] 89 description: Make a tail call 90 set_flags: [terminator, no_dst] 91 clear_flags: [require_state, can_throw, heap_inv] 92 93- name: InterpreterReturn 94 class_name: Irtoc 95 method_name: 96 space: core 97 static: true 98 codegen_arch: [amd64, arm64, arm32] 99 codegen_func: "CreateIrtocIntrinsic" 100 llvm_codegen_func: EmitInterpreterReturn 101 signature: 102 ret: void 103 args: [] 104 clear_flags: [require_state, can_throw, heap_inv] 105 description: Restore registers on return bytecode 106 107- name: LoadAcquireMarkWordExclusive 108 class_name: Irtoc 109 method_name: 110 space: core 111 static: true 112 builtin: true 113 codegen_arch: [arm64, arm32] 114 codegen_func: "CreateIrtocIntrinsic" 115 llvm_codegen_func: EmitExclusiveLoadWithAcquire 116 signature: 117 ret: void 118 args: [] 119 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 120 description: Encode load mark word with acquire semantics for exclusive use 121 122- name: StoreReleaseMarkWordExclusive 123 class_name: Irtoc 124 method_name: 125 space: core 126 static: true 127 builtin: true 128 codegen_arch: [arm64, arm32] 129 codegen_func: "CreateIrtocIntrinsic" 130 llvm_codegen_func: EmitExclusiveStoreWithRelease 131 signature: 132 ret: void 133 args: [] 134 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 135 description: Encode store mark word that was loaded for exclusive use with release semantics 136 137- name: CompareAndSetMarkWord 138 class_name: Irtoc 139 method_name: 140 space: core 141 static: true 142 builtin: true 143 codegen_arch: [amd64] 144 codegen_func: "CreateIrtocIntrinsic" 145 # llvm_codegen_func: unused for arm64 146 signature: 147 ret: void 148 args: [] 149 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 150 description: Encode store mark word using compare and swap 151 152- name: DataMemoryBarrierFull 153 class_name: Irtoc 154 method_name: 155 space: core 156 static: true 157 builtin: true 158 codegen_arch: [arm64, amd64] 159 codegen_func: "CreateIrtocIntrinsic" 160 llvm_codegen_func: EmitMemoryFenceFull 161 signature: 162 ret: void 163 args: [] 164 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 165 description: InnerShareable Full (ACQUIRE + RELEASE) barrier. Ensures the order of memory accesses before and after the barrier. 166 167- name: CompressEightUtf16ToUtf8CharsUsingSimd 168 class_name: Irtoc 169 method_name: 170 space: core 171 static: true 172 builtin: true 173 codegen_arch: [arm64] 174 codegen_func: "CreateIrtocIntrinsic" 175 llvm_codegen_func: EmitCompressEightUtf16ToUtf8CharsUsingSimd 176 signature: 177 ret: void 178 args: [] 179 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 180 description: Compresses eight Utf16 chars (16 bytes) to Utf8 chars (8 bytes) using SIMD instructions 181 182- name: CompressSixteenUtf16ToUtf8CharsUsingSimd 183 class_name: Irtoc 184 method_name: 185 space: core 186 static: true 187 builtin: true 188 codegen_arch: [arm64] 189 codegen_func: "CreateIrtocIntrinsic" 190 llvm_codegen_func: EmitCompressSixteenUtf16ToUtf8CharsUsingSimd 191 signature: 192 ret: void 193 args: [] 194 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 195 description: Compresses sixteen Utf16 chars (32 bytes) to Utf8 chars (16 bytes) using SIMD instructions 196 197- name: WriteTlabStatsSafe 198 class_name: Irtoc 199 method_name: 200 space: core 201 static: true 202 builtin: true 203 codegen_arch: [arm64, arm32, amd64] 204 codegen_func: "CreateIrtocIntrinsic" 205 llvm_codegen_func: EmitWriteTlabStatsSafe 206 signature: # the signature is fake 207 ret: void 208 args: [] 209 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 210 description: calls WriteTlabStats function from inside the IrToc 211 212- name: ReverseBytesU64 213 class_name: Irtoc 214 method_name: 215 space: core 216 static: true 217 builtin: true 218 codegen_arch: [arm64, amd64] 219 codegen_func: "CreateIrtocIntrinsic" 220 llvm_codegen_func: EmitReverseBytes 221 signature: 222 ret: u64 223 args: [ u64 ] 224 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 225 description: Reverse bytes in dword 226 227- name: ReverseBytesU32 228 class_name: Irtoc 229 method_name: 230 space: core 231 static: true 232 builtin: true 233 codegen_arch: [arm64, amd64] 234 codegen_func: "CreateIrtocIntrinsic" 235 llvm_codegen_func: EmitReverseBytes 236 signature: 237 ret: u32 238 args: [ u32 ] 239 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 240 description: Reverse bytes in word 241 242- name: ReverseHalfWords 243 class_name: Irtoc 244 method_name: 245 space: core 246 static: true 247 builtin: true 248 codegen_arch: [arm64, amd64] 249 codegen_func: "CreateIrtocIntrinsic" 250 llvm_codegen_func: EmitReverseHalfWords 251 signature: 252 ret: f64 253 args: [ f64 ] 254 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 255 description: Reverse half-words in the double word 256 257- name: ExpandU8ToU16 258 class_name: Irtoc 259 method_name: 260 space: core 261 static: true 262 builtin: true 263 codegen_arch: [arm64, amd64] 264 codegen_func: "CreateIrtocIntrinsic" 265 llvm_codegen_func: EmitExpandU8U16 266 signature: 267 ret: f64 268 args: [ f64 ] 269 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 270 description: Expand the the lower 4 u8 into 4 u16 271 272- name: AtomicByteOr 273 class_name: Irtoc 274 method_name: 275 space: core 276 static: true 277 builtin: true 278 codegen_arch: [arm64, arm32, amd64] 279 codegen_func: "CreateIrtocIntrinsic" 280 llvm_codegen_func: EmitAtomicByteOr 281 signature: 282 ret: void 283 args: [ u64, u8 ] 284 clear_flags: [runtime_call, require_state, can_throw, heap_inv] 285 description: Atomic bit set on byte in memory, without return 286