| author | |
| committer | |
| log | bf1b9318a9eae002f6e9b9907d0aa149f2838d82 |
| tree | 6859f2af415e2136d35d7d80ef8073b2b30107d2 |
| parent | 7fbeeca924eba1bd33f054e19b2d937446fa228b |
| parent | 2372c68ae82db4b5e8730eb62e5cfb23f9381e59 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31169192 files changed, 1607 insertions(+), 1865 deletions(-)
CMakeLists.txt-175| ... | ... | @@ -205,181 +205,6 @@ set(ZIG_CPP_SOURCES |
| 205 | 205 | set(ZIG_STAGE2_SOURCES |
| 206 | 206 | "${ZIG_CONFIG_ZIG_OUT}" |
| 207 | 207 | lib/compiler_rt.zig |
| 208 | lib/compiler_rt/absv.zig | |
| 209 | lib/compiler_rt/absvdi2.zig | |
| 210 | lib/compiler_rt/absvsi2.zig | |
| 211 | lib/compiler_rt/absvti2.zig | |
| 212 | lib/compiler_rt/adddf3.zig | |
| 213 | lib/compiler_rt/addf3.zig | |
| 214 | lib/compiler_rt/addsf3.zig | |
| 215 | lib/compiler_rt/addtf3.zig | |
| 216 | lib/compiler_rt/addvsi3.zig | |
| 217 | lib/compiler_rt/addvdi3.zig | |
| 218 | lib/compiler_rt/addxf3.zig | |
| 219 | lib/compiler_rt/arm.zig | |
| 220 | lib/compiler_rt/atomics.zig | |
| 221 | lib/compiler_rt/aulldiv.zig | |
| 222 | lib/compiler_rt/aullrem.zig | |
| 223 | lib/compiler_rt/bswap.zig | |
| 224 | lib/compiler_rt/clear_cache.zig | |
| 225 | lib/compiler_rt/cmp.zig | |
| 226 | lib/compiler_rt/cmpdf2.zig | |
| 227 | lib/compiler_rt/cmpsf2.zig | |
| 228 | lib/compiler_rt/cmptf2.zig | |
| 229 | lib/compiler_rt/cmpxf2.zig | |
| 230 | lib/compiler_rt/common.zig | |
| 231 | lib/compiler_rt/comparef.zig | |
| 232 | lib/compiler_rt/cos.zig | |
| 233 | lib/compiler_rt/count0bits.zig | |
| 234 | lib/compiler_rt/divdf3.zig | |
| 235 | lib/compiler_rt/divsf3.zig | |
| 236 | lib/compiler_rt/divtf3.zig | |
| 237 | lib/compiler_rt/divti3.zig | |
| 238 | lib/compiler_rt/divxf3.zig | |
| 239 | lib/compiler_rt/emutls.zig | |
| 240 | lib/compiler_rt/exp.zig | |
| 241 | lib/compiler_rt/exp2.zig | |
| 242 | lib/compiler_rt/extenddftf2.zig | |
| 243 | lib/compiler_rt/extenddfxf2.zig | |
| 244 | lib/compiler_rt/extendf.zig | |
| 245 | lib/compiler_rt/extendhfsf2.zig | |
| 246 | lib/compiler_rt/extendhftf2.zig | |
| 247 | lib/compiler_rt/extendhfxf2.zig | |
| 248 | lib/compiler_rt/extendsfdf2.zig | |
| 249 | lib/compiler_rt/extendsftf2.zig | |
| 250 | lib/compiler_rt/extendsfxf2.zig | |
| 251 | lib/compiler_rt/extendxftf2.zig | |
| 252 | lib/compiler_rt/fabs.zig | |
| 253 | lib/compiler_rt/fixdfdi.zig | |
| 254 | lib/compiler_rt/fixdfsi.zig | |
| 255 | lib/compiler_rt/fixdfti.zig | |
| 256 | lib/compiler_rt/fixhfdi.zig | |
| 257 | lib/compiler_rt/fixhfsi.zig | |
| 258 | lib/compiler_rt/fixhfti.zig | |
| 259 | lib/compiler_rt/fixsfdi.zig | |
| 260 | lib/compiler_rt/fixsfsi.zig | |
| 261 | lib/compiler_rt/fixsfti.zig | |
| 262 | lib/compiler_rt/fixtfdi.zig | |
| 263 | lib/compiler_rt/fixtfsi.zig | |
| 264 | lib/compiler_rt/fixtfti.zig | |
| 265 | lib/compiler_rt/fixunsdfdi.zig | |
| 266 | lib/compiler_rt/fixunsdfsi.zig | |
| 267 | lib/compiler_rt/fixunsdfti.zig | |
| 268 | lib/compiler_rt/fixunshfdi.zig | |
| 269 | lib/compiler_rt/fixunshfsi.zig | |
| 270 | lib/compiler_rt/fixunshfti.zig | |
| 271 | lib/compiler_rt/fixunssfdi.zig | |
| 272 | lib/compiler_rt/fixunssfsi.zig | |
| 273 | lib/compiler_rt/fixunssfti.zig | |
| 274 | lib/compiler_rt/fixunstfdi.zig | |
| 275 | lib/compiler_rt/fixunstfsi.zig | |
| 276 | lib/compiler_rt/fixunstfti.zig | |
| 277 | lib/compiler_rt/fixunsxfdi.zig | |
| 278 | lib/compiler_rt/fixunsxfsi.zig | |
| 279 | lib/compiler_rt/fixunsxfti.zig | |
| 280 | lib/compiler_rt/fixxfdi.zig | |
| 281 | lib/compiler_rt/fixxfsi.zig | |
| 282 | lib/compiler_rt/fixxfti.zig | |
| 283 | lib/compiler_rt/float_from_int.zig | |
| 284 | lib/compiler_rt/floatdidf.zig | |
| 285 | lib/compiler_rt/floatdihf.zig | |
| 286 | lib/compiler_rt/floatdisf.zig | |
| 287 | lib/compiler_rt/floatditf.zig | |
| 288 | lib/compiler_rt/floatdixf.zig | |
| 289 | lib/compiler_rt/floatsidf.zig | |
| 290 | lib/compiler_rt/floatsihf.zig | |
| 291 | lib/compiler_rt/floatsisf.zig | |
| 292 | lib/compiler_rt/floatsitf.zig | |
| 293 | lib/compiler_rt/floatsixf.zig | |
| 294 | lib/compiler_rt/floattidf.zig | |
| 295 | lib/compiler_rt/floattihf.zig | |
| 296 | lib/compiler_rt/floattisf.zig | |
| 297 | lib/compiler_rt/floattitf.zig | |
| 298 | lib/compiler_rt/floattixf.zig | |
| 299 | lib/compiler_rt/floatundidf.zig | |
| 300 | lib/compiler_rt/floatundihf.zig | |
| 301 | lib/compiler_rt/floatundisf.zig | |
| 302 | lib/compiler_rt/floatunditf.zig | |
| 303 | lib/compiler_rt/floatundixf.zig | |
| 304 | lib/compiler_rt/floatunsidf.zig | |
| 305 | lib/compiler_rt/floatunsihf.zig | |
| 306 | lib/compiler_rt/floatunsisf.zig | |
| 307 | lib/compiler_rt/floatunsitf.zig | |
| 308 | lib/compiler_rt/floatunsixf.zig | |
| 309 | lib/compiler_rt/floatuntidf.zig | |
| 310 | lib/compiler_rt/floatuntihf.zig | |
| 311 | lib/compiler_rt/floatuntisf.zig | |
| 312 | lib/compiler_rt/floatuntitf.zig | |
| 313 | lib/compiler_rt/floatuntixf.zig | |
| 314 | lib/compiler_rt/floor_ceil.zig | |
| 315 | lib/compiler_rt/fma.zig | |
| 316 | lib/compiler_rt/fmax.zig | |
| 317 | lib/compiler_rt/fmin.zig | |
| 318 | lib/compiler_rt/fmod.zig | |
| 319 | lib/compiler_rt/gedf2.zig | |
| 320 | lib/compiler_rt/gesf2.zig | |
| 321 | lib/compiler_rt/getf2.zig | |
| 322 | lib/compiler_rt/gexf2.zig | |
| 323 | lib/compiler_rt/int.zig | |
| 324 | lib/compiler_rt/int_from_float.zig | |
| 325 | lib/compiler_rt/log.zig | |
| 326 | lib/compiler_rt/log10.zig | |
| 327 | lib/compiler_rt/log2.zig | |
| 328 | lib/compiler_rt/modti3.zig | |
| 329 | lib/compiler_rt/mulXi3.zig | |
| 330 | lib/compiler_rt/muldf3.zig | |
| 331 | lib/compiler_rt/mulf3.zig | |
| 332 | lib/compiler_rt/mulo.zig | |
| 333 | lib/compiler_rt/mulsf3.zig | |
| 334 | lib/compiler_rt/multf3.zig | |
| 335 | lib/compiler_rt/mulvsi3.zig | |
| 336 | lib/compiler_rt/mulxf3.zig | |
| 337 | lib/compiler_rt/negXi2.zig | |
| 338 | lib/compiler_rt/negdf2.zig | |
| 339 | lib/compiler_rt/negsf2.zig | |
| 340 | lib/compiler_rt/negtf2.zig | |
| 341 | lib/compiler_rt/negv.zig | |
| 342 | lib/compiler_rt/negxf2.zig | |
| 343 | lib/compiler_rt/os_version_check.zig | |
| 344 | lib/compiler_rt/parity.zig | |
| 345 | lib/compiler_rt/popcount.zig | |
| 346 | lib/compiler_rt/rem_pio2.zig | |
| 347 | lib/compiler_rt/rem_pio2_large.zig | |
| 348 | lib/compiler_rt/rem_pio2f.zig | |
| 349 | lib/compiler_rt/round.zig | |
| 350 | lib/compiler_rt/shift.zig | |
| 351 | lib/compiler_rt/sin.zig | |
| 352 | lib/compiler_rt/sincos.zig | |
| 353 | lib/compiler_rt/sqrt.zig | |
| 354 | lib/compiler_rt/stack_probe.zig | |
| 355 | lib/compiler_rt/subdf3.zig | |
| 356 | lib/compiler_rt/subsf3.zig | |
| 357 | lib/compiler_rt/subtf3.zig | |
| 358 | lib/compiler_rt/subvdi3.zig | |
| 359 | lib/compiler_rt/subvsi3.zig | |
| 360 | lib/compiler_rt/subxf3.zig | |
| 361 | lib/compiler_rt/tan.zig | |
| 362 | lib/compiler_rt/trig.zig | |
| 363 | lib/compiler_rt/trunc.zig | |
| 364 | lib/compiler_rt/truncdfhf2.zig | |
| 365 | lib/compiler_rt/truncdfsf2.zig | |
| 366 | lib/compiler_rt/truncf.zig | |
| 367 | lib/compiler_rt/truncsfhf2.zig | |
| 368 | lib/compiler_rt/trunctfdf2.zig | |
| 369 | lib/compiler_rt/trunctfhf2.zig | |
| 370 | lib/compiler_rt/trunctfsf2.zig | |
| 371 | lib/compiler_rt/trunctfxf2.zig | |
| 372 | lib/compiler_rt/truncxfdf2.zig | |
| 373 | lib/compiler_rt/truncxfhf2.zig | |
| 374 | lib/compiler_rt/truncxfsf2.zig | |
| 375 | lib/compiler_rt/udivmod.zig | |
| 376 | lib/compiler_rt/udivmodei4.zig | |
| 377 | lib/compiler_rt/udivmodti4.zig | |
| 378 | lib/compiler_rt/udivti3.zig | |
| 379 | lib/compiler_rt/umodti3.zig | |
| 380 | lib/compiler_rt/unorddf2.zig | |
| 381 | lib/compiler_rt/unordsf2.zig | |
| 382 | lib/compiler_rt/unordtf2.zig | |
| 383 | 208 | lib/std/BitStack.zig |
| 384 | 209 | lib/std/Build.zig |
| 385 | 210 | lib/std/Build/Cache.zig |
lib/compiler_rt.zig+402-23| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | const ofmt_c = builtin.object_format == .c; |
| 3 | const native_endian = builtin.cpu.arch.endian(); | |
| 3 | 4 | |
| 4 | 5 | const std = @import("std"); |
| 5 | 6 | |
| ... | ... | @@ -57,13 +58,12 @@ comptime { |
| 57 | 58 | _ = @import("compiler_rt/cmp.zig"); |
| 58 | 59 | |
| 59 | 60 | _ = @import("compiler_rt/shift.zig"); |
| 60 | _ = @import("compiler_rt/negXi2.zig"); | |
| 61 | symbol(&__negsi2, "__negsi2"); | |
| 62 | symbol(&__negdi2, "__negdi2"); | |
| 63 | symbol(&__negti2, "__negti2"); | |
| 61 | 64 | _ = @import("compiler_rt/int.zig"); |
| 62 | 65 | _ = @import("compiler_rt/mulXi3.zig"); |
| 63 | _ = @import("compiler_rt/divti3.zig"); | |
| 64 | _ = @import("compiler_rt/udivti3.zig"); | |
| 65 | _ = @import("compiler_rt/modti3.zig"); | |
| 66 | _ = @import("compiler_rt/umodti3.zig"); | |
| 66 | _ = @import("compiler_rt/udivmod.zig"); | |
| 67 | 67 | |
| 68 | 68 | _ = @import("compiler_rt/absv.zig"); |
| 69 | 69 | _ = @import("compiler_rt/absvsi2.zig"); |
| ... | ... | @@ -108,9 +108,6 @@ comptime { |
| 108 | 108 | _ = @import("compiler_rt/trunctfxf2.zig"); |
| 109 | 109 | |
| 110 | 110 | _ = @import("compiler_rt/int_from_float.zig"); |
| 111 | _ = @import("compiler_rt/fixhfsi.zig"); | |
| 112 | _ = @import("compiler_rt/fixhfdi.zig"); | |
| 113 | _ = @import("compiler_rt/fixhfti.zig"); | |
| 114 | 111 | _ = @import("compiler_rt/fixhfei.zig"); |
| 115 | 112 | _ = @import("compiler_rt/fixsfsi.zig"); |
| 116 | 113 | _ = @import("compiler_rt/fixsfdi.zig"); |
| ... | ... | @@ -126,8 +123,8 @@ comptime { |
| 126 | 123 | _ = @import("compiler_rt/fixtfei.zig"); |
| 127 | 124 | _ = @import("compiler_rt/fixxfsi.zig"); |
| 128 | 125 | _ = @import("compiler_rt/fixxfdi.zig"); |
| 129 | _ = @import("compiler_rt/fixxfti.zig"); | |
| 130 | 126 | _ = @import("compiler_rt/fixxfei.zig"); |
| 127 | ||
| 131 | 128 | _ = @import("compiler_rt/fixunshfsi.zig"); |
| 132 | 129 | _ = @import("compiler_rt/fixunshfdi.zig"); |
| 133 | 130 | _ = @import("compiler_rt/fixunshfti.zig"); |
| ... | ... | @@ -193,16 +190,10 @@ comptime { |
| 193 | 190 | |
| 194 | 191 | // comparison |
| 195 | 192 | _ = @import("compiler_rt/comparef.zig"); |
| 196 | _ = @import("compiler_rt/cmphf2.zig"); | |
| 197 | _ = @import("compiler_rt/cmpsf2.zig"); | |
| 198 | 193 | _ = @import("compiler_rt/cmpdf2.zig"); |
| 199 | 194 | _ = @import("compiler_rt/cmptf2.zig"); |
| 200 | 195 | _ = @import("compiler_rt/cmpxf2.zig"); |
| 201 | _ = @import("compiler_rt/unordhf2.zig"); | |
| 202 | _ = @import("compiler_rt/unordsf2.zig"); | |
| 203 | 196 | _ = @import("compiler_rt/unorddf2.zig"); |
| 204 | _ = @import("compiler_rt/unordxf2.zig"); | |
| 205 | _ = @import("compiler_rt/unordtf2.zig"); | |
| 206 | 197 | _ = @import("compiler_rt/gehf2.zig"); |
| 207 | 198 | _ = @import("compiler_rt/gesf2.zig"); |
| 208 | 199 | _ = @import("compiler_rt/gedf2.zig"); |
| ... | ... | @@ -236,11 +227,17 @@ comptime { |
| 236 | 227 | _ = @import("compiler_rt/divxf3.zig"); |
| 237 | 228 | _ = @import("compiler_rt/divtf3.zig"); |
| 238 | 229 | |
| 239 | _ = @import("compiler_rt/neghf2.zig"); | |
| 240 | _ = @import("compiler_rt/negsf2.zig"); | |
| 241 | _ = @import("compiler_rt/negdf2.zig"); | |
| 242 | _ = @import("compiler_rt/negtf2.zig"); | |
| 243 | _ = @import("compiler_rt/negxf2.zig"); | |
| 230 | symbol(&__neghf2, "__neghf2"); | |
| 231 | if (want_aeabi) { | |
| 232 | symbol(&__aeabi_fneg, "__aeabi_fneg"); | |
| 233 | symbol(&__aeabi_dneg, "__aeabi_dneg"); | |
| 234 | } else { | |
| 235 | symbol(&__negsf2, "__negsf2"); | |
| 236 | symbol(&__negdf2, "__negdf2"); | |
| 237 | } | |
| 238 | if (want_ppc_abi) symbol(&__negtf2, "__negkf2"); | |
| 239 | symbol(&__negtf2, "__negtf2"); | |
| 240 | symbol(&__negxf2, "__negxf2"); | |
| 244 | 241 | |
| 245 | 242 | // other |
| 246 | 243 | _ = @import("compiler_rt/powiXf2.zig"); |
| ... | ... | @@ -281,7 +278,6 @@ comptime { |
| 281 | 278 | // BigInt. Alphabetically sorted. |
| 282 | 279 | _ = @import("compiler_rt/divmodei4.zig"); |
| 283 | 280 | _ = @import("compiler_rt/udivmodei4.zig"); |
| 284 | _ = @import("compiler_rt/udivmodti4.zig"); | |
| 285 | 281 | |
| 286 | 282 | // extra |
| 287 | 283 | _ = @import("compiler_rt/os_version_check.zig"); |
| ... | ... | @@ -302,10 +298,13 @@ comptime { |
| 302 | 298 | } |
| 303 | 299 | |
| 304 | 300 | _ = @import("compiler_rt/memcpy.zig"); |
| 305 | _ = @import("compiler_rt/memset.zig"); | |
| 301 | if (!ofmt_c) { | |
| 302 | symbol(&memset, "memset"); | |
| 303 | symbol(&__memset, "__memset"); | |
| 304 | } | |
| 306 | 305 | _ = @import("compiler_rt/memmove.zig"); |
| 307 | 306 | symbol(&memcmp, "memcmp"); |
| 308 | _ = @import("compiler_rt/bcmp.zig"); | |
| 307 | symbol(&bcmp, "bcmp"); | |
| 309 | 308 | _ = @import("compiler_rt/ssp.zig"); |
| 310 | 309 | symbol(&strlen, "strlen"); |
| 311 | 310 | } |
| ... | ... | @@ -345,3 +344,383 @@ test "memcmp" { |
| 345 | 344 | try std.testing.expect(memcmp(arr0, arr4, 3) < 0); |
| 346 | 345 | try std.testing.expect(memcmp(arr4, arr0, 3) > 0); |
| 347 | 346 | } |
| 347 | ||
| 348 | pub const PreferredLoadStoreElement = element: { | |
| 349 | if (std.simd.suggestVectorLength(u8)) |vec_size| { | |
| 350 | const Vec = @Vector(vec_size, u8); | |
| 351 | ||
| 352 | if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) { | |
| 353 | break :element Vec; | |
| 354 | } | |
| 355 | } | |
| 356 | break :element usize; | |
| 357 | }; | |
| 358 | ||
| 359 | pub const want_aeabi = switch (builtin.abi) { | |
| 360 | .eabi, | |
| 361 | .eabihf, | |
| 362 | .musleabi, | |
| 363 | .musleabihf, | |
| 364 | .gnueabi, | |
| 365 | .gnueabihf, | |
| 366 | .android, | |
| 367 | .androideabi, | |
| 368 | => switch (builtin.cpu.arch) { | |
| 369 | .arm, .armeb, .thumb, .thumbeb => true, | |
| 370 | else => false, | |
| 371 | }, | |
| 372 | else => false, | |
| 373 | }; | |
| 374 | ||
| 375 | /// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less | |
| 376 | /// builds or when linking MinGW libc they are our responsibility. | |
| 377 | /// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed. | |
| 378 | pub const want_windows_arm_abi = e: { | |
| 379 | if (!builtin.cpu.arch.isArm()) break :e false; | |
| 380 | switch (builtin.os.tag) { | |
| 381 | .windows, .uefi => {}, | |
| 382 | else => break :e false, | |
| 383 | } | |
| 384 | // The ABI is needed, but it's only our reponsibility if libc won't provide it. | |
| 385 | break :e builtin.abi.isGnu() or !builtin.link_libc; | |
| 386 | }; | |
| 387 | ||
| 388 | /// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc, | |
| 389 | /// but in libc-less builds they are our responsibility. | |
| 390 | pub const want_windows_x86_msvc_abi = e: { | |
| 391 | if (builtin.cpu.arch != .x86) break :e false; | |
| 392 | if (builtin.os.tag != .windows) break :e false; | |
| 393 | switch (builtin.abi) { | |
| 394 | .none, .msvc, .itanium => {}, | |
| 395 | else => break :e false, | |
| 396 | } | |
| 397 | // The ABI is needed, but it's only our responsibility if libc won't provide it. | |
| 398 | break :e !builtin.link_libc; | |
| 399 | }; | |
| 400 | ||
| 401 | pub const want_ppc_abi = builtin.cpu.arch.isPowerPC(); | |
| 402 | ||
| 403 | pub const want_float_exceptions = !builtin.cpu.arch.isWasm(); | |
| 404 | ||
| 405 | // Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the | |
| 406 | // calling convention of @Vector(2, u64), rather than what's standard. | |
| 407 | pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c; | |
| 408 | ||
| 409 | /// This governs whether to use these symbol names for f16/f32 conversions | |
| 410 | /// rather than the standard names: | |
| 411 | /// * __gnu_f2h_ieee | |
| 412 | /// * __gnu_h2f_ieee | |
| 413 | /// Known correct configurations: | |
| 414 | /// x86_64-freestanding-none => true | |
| 415 | /// x86_64-linux-none => true | |
| 416 | /// x86_64-linux-gnu => true | |
| 417 | /// x86_64-linux-musl => true | |
| 418 | /// x86_64-linux-eabi => true | |
| 419 | /// arm-linux-musleabihf => true | |
| 420 | /// arm-linux-gnueabihf => true | |
| 421 | /// arm-linux-eabihf => false | |
| 422 | /// wasm32-wasi-musl => false | |
| 423 | /// wasm32-freestanding-none => false | |
| 424 | /// x86_64-windows-gnu => true | |
| 425 | /// x86_64-windows-msvc => true | |
| 426 | /// any-macos-any => false | |
| 427 | pub const gnu_f16_abi = switch (builtin.cpu.arch) { | |
| 428 | .wasm32, | |
| 429 | .wasm64, | |
| 430 | .riscv64, | |
| 431 | .riscv64be, | |
| 432 | .riscv32, | |
| 433 | .riscv32be, | |
| 434 | => false, | |
| 435 | ||
| 436 | .x86, .x86_64 => true, | |
| 437 | ||
| 438 | .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) { | |
| 439 | .eabi, .eabihf => false, | |
| 440 | else => true, | |
| 441 | }, | |
| 442 | ||
| 443 | else => !builtin.os.tag.isDarwin(), | |
| 444 | }; | |
| 445 | ||
| 446 | pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); | |
| 447 | ||
| 448 | /// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`. | |
| 449 | pub fn F16T(comptime OtherType: type) type { | |
| 450 | return switch (builtin.cpu.arch) { | |
| 451 | .amdgcn, | |
| 452 | .arm, | |
| 453 | .armeb, | |
| 454 | .thumb, | |
| 455 | .thumbeb, | |
| 456 | .aarch64, | |
| 457 | .aarch64_be, | |
| 458 | .hexagon, | |
| 459 | .loongarch32, | |
| 460 | .loongarch64, | |
| 461 | .nvptx, | |
| 462 | .nvptx64, | |
| 463 | .riscv32, | |
| 464 | .riscv32be, | |
| 465 | .riscv64, | |
| 466 | .riscv64be, | |
| 467 | .s390x, | |
| 468 | .spirv32, | |
| 469 | .spirv64, | |
| 470 | => f16, | |
| 471 | .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) { | |
| 472 | // Starting with LLVM 16, Darwin uses different abi for f16 | |
| 473 | // depending on the type of the other return/argument..??? | |
| 474 | f32, f64 => u16, | |
| 475 | f80, f128 => f16, | |
| 476 | else => unreachable, | |
| 477 | } else f16, | |
| 478 | else => u16, | |
| 479 | }; | |
| 480 | } | |
| 481 | ||
| 482 | pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { | |
| 483 | switch (Z) { | |
| 484 | u16 => { | |
| 485 | // 16x16 --> 32 bit multiply | |
| 486 | const product = @as(u32, a) * @as(u32, b); | |
| 487 | hi.* = @intCast(product >> 16); | |
| 488 | lo.* = @truncate(product); | |
| 489 | }, | |
| 490 | u32 => { | |
| 491 | // 32x32 --> 64 bit multiply | |
| 492 | const product = @as(u64, a) * @as(u64, b); | |
| 493 | hi.* = @truncate(product >> 32); | |
| 494 | lo.* = @truncate(product); | |
| 495 | }, | |
| 496 | u64 => { | |
| 497 | const S = struct { | |
| 498 | fn loWord(x: u64) u64 { | |
| 499 | return @as(u32, @truncate(x)); | |
| 500 | } | |
| 501 | fn hiWord(x: u64) u64 { | |
| 502 | return @as(u32, @truncate(x >> 32)); | |
| 503 | } | |
| 504 | }; | |
| 505 | // 64x64 -> 128 wide multiply for platforms that don't have such an operation; | |
| 506 | // many 64-bit platforms have this operation, but they tend to have hardware | |
| 507 | // floating-point, so we don't bother with a special case for them here. | |
| 508 | // Each of the component 32x32 -> 64 products | |
| 509 | const plolo: u64 = S.loWord(a) * S.loWord(b); | |
| 510 | const plohi: u64 = S.loWord(a) * S.hiWord(b); | |
| 511 | const philo: u64 = S.hiWord(a) * S.loWord(b); | |
| 512 | const phihi: u64 = S.hiWord(a) * S.hiWord(b); | |
| 513 | // Sum terms that contribute to lo in a way that allows us to get the carry | |
| 514 | const r0: u64 = S.loWord(plolo); | |
| 515 | const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo); | |
| 516 | lo.* = r0 +% (r1 << 32); | |
| 517 | // Sum terms contributing to hi with the carry from lo | |
| 518 | hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi; | |
| 519 | }, | |
| 520 | u128 => { | |
| 521 | const Word_LoMask: u64 = 0x00000000ffffffff; | |
| 522 | const Word_HiMask: u64 = 0xffffffff00000000; | |
| 523 | const Word_FullMask: u64 = 0xffffffffffffffff; | |
| 524 | const S = struct { | |
| 525 | fn Word_1(x: u128) u64 { | |
| 526 | return @as(u32, @truncate(x >> 96)); | |
| 527 | } | |
| 528 | fn Word_2(x: u128) u64 { | |
| 529 | return @as(u32, @truncate(x >> 64)); | |
| 530 | } | |
| 531 | fn Word_3(x: u128) u64 { | |
| 532 | return @as(u32, @truncate(x >> 32)); | |
| 533 | } | |
| 534 | fn Word_4(x: u128) u64 { | |
| 535 | return @as(u32, @truncate(x)); | |
| 536 | } | |
| 537 | }; | |
| 538 | // 128x128 -> 256 wide multiply for platforms that don't have such an operation; | |
| 539 | // many 64-bit platforms have this operation, but they tend to have hardware | |
| 540 | // floating-point, so we don't bother with a special case for them here. | |
| 541 | ||
| 542 | const product11: u64 = S.Word_1(a) * S.Word_1(b); | |
| 543 | const product12: u64 = S.Word_1(a) * S.Word_2(b); | |
| 544 | const product13: u64 = S.Word_1(a) * S.Word_3(b); | |
| 545 | const product14: u64 = S.Word_1(a) * S.Word_4(b); | |
| 546 | const product21: u64 = S.Word_2(a) * S.Word_1(b); | |
| 547 | const product22: u64 = S.Word_2(a) * S.Word_2(b); | |
| 548 | const product23: u64 = S.Word_2(a) * S.Word_3(b); | |
| 549 | const product24: u64 = S.Word_2(a) * S.Word_4(b); | |
| 550 | const product31: u64 = S.Word_3(a) * S.Word_1(b); | |
| 551 | const product32: u64 = S.Word_3(a) * S.Word_2(b); | |
| 552 | const product33: u64 = S.Word_3(a) * S.Word_3(b); | |
| 553 | const product34: u64 = S.Word_3(a) * S.Word_4(b); | |
| 554 | const product41: u64 = S.Word_4(a) * S.Word_1(b); | |
| 555 | const product42: u64 = S.Word_4(a) * S.Word_2(b); | |
| 556 | const product43: u64 = S.Word_4(a) * S.Word_3(b); | |
| 557 | const product44: u64 = S.Word_4(a) * S.Word_4(b); | |
| 558 | ||
| 559 | const sum0: u128 = @as(u128, product44); | |
| 560 | const sum1: u128 = @as(u128, product34) +% | |
| 561 | @as(u128, product43); | |
| 562 | const sum2: u128 = @as(u128, product24) +% | |
| 563 | @as(u128, product33) +% | |
| 564 | @as(u128, product42); | |
| 565 | const sum3: u128 = @as(u128, product14) +% | |
| 566 | @as(u128, product23) +% | |
| 567 | @as(u128, product32) +% | |
| 568 | @as(u128, product41); | |
| 569 | const sum4: u128 = @as(u128, product13) +% | |
| 570 | @as(u128, product22) +% | |
| 571 | @as(u128, product31); | |
| 572 | const sum5: u128 = @as(u128, product12) +% | |
| 573 | @as(u128, product21); | |
| 574 | const sum6: u128 = @as(u128, product11); | |
| 575 | ||
| 576 | const r0: u128 = (sum0 & Word_FullMask) +% | |
| 577 | ((sum1 & Word_LoMask) << 32); | |
| 578 | const r1: u128 = (sum0 >> 64) +% | |
| 579 | ((sum1 >> 32) & Word_FullMask) +% | |
| 580 | (sum2 & Word_FullMask) +% | |
| 581 | ((sum3 << 32) & Word_HiMask); | |
| 582 | ||
| 583 | lo.* = r0 +% (r1 << 64); | |
| 584 | hi.* = (r1 >> 64) +% | |
| 585 | (sum1 >> 96) +% | |
| 586 | (sum2 >> 64) +% | |
| 587 | (sum3 >> 32) +% | |
| 588 | sum4 +% | |
| 589 | (sum5 << 32) +% | |
| 590 | (sum6 << 64); | |
| 591 | }, | |
| 592 | else => @compileError("unsupported"), | |
| 593 | } | |
| 594 | } | |
| 595 | ||
| 596 | pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 { | |
| 597 | const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits); | |
| 598 | const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T); | |
| 599 | ||
| 600 | const shift = @clz(significand.*) - @clz(integerBit); | |
| 601 | significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift)); | |
| 602 | return @as(i32, 1) - shift; | |
| 603 | } | |
| 604 | ||
| 605 | pub inline fn fneg(a: anytype) @TypeOf(a) { | |
| 606 | const F = @TypeOf(a); | |
| 607 | const bits = @typeInfo(F).float.bits; | |
| 608 | const U = @Int(.unsigned, bits); | |
| 609 | const sign_bit_mask = @as(U, 1) << (bits - 1); | |
| 610 | const negated = @as(U, @bitCast(a)) ^ sign_bit_mask; | |
| 611 | return @bitCast(negated); | |
| 612 | } | |
| 613 | ||
| 614 | fn __negxf2(a: f80) callconv(.c) f80 { | |
| 615 | return fneg(a); | |
| 616 | } | |
| 617 | ||
| 618 | fn __neghf2(a: f16) callconv(.c) f16 { | |
| 619 | return fneg(a); | |
| 620 | } | |
| 621 | ||
| 622 | fn __negdf2(a: f64) callconv(.c) f64 { | |
| 623 | return fneg(a); | |
| 624 | } | |
| 625 | ||
| 626 | fn __aeabi_dneg(a: f64) callconv(.{ .arm_aapcs = .{} }) f64 { | |
| 627 | return fneg(a); | |
| 628 | } | |
| 629 | ||
| 630 | fn __negtf2(a: f128) callconv(.c) f128 { | |
| 631 | return fneg(a); | |
| 632 | } | |
| 633 | ||
| 634 | fn __negsf2(a: f32) callconv(.c) f32 { | |
| 635 | return fneg(a); | |
| 636 | } | |
| 637 | ||
| 638 | fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 { | |
| 639 | return fneg(a); | |
| 640 | } | |
| 641 | ||
| 642 | /// Allows to access underlying bits as two equally sized lower and higher | |
| 643 | /// signed or unsigned integers. | |
| 644 | pub fn HalveInt(comptime T: type, comptime signed_half: bool) type { | |
| 645 | return extern union { | |
| 646 | pub const bits = @divExact(@typeInfo(T).int.bits, 2); | |
| 647 | pub const HalfTU = std.meta.Int(.unsigned, bits); | |
| 648 | pub const HalfTS = std.meta.Int(.signed, bits); | |
| 649 | pub const HalfT = if (signed_half) HalfTS else HalfTU; | |
| 650 | ||
| 651 | all: T, | |
| 652 | s: if (native_endian == .little) | |
| 653 | extern struct { low: HalfT, high: HalfT } | |
| 654 | else | |
| 655 | extern struct { high: HalfT, low: HalfT }, | |
| 656 | }; | |
| 657 | } | |
| 658 | ||
| 659 | pub fn __negsi2(a: i32) callconv(.c) i32 { | |
| 660 | return negXi2(i32, a); | |
| 661 | } | |
| 662 | ||
| 663 | pub fn __negdi2(a: i64) callconv(.c) i64 { | |
| 664 | return negXi2(i64, a); | |
| 665 | } | |
| 666 | ||
| 667 | pub fn __negti2(a: i128) callconv(.c) i128 { | |
| 668 | return negXi2(i128, a); | |
| 669 | } | |
| 670 | ||
| 671 | inline fn negXi2(comptime T: type, a: T) T { | |
| 672 | return -a; | |
| 673 | } | |
| 674 | ||
| 675 | pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.c) ?[*]u8 { | |
| 676 | @setRuntimeSafety(false); | |
| 677 | ||
| 678 | if (len != 0) { | |
| 679 | var d = dest.?; | |
| 680 | var n = len; | |
| 681 | while (true) { | |
| 682 | d[0] = c; | |
| 683 | n -= 1; | |
| 684 | if (n == 0) break; | |
| 685 | d += 1; | |
| 686 | } | |
| 687 | } | |
| 688 | ||
| 689 | return dest; | |
| 690 | } | |
| 691 | ||
| 692 | pub fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.c) ?[*]u8 { | |
| 693 | if (dest_n < n) | |
| 694 | @panic("buffer overflow"); | |
| 695 | return memset(dest, c, n); | |
| 696 | } | |
| 697 | ||
| 698 | pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int { | |
| 699 | @setRuntimeSafety(false); | |
| 700 | ||
| 701 | var index: usize = 0; | |
| 702 | while (index != n) : (index += 1) { | |
| 703 | if (vl[index] != vr[index]) { | |
| 704 | return 1; | |
| 705 | } | |
| 706 | } | |
| 707 | ||
| 708 | return 0; | |
| 709 | } | |
| 710 | ||
| 711 | test "bcmp" { | |
| 712 | const base_arr = &[_]u8{ 1, 1, 1 }; | |
| 713 | const arr1 = &[_]u8{ 1, 1, 1 }; | |
| 714 | const arr2 = &[_]u8{ 1, 0, 1 }; | |
| 715 | const arr3 = &[_]u8{ 1, 2, 1 }; | |
| 716 | ||
| 717 | try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0); | |
| 718 | try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0); | |
| 719 | try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0); | |
| 720 | } | |
| 721 | ||
| 722 | test { | |
| 723 | _ = @import("compiler_rt/negsi2_test.zig"); | |
| 724 | _ = @import("compiler_rt/negdi2_test.zig"); | |
| 725 | _ = @import("compiler_rt/negti2_test.zig"); | |
| 726 | } |
lib/compiler_rt/aarch64_outline_atomics.zig+102-101| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | //! This file is generated by tools/gen_outline_atomics.zig. |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const std = @import("std"); |
| 4 | const common = @import("common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 5 | 6 | const always_has_lse = builtin.cpu.has(.aarch64, .lse); |
| 6 | 7 | |
| 7 | 8 | /// This default is overridden at runtime after inspecting CPU properties. |
| ... | ... | @@ -2024,104 +2025,104 @@ fn __aarch64_cas16_acq_rel() align(16) callconv(.naked) void { |
| 2024 | 2025 | } |
| 2025 | 2026 | |
| 2026 | 2027 | comptime { |
| 2027 | @export(&__aarch64_cas1_relax, .{ .name = "__aarch64_cas1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2028 | @export(&__aarch64_swp1_relax, .{ .name = "__aarch64_swp1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2029 | @export(&__aarch64_ldadd1_relax, .{ .name = "__aarch64_ldadd1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2030 | @export(&__aarch64_ldclr1_relax, .{ .name = "__aarch64_ldclr1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2031 | @export(&__aarch64_ldeor1_relax, .{ .name = "__aarch64_ldeor1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2032 | @export(&__aarch64_ldset1_relax, .{ .name = "__aarch64_ldset1_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2033 | @export(&__aarch64_cas1_acq, .{ .name = "__aarch64_cas1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2034 | @export(&__aarch64_swp1_acq, .{ .name = "__aarch64_swp1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2035 | @export(&__aarch64_ldadd1_acq, .{ .name = "__aarch64_ldadd1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2036 | @export(&__aarch64_ldclr1_acq, .{ .name = "__aarch64_ldclr1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2037 | @export(&__aarch64_ldeor1_acq, .{ .name = "__aarch64_ldeor1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2038 | @export(&__aarch64_ldset1_acq, .{ .name = "__aarch64_ldset1_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2039 | @export(&__aarch64_cas1_rel, .{ .name = "__aarch64_cas1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2040 | @export(&__aarch64_swp1_rel, .{ .name = "__aarch64_swp1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2041 | @export(&__aarch64_ldadd1_rel, .{ .name = "__aarch64_ldadd1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2042 | @export(&__aarch64_ldclr1_rel, .{ .name = "__aarch64_ldclr1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2043 | @export(&__aarch64_ldeor1_rel, .{ .name = "__aarch64_ldeor1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2044 | @export(&__aarch64_ldset1_rel, .{ .name = "__aarch64_ldset1_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2045 | @export(&__aarch64_cas1_acq_rel, .{ .name = "__aarch64_cas1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2046 | @export(&__aarch64_swp1_acq_rel, .{ .name = "__aarch64_swp1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2047 | @export(&__aarch64_ldadd1_acq_rel, .{ .name = "__aarch64_ldadd1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2048 | @export(&__aarch64_ldclr1_acq_rel, .{ .name = "__aarch64_ldclr1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2049 | @export(&__aarch64_ldeor1_acq_rel, .{ .name = "__aarch64_ldeor1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2050 | @export(&__aarch64_ldset1_acq_rel, .{ .name = "__aarch64_ldset1_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2051 | @export(&__aarch64_cas2_relax, .{ .name = "__aarch64_cas2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2052 | @export(&__aarch64_swp2_relax, .{ .name = "__aarch64_swp2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2053 | @export(&__aarch64_ldadd2_relax, .{ .name = "__aarch64_ldadd2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2054 | @export(&__aarch64_ldclr2_relax, .{ .name = "__aarch64_ldclr2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2055 | @export(&__aarch64_ldeor2_relax, .{ .name = "__aarch64_ldeor2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2056 | @export(&__aarch64_ldset2_relax, .{ .name = "__aarch64_ldset2_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2057 | @export(&__aarch64_cas2_acq, .{ .name = "__aarch64_cas2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2058 | @export(&__aarch64_swp2_acq, .{ .name = "__aarch64_swp2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2059 | @export(&__aarch64_ldadd2_acq, .{ .name = "__aarch64_ldadd2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2060 | @export(&__aarch64_ldclr2_acq, .{ .name = "__aarch64_ldclr2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2061 | @export(&__aarch64_ldeor2_acq, .{ .name = "__aarch64_ldeor2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2062 | @export(&__aarch64_ldset2_acq, .{ .name = "__aarch64_ldset2_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2063 | @export(&__aarch64_cas2_rel, .{ .name = "__aarch64_cas2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2064 | @export(&__aarch64_swp2_rel, .{ .name = "__aarch64_swp2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2065 | @export(&__aarch64_ldadd2_rel, .{ .name = "__aarch64_ldadd2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2066 | @export(&__aarch64_ldclr2_rel, .{ .name = "__aarch64_ldclr2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2067 | @export(&__aarch64_ldeor2_rel, .{ .name = "__aarch64_ldeor2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2068 | @export(&__aarch64_ldset2_rel, .{ .name = "__aarch64_ldset2_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2069 | @export(&__aarch64_cas2_acq_rel, .{ .name = "__aarch64_cas2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2070 | @export(&__aarch64_swp2_acq_rel, .{ .name = "__aarch64_swp2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2071 | @export(&__aarch64_ldadd2_acq_rel, .{ .name = "__aarch64_ldadd2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2072 | @export(&__aarch64_ldclr2_acq_rel, .{ .name = "__aarch64_ldclr2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2073 | @export(&__aarch64_ldeor2_acq_rel, .{ .name = "__aarch64_ldeor2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2074 | @export(&__aarch64_ldset2_acq_rel, .{ .name = "__aarch64_ldset2_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2075 | @export(&__aarch64_cas4_relax, .{ .name = "__aarch64_cas4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2076 | @export(&__aarch64_swp4_relax, .{ .name = "__aarch64_swp4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2077 | @export(&__aarch64_ldadd4_relax, .{ .name = "__aarch64_ldadd4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2078 | @export(&__aarch64_ldclr4_relax, .{ .name = "__aarch64_ldclr4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2079 | @export(&__aarch64_ldeor4_relax, .{ .name = "__aarch64_ldeor4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2080 | @export(&__aarch64_ldset4_relax, .{ .name = "__aarch64_ldset4_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2081 | @export(&__aarch64_cas4_acq, .{ .name = "__aarch64_cas4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2082 | @export(&__aarch64_swp4_acq, .{ .name = "__aarch64_swp4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2083 | @export(&__aarch64_ldadd4_acq, .{ .name = "__aarch64_ldadd4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2084 | @export(&__aarch64_ldclr4_acq, .{ .name = "__aarch64_ldclr4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2085 | @export(&__aarch64_ldeor4_acq, .{ .name = "__aarch64_ldeor4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2086 | @export(&__aarch64_ldset4_acq, .{ .name = "__aarch64_ldset4_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2087 | @export(&__aarch64_cas4_rel, .{ .name = "__aarch64_cas4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2088 | @export(&__aarch64_swp4_rel, .{ .name = "__aarch64_swp4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2089 | @export(&__aarch64_ldadd4_rel, .{ .name = "__aarch64_ldadd4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2090 | @export(&__aarch64_ldclr4_rel, .{ .name = "__aarch64_ldclr4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2091 | @export(&__aarch64_ldeor4_rel, .{ .name = "__aarch64_ldeor4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2092 | @export(&__aarch64_ldset4_rel, .{ .name = "__aarch64_ldset4_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2093 | @export(&__aarch64_cas4_acq_rel, .{ .name = "__aarch64_cas4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2094 | @export(&__aarch64_swp4_acq_rel, .{ .name = "__aarch64_swp4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2095 | @export(&__aarch64_ldadd4_acq_rel, .{ .name = "__aarch64_ldadd4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2096 | @export(&__aarch64_ldclr4_acq_rel, .{ .name = "__aarch64_ldclr4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2097 | @export(&__aarch64_ldeor4_acq_rel, .{ .name = "__aarch64_ldeor4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2098 | @export(&__aarch64_ldset4_acq_rel, .{ .name = "__aarch64_ldset4_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2099 | @export(&__aarch64_cas8_relax, .{ .name = "__aarch64_cas8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2100 | @export(&__aarch64_swp8_relax, .{ .name = "__aarch64_swp8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2101 | @export(&__aarch64_ldadd8_relax, .{ .name = "__aarch64_ldadd8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2102 | @export(&__aarch64_ldclr8_relax, .{ .name = "__aarch64_ldclr8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2103 | @export(&__aarch64_ldeor8_relax, .{ .name = "__aarch64_ldeor8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2104 | @export(&__aarch64_ldset8_relax, .{ .name = "__aarch64_ldset8_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2105 | @export(&__aarch64_cas8_acq, .{ .name = "__aarch64_cas8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2106 | @export(&__aarch64_swp8_acq, .{ .name = "__aarch64_swp8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2107 | @export(&__aarch64_ldadd8_acq, .{ .name = "__aarch64_ldadd8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2108 | @export(&__aarch64_ldclr8_acq, .{ .name = "__aarch64_ldclr8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2109 | @export(&__aarch64_ldeor8_acq, .{ .name = "__aarch64_ldeor8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2110 | @export(&__aarch64_ldset8_acq, .{ .name = "__aarch64_ldset8_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2111 | @export(&__aarch64_cas8_rel, .{ .name = "__aarch64_cas8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2112 | @export(&__aarch64_swp8_rel, .{ .name = "__aarch64_swp8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2113 | @export(&__aarch64_ldadd8_rel, .{ .name = "__aarch64_ldadd8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2114 | @export(&__aarch64_ldclr8_rel, .{ .name = "__aarch64_ldclr8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2115 | @export(&__aarch64_ldeor8_rel, .{ .name = "__aarch64_ldeor8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2116 | @export(&__aarch64_ldset8_rel, .{ .name = "__aarch64_ldset8_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2117 | @export(&__aarch64_cas8_acq_rel, .{ .name = "__aarch64_cas8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2118 | @export(&__aarch64_swp8_acq_rel, .{ .name = "__aarch64_swp8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2119 | @export(&__aarch64_ldadd8_acq_rel, .{ .name = "__aarch64_ldadd8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2120 | @export(&__aarch64_ldclr8_acq_rel, .{ .name = "__aarch64_ldclr8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2121 | @export(&__aarch64_ldeor8_acq_rel, .{ .name = "__aarch64_ldeor8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2122 | @export(&__aarch64_ldset8_acq_rel, .{ .name = "__aarch64_ldset8_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2123 | @export(&__aarch64_cas16_relax, .{ .name = "__aarch64_cas16_relax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2124 | @export(&__aarch64_cas16_acq, .{ .name = "__aarch64_cas16_acq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2125 | @export(&__aarch64_cas16_rel, .{ .name = "__aarch64_cas16_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2126 | @export(&__aarch64_cas16_acq_rel, .{ .name = "__aarch64_cas16_acq_rel", .linkage = common.linkage, .visibility = common.visibility }); | |
| 2028 | symbol(&__aarch64_cas1_relax, "__aarch64_cas1_relax"); | |
| 2029 | symbol(&__aarch64_swp1_relax, "__aarch64_swp1_relax"); | |
| 2030 | symbol(&__aarch64_ldadd1_relax, "__aarch64_ldadd1_relax"); | |
| 2031 | symbol(&__aarch64_ldclr1_relax, "__aarch64_ldclr1_relax"); | |
| 2032 | symbol(&__aarch64_ldeor1_relax, "__aarch64_ldeor1_relax"); | |
| 2033 | symbol(&__aarch64_ldset1_relax, "__aarch64_ldset1_relax"); | |
| 2034 | symbol(&__aarch64_cas1_acq, "__aarch64_cas1_acq"); | |
| 2035 | symbol(&__aarch64_swp1_acq, "__aarch64_swp1_acq"); | |
| 2036 | symbol(&__aarch64_ldadd1_acq, "__aarch64_ldadd1_acq"); | |
| 2037 | symbol(&__aarch64_ldclr1_acq, "__aarch64_ldclr1_acq"); | |
| 2038 | symbol(&__aarch64_ldeor1_acq, "__aarch64_ldeor1_acq"); | |
| 2039 | symbol(&__aarch64_ldset1_acq, "__aarch64_ldset1_acq"); | |
| 2040 | symbol(&__aarch64_cas1_rel, "__aarch64_cas1_rel"); | |
| 2041 | symbol(&__aarch64_swp1_rel, "__aarch64_swp1_rel"); | |
| 2042 | symbol(&__aarch64_ldadd1_rel, "__aarch64_ldadd1_rel"); | |
| 2043 | symbol(&__aarch64_ldclr1_rel, "__aarch64_ldclr1_rel"); | |
| 2044 | symbol(&__aarch64_ldeor1_rel, "__aarch64_ldeor1_rel"); | |
| 2045 | symbol(&__aarch64_ldset1_rel, "__aarch64_ldset1_rel"); | |
| 2046 | symbol(&__aarch64_cas1_acq_rel, "__aarch64_cas1_acq_rel"); | |
| 2047 | symbol(&__aarch64_swp1_acq_rel, "__aarch64_swp1_acq_rel"); | |
| 2048 | symbol(&__aarch64_ldadd1_acq_rel, "__aarch64_ldadd1_acq_rel"); | |
| 2049 | symbol(&__aarch64_ldclr1_acq_rel, "__aarch64_ldclr1_acq_rel"); | |
| 2050 | symbol(&__aarch64_ldeor1_acq_rel, "__aarch64_ldeor1_acq_rel"); | |
| 2051 | symbol(&__aarch64_ldset1_acq_rel, "__aarch64_ldset1_acq_rel"); | |
| 2052 | symbol(&__aarch64_cas2_relax, "__aarch64_cas2_relax"); | |
| 2053 | symbol(&__aarch64_swp2_relax, "__aarch64_swp2_relax"); | |
| 2054 | symbol(&__aarch64_ldadd2_relax, "__aarch64_ldadd2_relax"); | |
| 2055 | symbol(&__aarch64_ldclr2_relax, "__aarch64_ldclr2_relax"); | |
| 2056 | symbol(&__aarch64_ldeor2_relax, "__aarch64_ldeor2_relax"); | |
| 2057 | symbol(&__aarch64_ldset2_relax, "__aarch64_ldset2_relax"); | |
| 2058 | symbol(&__aarch64_cas2_acq, "__aarch64_cas2_acq"); | |
| 2059 | symbol(&__aarch64_swp2_acq, "__aarch64_swp2_acq"); | |
| 2060 | symbol(&__aarch64_ldadd2_acq, "__aarch64_ldadd2_acq"); | |
| 2061 | symbol(&__aarch64_ldclr2_acq, "__aarch64_ldclr2_acq"); | |
| 2062 | symbol(&__aarch64_ldeor2_acq, "__aarch64_ldeor2_acq"); | |
| 2063 | symbol(&__aarch64_ldset2_acq, "__aarch64_ldset2_acq"); | |
| 2064 | symbol(&__aarch64_cas2_rel, "__aarch64_cas2_rel"); | |
| 2065 | symbol(&__aarch64_swp2_rel, "__aarch64_swp2_rel"); | |
| 2066 | symbol(&__aarch64_ldadd2_rel, "__aarch64_ldadd2_rel"); | |
| 2067 | symbol(&__aarch64_ldclr2_rel, "__aarch64_ldclr2_rel"); | |
| 2068 | symbol(&__aarch64_ldeor2_rel, "__aarch64_ldeor2_rel"); | |
| 2069 | symbol(&__aarch64_ldset2_rel, "__aarch64_ldset2_rel"); | |
| 2070 | symbol(&__aarch64_cas2_acq_rel, "__aarch64_cas2_acq_rel"); | |
| 2071 | symbol(&__aarch64_swp2_acq_rel, "__aarch64_swp2_acq_rel"); | |
| 2072 | symbol(&__aarch64_ldadd2_acq_rel, "__aarch64_ldadd2_acq_rel"); | |
| 2073 | symbol(&__aarch64_ldclr2_acq_rel, "__aarch64_ldclr2_acq_rel"); | |
| 2074 | symbol(&__aarch64_ldeor2_acq_rel, "__aarch64_ldeor2_acq_rel"); | |
| 2075 | symbol(&__aarch64_ldset2_acq_rel, "__aarch64_ldset2_acq_rel"); | |
| 2076 | symbol(&__aarch64_cas4_relax, "__aarch64_cas4_relax"); | |
| 2077 | symbol(&__aarch64_swp4_relax, "__aarch64_swp4_relax"); | |
| 2078 | symbol(&__aarch64_ldadd4_relax, "__aarch64_ldadd4_relax"); | |
| 2079 | symbol(&__aarch64_ldclr4_relax, "__aarch64_ldclr4_relax"); | |
| 2080 | symbol(&__aarch64_ldeor4_relax, "__aarch64_ldeor4_relax"); | |
| 2081 | symbol(&__aarch64_ldset4_relax, "__aarch64_ldset4_relax"); | |
| 2082 | symbol(&__aarch64_cas4_acq, "__aarch64_cas4_acq"); | |
| 2083 | symbol(&__aarch64_swp4_acq, "__aarch64_swp4_acq"); | |
| 2084 | symbol(&__aarch64_ldadd4_acq, "__aarch64_ldadd4_acq"); | |
| 2085 | symbol(&__aarch64_ldclr4_acq, "__aarch64_ldclr4_acq"); | |
| 2086 | symbol(&__aarch64_ldeor4_acq, "__aarch64_ldeor4_acq"); | |
| 2087 | symbol(&__aarch64_ldset4_acq, "__aarch64_ldset4_acq"); | |
| 2088 | symbol(&__aarch64_cas4_rel, "__aarch64_cas4_rel"); | |
| 2089 | symbol(&__aarch64_swp4_rel, "__aarch64_swp4_rel"); | |
| 2090 | symbol(&__aarch64_ldadd4_rel, "__aarch64_ldadd4_rel"); | |
| 2091 | symbol(&__aarch64_ldclr4_rel, "__aarch64_ldclr4_rel"); | |
| 2092 | symbol(&__aarch64_ldeor4_rel, "__aarch64_ldeor4_rel"); | |
| 2093 | symbol(&__aarch64_ldset4_rel, "__aarch64_ldset4_rel"); | |
| 2094 | symbol(&__aarch64_cas4_acq_rel, "__aarch64_cas4_acq_rel"); | |
| 2095 | symbol(&__aarch64_swp4_acq_rel, "__aarch64_swp4_acq_rel"); | |
| 2096 | symbol(&__aarch64_ldadd4_acq_rel, "__aarch64_ldadd4_acq_rel"); | |
| 2097 | symbol(&__aarch64_ldclr4_acq_rel, "__aarch64_ldclr4_acq_rel"); | |
| 2098 | symbol(&__aarch64_ldeor4_acq_rel, "__aarch64_ldeor4_acq_rel"); | |
| 2099 | symbol(&__aarch64_ldset4_acq_rel, "__aarch64_ldset4_acq_rel"); | |
| 2100 | symbol(&__aarch64_cas8_relax, "__aarch64_cas8_relax"); | |
| 2101 | symbol(&__aarch64_swp8_relax, "__aarch64_swp8_relax"); | |
| 2102 | symbol(&__aarch64_ldadd8_relax, "__aarch64_ldadd8_relax"); | |
| 2103 | symbol(&__aarch64_ldclr8_relax, "__aarch64_ldclr8_relax"); | |
| 2104 | symbol(&__aarch64_ldeor8_relax, "__aarch64_ldeor8_relax"); | |
| 2105 | symbol(&__aarch64_ldset8_relax, "__aarch64_ldset8_relax"); | |
| 2106 | symbol(&__aarch64_cas8_acq, "__aarch64_cas8_acq"); | |
| 2107 | symbol(&__aarch64_swp8_acq, "__aarch64_swp8_acq"); | |
| 2108 | symbol(&__aarch64_ldadd8_acq, "__aarch64_ldadd8_acq"); | |
| 2109 | symbol(&__aarch64_ldclr8_acq, "__aarch64_ldclr8_acq"); | |
| 2110 | symbol(&__aarch64_ldeor8_acq, "__aarch64_ldeor8_acq"); | |
| 2111 | symbol(&__aarch64_ldset8_acq, "__aarch64_ldset8_acq"); | |
| 2112 | symbol(&__aarch64_cas8_rel, "__aarch64_cas8_rel"); | |
| 2113 | symbol(&__aarch64_swp8_rel, "__aarch64_swp8_rel"); | |
| 2114 | symbol(&__aarch64_ldadd8_rel, "__aarch64_ldadd8_rel"); | |
| 2115 | symbol(&__aarch64_ldclr8_rel, "__aarch64_ldclr8_rel"); | |
| 2116 | symbol(&__aarch64_ldeor8_rel, "__aarch64_ldeor8_rel"); | |
| 2117 | symbol(&__aarch64_ldset8_rel, "__aarch64_ldset8_rel"); | |
| 2118 | symbol(&__aarch64_cas8_acq_rel, "__aarch64_cas8_acq_rel"); | |
| 2119 | symbol(&__aarch64_swp8_acq_rel, "__aarch64_swp8_acq_rel"); | |
| 2120 | symbol(&__aarch64_ldadd8_acq_rel, "__aarch64_ldadd8_acq_rel"); | |
| 2121 | symbol(&__aarch64_ldclr8_acq_rel, "__aarch64_ldclr8_acq_rel"); | |
| 2122 | symbol(&__aarch64_ldeor8_acq_rel, "__aarch64_ldeor8_acq_rel"); | |
| 2123 | symbol(&__aarch64_ldset8_acq_rel, "__aarch64_ldset8_acq_rel"); | |
| 2124 | symbol(&__aarch64_cas16_relax, "__aarch64_cas16_relax"); | |
| 2125 | symbol(&__aarch64_cas16_acq, "__aarch64_cas16_acq"); | |
| 2126 | symbol(&__aarch64_cas16_rel, "__aarch64_cas16_rel"); | |
| 2127 | symbol(&__aarch64_cas16_acq_rel, "__aarch64_cas16_acq_rel"); | |
| 2127 | 2128 | } |
lib/compiler_rt/absvsi2.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const absv = @import("./absv.zig").absv; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__absvsi2, "__absvsi2"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __absvsi2(a: i32) callconv(.c) i32 { |
lib/compiler_rt/adddf3.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_dadd, "__aeabi_dadd"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__adddf3, "__adddf3"); |
lib/compiler_rt/addf3.zig+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const math = std.math; |
| 3 | const common = @import("./common.zig"); | |
| 4 | const normalize = common.normalize; | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const normalize = compiler_rt.normalize; | |
| 5 | 5 | |
| 6 | 6 | /// Ported from: |
| 7 | 7 | /// |
lib/compiler_rt/addhf3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__addhf3, .{ .name = "__addhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__addhf3, "__addhf3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __addhf3(a: f16, b: f16) callconv(.c) f16 { |
lib/compiler_rt/addsf3.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_fadd, "__aeabi_fadd"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__addsf3, "__addsf3"); |
lib/compiler_rt/addtf3.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__addtf3, .{ .name = "__addkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__addtf3, "__addkf3"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_add, "_Qp_add"); | |
| 9 | 10 | } |
| 10 | @export(&__addtf3, .{ .name = "__addtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__addtf3, "__addtf3"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __addtf3(a: f128, b: f128) callconv(.c) f128 { |
lib/compiler_rt/addvsi3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const testing = @import("std").testing; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__addvsi3, .{ .name = "__addvsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__addvsi3, "__addvsi3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __addvsi3(a: i32, b: i32) callconv(.c) i32 { |
lib/compiler_rt/addxf3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__addxf3, .{ .name = "__addxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__addxf3, "__addxf3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __addxf3(a: f80, b: f80) callconv(.c) f80 { |
lib/compiler_rt/arm.zig+29-28| ... | ... | @@ -4,49 +4,50 @@ const std = @import("std"); |
| 4 | 4 | const builtin = @import("builtin"); |
| 5 | 5 | const target = builtin.target; |
| 6 | 6 | const arch = builtin.cpu.arch; |
| 7 | const common = @import("common.zig"); | |
| 7 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 8 | const symbol = compiler_rt.symbol; | |
| 8 | 9 | |
| 9 | 10 | comptime { |
| 10 | 11 | if (!builtin.is_test) { |
| 11 | 12 | if (arch.isArm()) { |
| 12 | @export(&__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__aeabi_unwind_cpp_pr0, "__aeabi_unwind_cpp_pr0"); | |
| 14 | symbol(&__aeabi_unwind_cpp_pr1, "__aeabi_unwind_cpp_pr1"); | |
| 15 | symbol(&__aeabi_unwind_cpp_pr2, "__aeabi_unwind_cpp_pr2"); | |
| 15 | 16 | |
| 16 | if (common.want_windows_arm_abi) { | |
| 17 | @export(&__aeabi_ldivmod, .{ .name = "__rt_sdiv64", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__aeabi_uldivmod, .{ .name = "__rt_udiv64", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__aeabi_idivmod, .{ .name = "__rt_sdiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__aeabi_uidivmod, .{ .name = "__rt_udiv", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | if (compiler_rt.want_windows_arm_abi) { | |
| 18 | symbol(&__aeabi_ldivmod, "__rt_sdiv64"); | |
| 19 | symbol(&__aeabi_uldivmod, "__rt_udiv64"); | |
| 20 | symbol(&__aeabi_idivmod, "__rt_sdiv"); | |
| 21 | symbol(&__aeabi_uidivmod, "__rt_udiv"); | |
| 21 | 22 | } |
| 22 | @export(&__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | symbol(&__aeabi_ldivmod, "__aeabi_ldivmod"); | |
| 24 | symbol(&__aeabi_uldivmod, "__aeabi_uldivmod"); | |
| 25 | symbol(&__aeabi_idivmod, "__aeabi_idivmod"); | |
| 26 | symbol(&__aeabi_uidivmod, "__aeabi_uidivmod"); | |
| 26 | 27 | |
| 27 | @export(&__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(&__aeabi_memcpy4, .{ .name = "__aeabi_memcpy4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&__aeabi_memcpy8, .{ .name = "__aeabi_memcpy8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | symbol(&__aeabi_memcpy, "__aeabi_memcpy"); | |
| 29 | symbol(&__aeabi_memcpy4, "__aeabi_memcpy4"); | |
| 30 | symbol(&__aeabi_memcpy8, "__aeabi_memcpy8"); | |
| 30 | 31 | |
| 31 | @export(&__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&__aeabi_memmove4, .{ .name = "__aeabi_memmove4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(&__aeabi_memmove8, .{ .name = "__aeabi_memmove8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | symbol(&__aeabi_memmove, "__aeabi_memmove"); | |
| 33 | symbol(&__aeabi_memmove4, "__aeabi_memmove4"); | |
| 34 | symbol(&__aeabi_memmove8, "__aeabi_memmove8"); | |
| 34 | 35 | |
| 35 | @export(&__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 36 | @export(&__aeabi_memset4, .{ .name = "__aeabi_memset4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 37 | @export(&__aeabi_memset8, .{ .name = "__aeabi_memset8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 36 | symbol(&__aeabi_memset, "__aeabi_memset"); | |
| 37 | symbol(&__aeabi_memset4, "__aeabi_memset4"); | |
| 38 | symbol(&__aeabi_memset8, "__aeabi_memset8"); | |
| 38 | 39 | |
| 39 | @export(&__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 40 | @export(&__aeabi_memclr4, .{ .name = "__aeabi_memclr4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 41 | @export(&__aeabi_memclr8, .{ .name = "__aeabi_memclr8", .linkage = common.linkage, .visibility = common.visibility }); | |
| 40 | symbol(&__aeabi_memclr, "__aeabi_memclr"); | |
| 41 | symbol(&__aeabi_memclr4, "__aeabi_memclr4"); | |
| 42 | symbol(&__aeabi_memclr8, "__aeabi_memclr8"); | |
| 42 | 43 | |
| 43 | 44 | if (builtin.os.tag == .linux or builtin.os.tag == .freebsd) { |
| 44 | @export(&__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 45 | symbol(&__aeabi_read_tp, "__aeabi_read_tp"); | |
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | // floating-point helper functions (single+double-precision reverse subtraction, y – x), see subdf3.zig |
| 48 | @export(&__aeabi_frsub, .{ .name = "__aeabi_frsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 49 | @export(&__aeabi_drsub, .{ .name = "__aeabi_drsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 49 | symbol(&__aeabi_frsub, "__aeabi_frsub"); | |
| 50 | symbol(&__aeabi_drsub, "__aeabi_drsub"); | |
| 50 | 51 | } |
| 51 | 52 | } |
| 52 | 53 | } |
lib/compiler_rt/atomics.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const arch = cpu.arch; |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | 6 | |
| 7 | const common = @import("./common.zig"); | |
| 7 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 8 | 8 | const symbol = @import("../compiler_rt.zig").symbol; |
| 9 | 9 | |
| 10 | 10 | // This parameter is true iff the target architecture supports the bare minimum |
lib/compiler_rt/aulldiv.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | 4 | const symbol = @import("../compiler_rt.zig").symbol; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | if (common.want_windows_x86_msvc_abi) { | |
| 7 | if (compiler_rt.want_windows_x86_msvc_abi) { | |
| 8 | 8 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 9 | 9 | symbol(&_alldiv, "\x01__alldiv"); |
| 10 | 10 | symbol(&_aulldiv, "\x01__aulldiv"); |
lib/compiler_rt/aullrem.zig+5-4| ... | ... | @@ -3,13 +3,14 @@ const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | 4 | const os = builtin.os.tag; |
| 5 | 5 | const abi = builtin.abi; |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | const symbol = compiler_rt.symbol; | |
| 7 | 8 | |
| 8 | 9 | comptime { |
| 9 | if (common.want_windows_x86_msvc_abi) { | |
| 10 | if (compiler_rt.want_windows_x86_msvc_abi) { | |
| 10 | 11 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 11 | @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | symbol(&_allrem, "\x01__allrem"); | |
| 13 | symbol(&_aullrem, "\x01__aullrem"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/bcmp.zig deleted-30| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const common = @import("./common.zig"); | |
| 3 | ||
| 4 | comptime { | |
| 5 | @export(&bcmp, .{ .name = "bcmp", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } | |
| 7 | ||
| 8 | pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int { | |
| 9 | @setRuntimeSafety(false); | |
| 10 | ||
| 11 | var index: usize = 0; | |
| 12 | while (index != n) : (index += 1) { | |
| 13 | if (vl[index] != vr[index]) { | |
| 14 | return 1; | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | return 0; | |
| 19 | } | |
| 20 | ||
| 21 | test "bcmp" { | |
| 22 | const base_arr = &[_]u8{ 1, 1, 1 }; | |
| 23 | const arr1 = &[_]u8{ 1, 1, 1 }; | |
| 24 | const arr2 = &[_]u8{ 1, 0, 1 }; | |
| 25 | const arr3 = &[_]u8{ 1, 2, 1 }; | |
| 26 | ||
| 27 | try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0); | |
| 28 | try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0); | |
| 29 | try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0); | |
| 30 | } |
lib/compiler_rt/bitreverse.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | @export(&__bitreversesi2, .{ .name = "__bitreversesi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__bitreversedi2, .{ .name = "__bitreversedi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__bitreverseti2, .{ .name = "__bitreverseti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__bitreversesi2, "__bitreversesi2"); | |
| 8 | symbol(&__bitreversedi2, "__bitreversedi2"); | |
| 9 | symbol(&__bitreverseti2, "__bitreverseti2"); | |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | inline fn bitreverseXi2(comptime T: type, a: T) T { |
lib/compiler_rt/bswap.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | @export(&__bswapsi2, .{ .name = "__bswapsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__bswapdi2, .{ .name = "__bswapdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__bswapti2, .{ .name = "__bswapti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__bswapsi2, "__bswapsi2"); | |
| 8 | symbol(&__bswapdi2, "__bswapdi2"); | |
| 9 | symbol(&__bswapti2, "__bswapti2"); | |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | // bswap - byteswap |
lib/compiler_rt/clear_cache.zig+3-2| ... | ... | @@ -2,7 +2,8 @@ const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | 4 | const os = builtin.os.tag; |
| 5 | const common = @import("common.zig"); | |
| 5 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 6 | const symbol = compiler_rt.symbol; | |
| 6 | 7 | |
| 7 | 8 | // Ported from llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28 |
| 8 | 9 | |
| ... | ... | @@ -188,7 +189,7 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void { |
| 188 | 189 | } |
| 189 | 190 | |
| 190 | 191 | fn exportIt() void { |
| 191 | @export(&clear_cache, .{ .name = "__clear_cache", .linkage = common.linkage, .visibility = common.visibility }); | |
| 192 | symbol(&clear_cache, "__clear_cache"); | |
| 192 | 193 | } |
| 193 | 194 | |
| 194 | 195 | // MIPS-only |
lib/compiler_rt/cmp.zig+8-7| ... | ... | @@ -1,14 +1,15 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | @export(&__cmpsi2, .{ .name = "__cmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | @export(&__cmpdi2, .{ .name = "__cmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__cmpti2, .{ .name = "__cmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__ucmpti2, .{ .name = "__ucmpti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__cmpsi2, "__cmpsi2"); | |
| 8 | symbol(&__cmpdi2, "__cmpdi2"); | |
| 9 | symbol(&__cmpti2, "__cmpti2"); | |
| 10 | symbol(&__ucmpsi2, "__ucmpsi2"); | |
| 11 | symbol(&__ucmpdi2, "__ucmpdi2"); | |
| 12 | symbol(&__ucmpti2, "__ucmpti2"); | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | // cmp - signed compare |
lib/compiler_rt/cmpdf2.zig+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | 4 | const comparef = @import("./comparef.zig"); |
| 5 | 5 | const symbol = @import("../compiler_rt.zig").symbol; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | if (common.want_aeabi) { | |
| 8 | if (compiler_rt.want_aeabi) { | |
| 9 | 9 | symbol(&__aeabi_dcmpeq, "__aeabi_dcmpeq"); |
| 10 | 10 | symbol(&__aeabi_dcmplt, "__aeabi_dcmplt"); |
| 11 | 11 | symbol(&__aeabi_dcmple, "__aeabi_dcmple"); |
lib/compiler_rt/cmphf2.zig deleted-48| ... | ... | @@ -1,48 +0,0 @@ |
| 1 | ///! The quoted behavior definitions are from | |
| 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines | |
| 3 | const common = @import("./common.zig"); | |
| 4 | const comparef = @import("./comparef.zig"); | |
| 5 | ||
| 6 | comptime { | |
| 7 | @export(&__eqhf2, .{ .name = "__eqhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__nehf2, .{ .name = "__nehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__lehf2, .{ .name = "__lehf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__cmphf2, .{ .name = "__cmphf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__lthf2, .{ .name = "__lthf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | } | |
| 13 | ||
| 14 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; | |
| 15 | /// if a is greater than b, they return 1; and if a and b are equal they return 0. | |
| 16 | /// If either argument is NaN they return 1..." | |
| 17 | /// | |
| 18 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, | |
| 19 | /// and `__lthf2`. | |
| 20 | fn __cmphf2(a: f16, b: f16) callconv(.c) i32 { | |
| 21 | return @intFromEnum(comparef.cmpf2(f16, comparef.LE, a, b)); | |
| 22 | } | |
| 23 | ||
| 24 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | |
| 25 | /// and a is less than or equal to b." | |
| 26 | pub fn __lehf2(a: f16, b: f16) callconv(.c) i32 { | |
| 27 | return __cmphf2(a, b); | |
| 28 | } | |
| 29 | ||
| 30 | /// "These functions return zero if neither argument is NaN, and a and b are equal." | |
| 31 | /// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined | |
| 32 | /// to have the same return value. | |
| 33 | pub fn __eqhf2(a: f16, b: f16) callconv(.c) i32 { | |
| 34 | return __cmphf2(a, b); | |
| 35 | } | |
| 36 | ||
| 37 | /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." | |
| 38 | /// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined | |
| 39 | /// to have the same return value. | |
| 40 | pub fn __nehf2(a: f16, b: f16) callconv(.c) i32 { | |
| 41 | return __cmphf2(a, b); | |
| 42 | } | |
| 43 | ||
| 44 | /// "These functions return a value less than zero if neither argument is NaN, and a | |
| 45 | /// is strictly less than b." | |
| 46 | pub fn __lthf2(a: f16, b: f16) callconv(.c) i32 { | |
| 47 | return __cmphf2(a, b); | |
| 48 | } |
lib/compiler_rt/cmpsf2.zig deleted-66| ... | ... | @@ -1,66 +0,0 @@ |
| 1 | ///! The quoted behavior definitions are from | |
| 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines | |
| 3 | const common = @import("./common.zig"); | |
| 4 | const comparef = @import("./comparef.zig"); | |
| 5 | ||
| 6 | comptime { | |
| 7 | if (common.want_aeabi) { | |
| 8 | @export(&__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | } else { | |
| 12 | @export(&__eqsf2, .{ .name = "__eqsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__nesf2, .{ .name = "__nesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__lesf2, .{ .name = "__lesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__cmpsf2, .{ .name = "__cmpsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__ltsf2, .{ .name = "__ltsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; | |
| 21 | /// if a is greater than b, they return 1; and if a and b are equal they return 0. | |
| 22 | /// If either argument is NaN they return 1..." | |
| 23 | /// | |
| 24 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, | |
| 25 | /// and `__ltsf2`. | |
| 26 | fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 27 | return @intFromEnum(comparef.cmpf2(f32, comparef.LE, a, b)); | |
| 28 | } | |
| 29 | ||
| 30 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | |
| 31 | /// and a is less than or equal to b." | |
| 32 | pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 { | |
| 33 | return __cmpsf2(a, b); | |
| 34 | } | |
| 35 | ||
| 36 | /// "These functions return zero if neither argument is NaN, and a and b are equal." | |
| 37 | /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined | |
| 38 | /// to have the same return value. | |
| 39 | pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 40 | return __cmpsf2(a, b); | |
| 41 | } | |
| 42 | ||
| 43 | /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." | |
| 44 | /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined | |
| 45 | /// to have the same return value. | |
| 46 | pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 { | |
| 47 | return __cmpsf2(a, b); | |
| 48 | } | |
| 49 | ||
| 50 | /// "These functions return a value less than zero if neither argument is NaN, and a | |
| 51 | /// is strictly less than b." | |
| 52 | pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 53 | return __cmpsf2(a, b); | |
| 54 | } | |
| 55 | ||
| 56 | fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 57 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Equal); | |
| 58 | } | |
| 59 | ||
| 60 | fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 61 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Less); | |
| 62 | } | |
| 63 | ||
| 64 | fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 65 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) != .Greater); | |
| 66 | } |
lib/compiler_rt/cmptf2.zig+3-3| ... | ... | @@ -1,16 +1,16 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | 4 | const comparef = @import("./comparef.zig"); |
| 5 | 5 | const symbol = @import("../compiler_rt.zig").symbol; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | if (common.want_ppc_abi) { | |
| 8 | if (compiler_rt.want_ppc_abi) { | |
| 9 | 9 | symbol(&__eqtf2, "__eqkf2"); |
| 10 | 10 | symbol(&__netf2, "__nekf2"); |
| 11 | 11 | symbol(&__lttf2, "__ltkf2"); |
| 12 | 12 | symbol(&__letf2, "__lekf2"); |
| 13 | } else if (common.want_sparc_abi) { | |
| 13 | } else if (compiler_rt.want_sparc_abi) { | |
| 14 | 14 | symbol(&_Qp_cmp, "_Qp_cmp"); |
| 15 | 15 | symbol(&_Qp_feq, "_Qp_feq"); |
| 16 | 16 | symbol(&_Qp_fne, "_Qp_fne"); |
lib/compiler_rt/cmpxf2.zig+7-6| ... | ... | @@ -1,14 +1,15 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const comparef = @import("./comparef.zig"); |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__eqxf2, .{ .name = "__eqxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__nexf2, .{ .name = "__nexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__lexf2, .{ .name = "__lexf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__cmpxf2, .{ .name = "__cmpxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__ltxf2, .{ .name = "__ltxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__eqxf2, "__eqxf2"); | |
| 9 | symbol(&__nexf2, "__nexf2"); | |
| 10 | symbol(&__lexf2, "__lexf2"); | |
| 11 | symbol(&__cmpxf2, "__cmpxf2"); | |
| 12 | symbol(&__ltxf2, "__ltxf2"); | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; |
lib/compiler_rt/common.zig deleted-296| ... | ... | @@ -1,296 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const native_endian = builtin.cpu.arch.endian(); | |
| 4 | const ofmt_c = builtin.object_format == .c; | |
| 5 | ||
| 6 | /// Deprecated, everything in common should move to compiler_rt.zig | |
| 7 | pub const linkage = @import("../compiler_rt.zig").linkage; | |
| 8 | ||
| 9 | /// Deprecated, everything in common should move to compiler_rt.zig | |
| 10 | pub const visibility = @import("../compiler_rt.zig").visibility; | |
| 11 | ||
| 12 | pub const PreferredLoadStoreElement = element: { | |
| 13 | if (std.simd.suggestVectorLength(u8)) |vec_size| { | |
| 14 | const Vec = @Vector(vec_size, u8); | |
| 15 | ||
| 16 | if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) { | |
| 17 | break :element Vec; | |
| 18 | } | |
| 19 | } | |
| 20 | break :element usize; | |
| 21 | }; | |
| 22 | ||
| 23 | pub const want_aeabi = switch (builtin.abi) { | |
| 24 | .eabi, | |
| 25 | .eabihf, | |
| 26 | .musleabi, | |
| 27 | .musleabihf, | |
| 28 | .gnueabi, | |
| 29 | .gnueabihf, | |
| 30 | .android, | |
| 31 | .androideabi, | |
| 32 | => switch (builtin.cpu.arch) { | |
| 33 | .arm, .armeb, .thumb, .thumbeb => true, | |
| 34 | else => false, | |
| 35 | }, | |
| 36 | else => false, | |
| 37 | }; | |
| 38 | ||
| 39 | /// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less | |
| 40 | /// builds or when linking MinGW libc they are our responsibility. | |
| 41 | /// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed. | |
| 42 | pub const want_windows_arm_abi = e: { | |
| 43 | if (!builtin.cpu.arch.isArm()) break :e false; | |
| 44 | switch (builtin.os.tag) { | |
| 45 | .windows, .uefi => {}, | |
| 46 | else => break :e false, | |
| 47 | } | |
| 48 | // The ABI is needed, but it's only our reponsibility if libc won't provide it. | |
| 49 | break :e builtin.abi.isGnu() or !builtin.link_libc; | |
| 50 | }; | |
| 51 | ||
| 52 | /// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc, | |
| 53 | /// but in libc-less builds they are our responsibility. | |
| 54 | pub const want_windows_x86_msvc_abi = e: { | |
| 55 | if (builtin.cpu.arch != .x86) break :e false; | |
| 56 | if (builtin.os.tag != .windows) break :e false; | |
| 57 | switch (builtin.abi) { | |
| 58 | .none, .msvc, .itanium => {}, | |
| 59 | else => break :e false, | |
| 60 | } | |
| 61 | // The ABI is needed, but it's only our responsibility if libc won't provide it. | |
| 62 | break :e !builtin.link_libc; | |
| 63 | }; | |
| 64 | ||
| 65 | pub const want_ppc_abi = builtin.cpu.arch.isPowerPC(); | |
| 66 | ||
| 67 | pub const want_float_exceptions = !builtin.cpu.arch.isWasm(); | |
| 68 | ||
| 69 | // Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the | |
| 70 | // calling convention of @Vector(2, u64), rather than what's standard. | |
| 71 | pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c; | |
| 72 | ||
| 73 | /// This governs whether to use these symbol names for f16/f32 conversions | |
| 74 | /// rather than the standard names: | |
| 75 | /// * __gnu_f2h_ieee | |
| 76 | /// * __gnu_h2f_ieee | |
| 77 | /// Known correct configurations: | |
| 78 | /// x86_64-freestanding-none => true | |
| 79 | /// x86_64-linux-none => true | |
| 80 | /// x86_64-linux-gnu => true | |
| 81 | /// x86_64-linux-musl => true | |
| 82 | /// x86_64-linux-eabi => true | |
| 83 | /// arm-linux-musleabihf => true | |
| 84 | /// arm-linux-gnueabihf => true | |
| 85 | /// arm-linux-eabihf => false | |
| 86 | /// wasm32-wasi-musl => false | |
| 87 | /// wasm32-freestanding-none => false | |
| 88 | /// x86_64-windows-gnu => true | |
| 89 | /// x86_64-windows-msvc => true | |
| 90 | /// any-macos-any => false | |
| 91 | pub const gnu_f16_abi = switch (builtin.cpu.arch) { | |
| 92 | .wasm32, | |
| 93 | .wasm64, | |
| 94 | .riscv64, | |
| 95 | .riscv64be, | |
| 96 | .riscv32, | |
| 97 | .riscv32be, | |
| 98 | => false, | |
| 99 | ||
| 100 | .x86, .x86_64 => true, | |
| 101 | ||
| 102 | .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) { | |
| 103 | .eabi, .eabihf => false, | |
| 104 | else => true, | |
| 105 | }, | |
| 106 | ||
| 107 | else => !builtin.os.tag.isDarwin(), | |
| 108 | }; | |
| 109 | ||
| 110 | pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); | |
| 111 | ||
| 112 | /// Deprecated, everything in common should move to compiler_rt.zig | |
| 113 | pub const test_safety = @import("../compiler_rt.zig").test_safety; | |
| 114 | ||
| 115 | /// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`. | |
| 116 | pub fn F16T(comptime OtherType: type) type { | |
| 117 | return switch (builtin.cpu.arch) { | |
| 118 | .amdgcn, | |
| 119 | .arm, | |
| 120 | .armeb, | |
| 121 | .thumb, | |
| 122 | .thumbeb, | |
| 123 | .aarch64, | |
| 124 | .aarch64_be, | |
| 125 | .hexagon, | |
| 126 | .loongarch32, | |
| 127 | .loongarch64, | |
| 128 | .nvptx, | |
| 129 | .nvptx64, | |
| 130 | .riscv32, | |
| 131 | .riscv32be, | |
| 132 | .riscv64, | |
| 133 | .riscv64be, | |
| 134 | .s390x, | |
| 135 | .spirv32, | |
| 136 | .spirv64, | |
| 137 | => f16, | |
| 138 | .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) { | |
| 139 | // Starting with LLVM 16, Darwin uses different abi for f16 | |
| 140 | // depending on the type of the other return/argument..??? | |
| 141 | f32, f64 => u16, | |
| 142 | f80, f128 => f16, | |
| 143 | else => unreachable, | |
| 144 | } else f16, | |
| 145 | else => u16, | |
| 146 | }; | |
| 147 | } | |
| 148 | ||
| 149 | pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void { | |
| 150 | switch (Z) { | |
| 151 | u16 => { | |
| 152 | // 16x16 --> 32 bit multiply | |
| 153 | const product = @as(u32, a) * @as(u32, b); | |
| 154 | hi.* = @intCast(product >> 16); | |
| 155 | lo.* = @truncate(product); | |
| 156 | }, | |
| 157 | u32 => { | |
| 158 | // 32x32 --> 64 bit multiply | |
| 159 | const product = @as(u64, a) * @as(u64, b); | |
| 160 | hi.* = @truncate(product >> 32); | |
| 161 | lo.* = @truncate(product); | |
| 162 | }, | |
| 163 | u64 => { | |
| 164 | const S = struct { | |
| 165 | fn loWord(x: u64) u64 { | |
| 166 | return @as(u32, @truncate(x)); | |
| 167 | } | |
| 168 | fn hiWord(x: u64) u64 { | |
| 169 | return @as(u32, @truncate(x >> 32)); | |
| 170 | } | |
| 171 | }; | |
| 172 | // 64x64 -> 128 wide multiply for platforms that don't have such an operation; | |
| 173 | // many 64-bit platforms have this operation, but they tend to have hardware | |
| 174 | // floating-point, so we don't bother with a special case for them here. | |
| 175 | // Each of the component 32x32 -> 64 products | |
| 176 | const plolo: u64 = S.loWord(a) * S.loWord(b); | |
| 177 | const plohi: u64 = S.loWord(a) * S.hiWord(b); | |
| 178 | const philo: u64 = S.hiWord(a) * S.loWord(b); | |
| 179 | const phihi: u64 = S.hiWord(a) * S.hiWord(b); | |
| 180 | // Sum terms that contribute to lo in a way that allows us to get the carry | |
| 181 | const r0: u64 = S.loWord(plolo); | |
| 182 | const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo); | |
| 183 | lo.* = r0 +% (r1 << 32); | |
| 184 | // Sum terms contributing to hi with the carry from lo | |
| 185 | hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi; | |
| 186 | }, | |
| 187 | u128 => { | |
| 188 | const Word_LoMask: u64 = 0x00000000ffffffff; | |
| 189 | const Word_HiMask: u64 = 0xffffffff00000000; | |
| 190 | const Word_FullMask: u64 = 0xffffffffffffffff; | |
| 191 | const S = struct { | |
| 192 | fn Word_1(x: u128) u64 { | |
| 193 | return @as(u32, @truncate(x >> 96)); | |
| 194 | } | |
| 195 | fn Word_2(x: u128) u64 { | |
| 196 | return @as(u32, @truncate(x >> 64)); | |
| 197 | } | |
| 198 | fn Word_3(x: u128) u64 { | |
| 199 | return @as(u32, @truncate(x >> 32)); | |
| 200 | } | |
| 201 | fn Word_4(x: u128) u64 { | |
| 202 | return @as(u32, @truncate(x)); | |
| 203 | } | |
| 204 | }; | |
| 205 | // 128x128 -> 256 wide multiply for platforms that don't have such an operation; | |
| 206 | // many 64-bit platforms have this operation, but they tend to have hardware | |
| 207 | // floating-point, so we don't bother with a special case for them here. | |
| 208 | ||
| 209 | const product11: u64 = S.Word_1(a) * S.Word_1(b); | |
| 210 | const product12: u64 = S.Word_1(a) * S.Word_2(b); | |
| 211 | const product13: u64 = S.Word_1(a) * S.Word_3(b); | |
| 212 | const product14: u64 = S.Word_1(a) * S.Word_4(b); | |
| 213 | const product21: u64 = S.Word_2(a) * S.Word_1(b); | |
| 214 | const product22: u64 = S.Word_2(a) * S.Word_2(b); | |
| 215 | const product23: u64 = S.Word_2(a) * S.Word_3(b); | |
| 216 | const product24: u64 = S.Word_2(a) * S.Word_4(b); | |
| 217 | const product31: u64 = S.Word_3(a) * S.Word_1(b); | |
| 218 | const product32: u64 = S.Word_3(a) * S.Word_2(b); | |
| 219 | const product33: u64 = S.Word_3(a) * S.Word_3(b); | |
| 220 | const product34: u64 = S.Word_3(a) * S.Word_4(b); | |
| 221 | const product41: u64 = S.Word_4(a) * S.Word_1(b); | |
| 222 | const product42: u64 = S.Word_4(a) * S.Word_2(b); | |
| 223 | const product43: u64 = S.Word_4(a) * S.Word_3(b); | |
| 224 | const product44: u64 = S.Word_4(a) * S.Word_4(b); | |
| 225 | ||
| 226 | const sum0: u128 = @as(u128, product44); | |
| 227 | const sum1: u128 = @as(u128, product34) +% | |
| 228 | @as(u128, product43); | |
| 229 | const sum2: u128 = @as(u128, product24) +% | |
| 230 | @as(u128, product33) +% | |
| 231 | @as(u128, product42); | |
| 232 | const sum3: u128 = @as(u128, product14) +% | |
| 233 | @as(u128, product23) +% | |
| 234 | @as(u128, product32) +% | |
| 235 | @as(u128, product41); | |
| 236 | const sum4: u128 = @as(u128, product13) +% | |
| 237 | @as(u128, product22) +% | |
| 238 | @as(u128, product31); | |
| 239 | const sum5: u128 = @as(u128, product12) +% | |
| 240 | @as(u128, product21); | |
| 241 | const sum6: u128 = @as(u128, product11); | |
| 242 | ||
| 243 | const r0: u128 = (sum0 & Word_FullMask) +% | |
| 244 | ((sum1 & Word_LoMask) << 32); | |
| 245 | const r1: u128 = (sum0 >> 64) +% | |
| 246 | ((sum1 >> 32) & Word_FullMask) +% | |
| 247 | (sum2 & Word_FullMask) +% | |
| 248 | ((sum3 << 32) & Word_HiMask); | |
| 249 | ||
| 250 | lo.* = r0 +% (r1 << 64); | |
| 251 | hi.* = (r1 >> 64) +% | |
| 252 | (sum1 >> 96) +% | |
| 253 | (sum2 >> 64) +% | |
| 254 | (sum3 >> 32) +% | |
| 255 | sum4 +% | |
| 256 | (sum5 << 32) +% | |
| 257 | (sum6 << 64); | |
| 258 | }, | |
| 259 | else => @compileError("unsupported"), | |
| 260 | } | |
| 261 | } | |
| 262 | ||
| 263 | pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 { | |
| 264 | const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits); | |
| 265 | const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T); | |
| 266 | ||
| 267 | const shift = @clz(significand.*) - @clz(integerBit); | |
| 268 | significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift)); | |
| 269 | return @as(i32, 1) - shift; | |
| 270 | } | |
| 271 | ||
| 272 | pub inline fn fneg(a: anytype) @TypeOf(a) { | |
| 273 | const F = @TypeOf(a); | |
| 274 | const bits = @typeInfo(F).float.bits; | |
| 275 | const U = @Int(.unsigned, bits); | |
| 276 | const sign_bit_mask = @as(U, 1) << (bits - 1); | |
| 277 | const negated = @as(U, @bitCast(a)) ^ sign_bit_mask; | |
| 278 | return @bitCast(negated); | |
| 279 | } | |
| 280 | ||
| 281 | /// Allows to access underlying bits as two equally sized lower and higher | |
| 282 | /// signed or unsigned integers. | |
| 283 | pub fn HalveInt(comptime T: type, comptime signed_half: bool) type { | |
| 284 | return extern union { | |
| 285 | pub const bits = @divExact(@typeInfo(T).int.bits, 2); | |
| 286 | pub const HalfTU = std.meta.Int(.unsigned, bits); | |
| 287 | pub const HalfTS = std.meta.Int(.signed, bits); | |
| 288 | pub const HalfT = if (signed_half) HalfTS else HalfTU; | |
| 289 | ||
| 290 | all: T, | |
| 291 | s: if (native_endian == .little) | |
| 292 | extern struct { low: HalfT, high: HalfT } | |
| 293 | else | |
| 294 | extern struct { high: HalfT, low: HalfT }, | |
| 295 | }; | |
| 296 | } |
lib/compiler_rt/comparef.zig+144| ... | ... | @@ -1,5 +1,149 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 5 | ||
| 6 | comptime { | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_fcmpun, "__aeabi_fcmpun"); | |
| 9 | } else { | |
| 10 | symbol(&__unordsf2, "__unordsf2"); | |
| 11 | } | |
| 12 | ||
| 13 | symbol(&__unordxf2, "__unordxf2"); | |
| 14 | ||
| 15 | symbol(&__eqhf2, "__eqhf2"); | |
| 16 | symbol(&__nehf2, "__nehf2"); | |
| 17 | symbol(&__lehf2, "__lehf2"); | |
| 18 | symbol(&__cmphf2, "__cmphf2"); | |
| 19 | symbol(&__lthf2, "__lthf2"); | |
| 20 | ||
| 21 | if (compiler_rt.want_aeabi) { | |
| 22 | symbol(&__aeabi_fcmpeq, "__aeabi_fcmpeq"); | |
| 23 | symbol(&__aeabi_fcmplt, "__aeabi_fcmplt"); | |
| 24 | symbol(&__aeabi_fcmple, "__aeabi_fcmple"); | |
| 25 | } else { | |
| 26 | symbol(&__eqsf2, "__eqsf2"); | |
| 27 | symbol(&__nesf2, "__nesf2"); | |
| 28 | symbol(&__lesf2, "__lesf2"); | |
| 29 | symbol(&__cmpsf2, "__cmpsf2"); | |
| 30 | symbol(&__ltsf2, "__ltsf2"); | |
| 31 | } | |
| 32 | ||
| 33 | if (compiler_rt.want_ppc_abi) { | |
| 34 | symbol(&__unordtf2, "__unordkf2"); | |
| 35 | } else if (compiler_rt.want_sparc_abi) { | |
| 36 | // These exports are handled in cmptf2.zig because unordered comparisons | |
| 37 | // are based on calling _Qp_cmp. | |
| 38 | } | |
| 39 | symbol(&__unordtf2, "__unordtf2"); | |
| 40 | symbol(&__unordhf2, "__unordhf2"); | |
| 41 | } | |
| 42 | ||
| 43 | pub fn __unordhf2(a: f16, b: f16) callconv(.c) i32 { | |
| 44 | return unordcmp(f16, a, b); | |
| 45 | } | |
| 46 | ||
| 47 | pub fn __unordtf2(a: f128, b: f128) callconv(.c) i32 { | |
| 48 | return unordcmp(f128, a, b); | |
| 49 | } | |
| 50 | ||
| 51 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; | |
| 52 | /// if a is greater than b, they return 1; and if a and b are equal they return 0. | |
| 53 | /// If either argument is NaN they return 1..." | |
| 54 | /// | |
| 55 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, | |
| 56 | /// and `__ltsf2`. | |
| 57 | fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 58 | return @intFromEnum(cmpf2(f32, LE, a, b)); | |
| 59 | } | |
| 60 | ||
| 61 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | |
| 62 | /// and a is less than or equal to b." | |
| 63 | pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 { | |
| 64 | return __cmpsf2(a, b); | |
| 65 | } | |
| 66 | ||
| 67 | /// "These functions return zero if neither argument is NaN, and a and b are equal." | |
| 68 | /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined | |
| 69 | /// to have the same return value. | |
| 70 | pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 71 | return __cmpsf2(a, b); | |
| 72 | } | |
| 73 | ||
| 74 | /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." | |
| 75 | /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined | |
| 76 | /// to have the same return value. | |
| 77 | pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 { | |
| 78 | return __cmpsf2(a, b); | |
| 79 | } | |
| 80 | ||
| 81 | /// "These functions return a value less than zero if neither argument is NaN, and a | |
| 82 | /// is strictly less than b." | |
| 83 | pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 84 | return __cmpsf2(a, b); | |
| 85 | } | |
| 86 | ||
| 87 | fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 88 | return @intFromBool(cmpf2(f32, LE, a, b) == .Equal); | |
| 89 | } | |
| 90 | ||
| 91 | fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 92 | return @intFromBool(cmpf2(f32, LE, a, b) == .Less); | |
| 93 | } | |
| 94 | ||
| 95 | fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 96 | return @intFromBool(cmpf2(f32, LE, a, b) != .Greater); | |
| 97 | } | |
| 98 | ||
| 99 | /// "These functions calculate a <=> b. That is, if a is less than b, they return -1; | |
| 100 | /// if a is greater than b, they return 1; and if a and b are equal they return 0. | |
| 101 | /// If either argument is NaN they return 1..." | |
| 102 | /// | |
| 103 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, | |
| 104 | /// and `__lthf2`. | |
| 105 | fn __cmphf2(a: f16, b: f16) callconv(.c) i32 { | |
| 106 | return @intFromEnum(cmpf2(f16, LE, a, b)); | |
| 107 | } | |
| 108 | ||
| 109 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | |
| 110 | /// and a is less than or equal to b." | |
| 111 | fn __lehf2(a: f16, b: f16) callconv(.c) i32 { | |
| 112 | return __cmphf2(a, b); | |
| 113 | } | |
| 114 | ||
| 115 | /// "These functions return zero if neither argument is NaN, and a and b are equal." | |
| 116 | /// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined | |
| 117 | /// to have the same return value. | |
| 118 | fn __eqhf2(a: f16, b: f16) callconv(.c) i32 { | |
| 119 | return __cmphf2(a, b); | |
| 120 | } | |
| 121 | ||
| 122 | /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." | |
| 123 | /// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined | |
| 124 | /// to have the same return value. | |
| 125 | fn __nehf2(a: f16, b: f16) callconv(.c) i32 { | |
| 126 | return __cmphf2(a, b); | |
| 127 | } | |
| 128 | ||
| 129 | /// "These functions return a value less than zero if neither argument is NaN, and a | |
| 130 | /// is strictly less than b." | |
| 131 | fn __lthf2(a: f16, b: f16) callconv(.c) i32 { | |
| 132 | return __cmphf2(a, b); | |
| 133 | } | |
| 134 | ||
| 135 | fn __unordxf2(a: f80, b: f80) callconv(.c) i32 { | |
| 136 | return unordcmp(f80, a, b); | |
| 137 | } | |
| 138 | ||
| 139 | pub fn __unordsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 140 | return unordcmp(f32, a, b); | |
| 141 | } | |
| 142 | ||
| 143 | fn __aeabi_fcmpun(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 144 | return unordcmp(f32, a, b); | |
| 145 | } | |
| 146 | ||
| 3 | 147 | pub const LE = enum(i32) { |
| 4 | 148 | Less = -1, |
| 5 | 149 | Equal = 0, |
lib/compiler_rt/comparesf2_test.zig+5-5| ... | ... | @@ -5,15 +5,15 @@ |
| 5 | 5 | const std = @import("std"); |
| 6 | 6 | const builtin = @import("builtin"); |
| 7 | 7 | |
| 8 | const __eqsf2 = @import("./cmpsf2.zig").__eqsf2; | |
| 9 | const __lesf2 = @import("./cmpsf2.zig").__lesf2; | |
| 10 | const __ltsf2 = @import("./cmpsf2.zig").__ltsf2; | |
| 11 | const __nesf2 = @import("./cmpsf2.zig").__nesf2; | |
| 8 | const __eqsf2 = @import("./comparef.zig").__eqsf2; | |
| 9 | const __lesf2 = @import("./comparef.zig").__lesf2; | |
| 10 | const __ltsf2 = @import("./comparef.zig").__ltsf2; | |
| 11 | const __nesf2 = @import("./comparef.zig").__nesf2; | |
| 12 | 12 | |
| 13 | 13 | const __gesf2 = @import("./gesf2.zig").__gesf2; |
| 14 | 14 | const __gtsf2 = @import("./gesf2.zig").__gtsf2; |
| 15 | 15 | |
| 16 | const __unordsf2 = @import("./unordsf2.zig").__unordsf2; | |
| 16 | const __unordsf2 = @import("./comparef.zig").__unordsf2; | |
| 17 | 17 | |
| 18 | 18 | const TestVector = struct { |
| 19 | 19 | a: f32, |
lib/compiler_rt/cos.zig+4-4| ... | ... | @@ -3,7 +3,7 @@ const math = std.math; |
| 3 | 3 | const mem = std.mem; |
| 4 | 4 | const expect = std.testing.expect; |
| 5 | 5 | |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | 7 | const symbol = @import("../compiler_rt.zig").symbol; |
| 8 | 8 | const trig = @import("trig.zig"); |
| 9 | 9 | const rem_pio2 = @import("rem_pio2.zig").rem_pio2; |
| ... | ... | @@ -14,7 +14,7 @@ comptime { |
| 14 | 14 | symbol(&cosf, "cosf"); |
| 15 | 15 | symbol(&cos, "cos"); |
| 16 | 16 | symbol(&__cosx, "__cosx"); |
| 17 | if (common.want_ppc_abi) { | |
| 17 | if (compiler_rt.want_ppc_abi) { | |
| 18 | 18 | symbol(&cosq, "cosf128"); |
| 19 | 19 | } |
| 20 | 20 | symbol(&cosq, "cosq"); |
| ... | ... | @@ -40,7 +40,7 @@ pub fn cosf(x: f32) callconv(.c) f32 { |
| 40 | 40 | if (ix <= 0x3f490fda) { // |x| ~<= pi/4 |
| 41 | 41 | if (ix < 0x39800000) { // |x| < 2**-12 |
| 42 | 42 | // raise inexact if x != 0 |
| 43 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 43 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 44 | 44 | return 1.0; |
| 45 | 45 | } |
| 46 | 46 | return trig.__cosdf(x); |
| ... | ... | @@ -91,7 +91,7 @@ pub fn cos(x: f64) callconv(.c) f64 { |
| 91 | 91 | if (ix <= 0x3fe921fb) { |
| 92 | 92 | if (ix < 0x3e46a09e) { // |x| < 2**-27 * sqrt(2) |
| 93 | 93 | // raise inexact if x!=0 |
| 94 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 94 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 95 | 95 | return 1.0; |
| 96 | 96 | } |
| 97 | 97 | return trig.__cos(x, 0); |
lib/compiler_rt/divdf3.zig+4-4| ... | ... | @@ -3,14 +3,14 @@ |
| 3 | 3 | //! https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/divdf3.c |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | 7 | const symbol = @import("../compiler_rt.zig").symbol; |
| 8 | 8 | |
| 9 | const normalize = common.normalize; | |
| 10 | const wideMultiply = common.wideMultiply; | |
| 9 | const normalize = compiler_rt.normalize; | |
| 10 | const wideMultiply = compiler_rt.wideMultiply; | |
| 11 | 11 | |
| 12 | 12 | comptime { |
| 13 | if (common.want_aeabi) { | |
| 13 | if (compiler_rt.want_aeabi) { | |
| 14 | 14 | symbol(&__aeabi_ddiv, "__aeabi_ddiv"); |
| 15 | 15 | } else { |
| 16 | 16 | symbol(&__divdf3, "__divdf3"); |
lib/compiler_rt/divhc3.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const divc3 = @import("./divc3.zig"); |
| 3 | 4 | const Complex = @import("./mulc3.zig").Complex; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | @export(&__divhc3, .{ .name = "__divhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__divhc3, "__divhc3"); | |
| 8 | 9 | } |
| 9 | 10 | } |
| 10 | 11 |
lib/compiler_rt/divmodei4.zig+3-3| ... | ... | @@ -3,7 +3,7 @@ const endian = builtin.cpu.arch.endian(); |
| 3 | 3 | |
| 4 | 4 | const std = @import("std"); |
| 5 | 5 | |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | 7 | const udivmod = @import("udivmodei4.zig").divmod; |
| 8 | 8 | const symbol = @import("../compiler_rt.zig").symbol; |
| 9 | 9 | |
| ... | ... | @@ -36,7 +36,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void { |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { |
| 39 | @setRuntimeSafety(common.test_safety); | |
| 39 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 40 | 40 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); |
| 41 | 41 | const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); |
| 42 | 42 | const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) vo |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void { |
| 48 | @setRuntimeSafety(common.test_safety); | |
| 48 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 49 | 49 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); |
| 50 | 50 | const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); |
| 51 | 51 | const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
lib/compiler_rt/divsf3.zig+3-3| ... | ... | @@ -4,12 +4,12 @@ |
| 4 | 4 | |
| 5 | 5 | const std = @import("std"); |
| 6 | 6 | |
| 7 | const common = @import("common.zig"); | |
| 7 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 8 | 8 | const symbol = @import("../compiler_rt.zig").symbol; |
| 9 | const normalize = common.normalize; | |
| 9 | const normalize = compiler_rt.normalize; | |
| 10 | 10 | |
| 11 | 11 | comptime { |
| 12 | if (common.want_aeabi) { | |
| 12 | if (compiler_rt.want_aeabi) { | |
| 13 | 13 | symbol(&__aeabi_fdiv, "__aeabi_fdiv"); |
| 14 | 14 | } else { |
| 15 | 15 | symbol(&__divsf3, "__divsf3"); |
lib/compiler_rt/divtc3.zig+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const divc3 = @import("./divc3.zig"); |
| 3 | 3 | const Complex = @import("./mulc3.zig").Complex; |
| 4 | 4 | const symbol = @import("../compiler_rt.zig").symbol; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (@import("builtin").zig_backend != .stage2_c) { |
| 8 | if (common.want_ppc_abi) | |
| 8 | if (compiler_rt.want_ppc_abi) | |
| 9 | 9 | symbol(&__divtc3, "__divkc3"); |
| 10 | 10 | symbol(&__divtc3, "__divtc3"); |
| 11 | 11 | } |
lib/compiler_rt/divtf3.zig+9-8| ... | ... | @@ -1,17 +1,18 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | |
| 4 | const common = @import("common.zig"); | |
| 5 | const normalize = common.normalize; | |
| 6 | const wideMultiply = common.wideMultiply; | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 6 | const normalize = compiler_rt.normalize; | |
| 7 | const wideMultiply = compiler_rt.wideMultiply; | |
| 7 | 8 | |
| 8 | 9 | comptime { |
| 9 | if (common.want_ppc_abi) { | |
| 10 | @export(&__divtf3, .{ .name = "__divkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | } else if (common.want_sparc_abi) { | |
| 12 | @export(&_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_ppc_abi) { | |
| 11 | symbol(&__divtf3, "__divkf3"); | |
| 12 | } else if (compiler_rt.want_sparc_abi) { | |
| 13 | symbol(&_Qp_div, "_Qp_div"); | |
| 13 | 14 | } |
| 14 | @export(&__divtf3, .{ .name = "__divtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | symbol(&__divtf3, "__divtf3"); | |
| 15 | 16 | } |
| 16 | 17 | |
| 17 | 18 | pub fn __divtf3(a: f128, b: f128) callconv(.c) f128 { |
lib/compiler_rt/divti3.zig deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const udivmod = @import("udivmod.zig").udivmod; | |
| 4 | const arch = builtin.cpu.arch; | |
| 5 | const common = @import("common.zig"); | |
| 6 | ||
| 7 | comptime { | |
| 8 | if (common.want_windows_v2u64_abi) { | |
| 9 | @export(&__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | } else { | |
| 11 | @export(&__divti3, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | } | |
| 13 | } | |
| 14 | ||
| 15 | pub fn __divti3(a: i128, b: i128) callconv(.c) i128 { | |
| 16 | return div(a, b); | |
| 17 | } | |
| 18 | ||
| 19 | const v128 = @Vector(2, u64); | |
| 20 | ||
| 21 | fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.c) v128 { | |
| 22 | return @bitCast(div(@bitCast(a), @bitCast(b))); | |
| 23 | } | |
| 24 | ||
| 25 | inline fn div(a: i128, b: i128) i128 { | |
| 26 | const s_a = a >> (128 - 1); | |
| 27 | const s_b = b >> (128 - 1); | |
| 28 | ||
| 29 | const an = (a ^ s_a) -% s_a; | |
| 30 | const bn = (b ^ s_b) -% s_b; | |
| 31 | ||
| 32 | const r = udivmod(u128, @bitCast(an), @bitCast(bn), null); | |
| 33 | const s = s_a ^ s_b; | |
| 34 | return (@as(i128, @bitCast(r)) ^ s) -% s; | |
| 35 | } | |
| 36 | ||
| 37 | test { | |
| 38 | _ = @import("divti3_test.zig"); | |
| 39 | } |
lib/compiler_rt/divti3_test.zig+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const __divti3 = @import("divti3.zig").__divti3; | |
| 1 | const __divti3 = @import("udivmod.zig").__divti3; | |
| 2 | 2 | const testing = @import("std").testing; |
| 3 | 3 | |
| 4 | 4 | fn test__divti3(a: i128, b: i128, expected: i128) !void { |
lib/compiler_rt/divxf3.zig+5-4| ... | ... | @@ -2,12 +2,13 @@ const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | 4 | |
| 5 | const common = @import("common.zig"); | |
| 6 | const normalize = common.normalize; | |
| 7 | const wideMultiply = common.wideMultiply; | |
| 5 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 6 | const symbol = compiler_rt.symbol; | |
| 7 | const normalize = compiler_rt.normalize; | |
| 8 | const wideMultiply = compiler_rt.wideMultiply; | |
| 8 | 9 | |
| 9 | 10 | comptime { |
| 10 | @export(&__divxf3, .{ .name = "__divxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__divxf3, "__divxf3"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 { |
lib/compiler_rt/emutls.zig+3-2| ... | ... | @@ -5,7 +5,8 @@ |
| 5 | 5 | |
| 6 | 6 | const std = @import("std"); |
| 7 | 7 | const builtin = @import("builtin"); |
| 8 | const common = @import("common.zig"); | |
| 8 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 9 | const symbol = compiler_rt.symbol; | |
| 9 | 10 | |
| 10 | 11 | const abort = std.process.abort; |
| 11 | 12 | const assert = std.debug.assert; |
| ... | ... | @@ -17,7 +18,7 @@ const gcc_word = usize; |
| 17 | 18 | |
| 18 | 19 | comptime { |
| 19 | 20 | if (builtin.link_libc and (builtin.abi.isAndroid() or builtin.abi.isOpenHarmony() or builtin.os.tag == .openbsd)) { |
| 20 | @export(&__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | symbol(&__emutls_get_address, "__emutls_get_address"); | |
| 21 | 22 | } |
| 22 | 23 | } |
| 23 | 24 |
lib/compiler_rt/exp.zig+7-7| ... | ... | @@ -13,7 +13,7 @@ const mem = std.mem; |
| 13 | 13 | const expect = std.testing.expect; |
| 14 | 14 | const expectEqual = std.testing.expectEqual; |
| 15 | 15 | |
| 16 | const common = @import("common.zig"); | |
| 16 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 17 | 17 | const symbol = @import("../compiler_rt.zig").symbol; |
| 18 | 18 | |
| 19 | 19 | comptime { |
| ... | ... | @@ -21,7 +21,7 @@ comptime { |
| 21 | 21 | symbol(&expf, "expf"); |
| 22 | 22 | symbol(&exp, "exp"); |
| 23 | 23 | symbol(&__expx, "__expx"); |
| 24 | if (common.want_ppc_abi) { | |
| 24 | if (compiler_rt.want_ppc_abi) { | |
| 25 | 25 | symbol(&expq, "expf128"); |
| 26 | 26 | } |
| 27 | 27 | symbol(&expq, "expq"); |
| ... | ... | @@ -61,7 +61,7 @@ pub fn expf(x_: f32) callconv(.c) f32 { |
| 61 | 61 | return x * 0x1.0p127; |
| 62 | 62 | } |
| 63 | 63 | if (sign != 0) { |
| 64 | if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow | |
| 64 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow | |
| 65 | 65 | // x <= -103.972084 |
| 66 | 66 | if (hx >= 0x42CFF1B5) { |
| 67 | 67 | return 0; |
| ... | ... | @@ -93,7 +93,7 @@ pub fn expf(x_: f32) callconv(.c) f32 { |
| 93 | 93 | hi = x; |
| 94 | 94 | lo = 0; |
| 95 | 95 | } else { |
| 96 | if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact | |
| 96 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact | |
| 97 | 97 | return 1 + x; |
| 98 | 98 | } |
| 99 | 99 | |
| ... | ... | @@ -137,11 +137,11 @@ pub fn exp(x_: f64) callconv(.c) f64 { |
| 137 | 137 | } |
| 138 | 138 | if (x > 709.782712893383973096) { |
| 139 | 139 | // overflow if x != inf |
| 140 | return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64); | |
| 140 | return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64); | |
| 141 | 141 | } |
| 142 | 142 | if (x < -708.39641853226410622) { |
| 143 | 143 | // underflow if x != -inf |
| 144 | if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x); | |
| 144 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x); | |
| 145 | 145 | if (x < -745.13321910194110842) { |
| 146 | 146 | return 0; |
| 147 | 147 | } |
| ... | ... | @@ -174,7 +174,7 @@ pub fn exp(x_: f64) callconv(.c) f64 { |
| 174 | 174 | lo = 0; |
| 175 | 175 | } else { |
| 176 | 176 | // inexact if x != 0 |
| 177 | if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x); | |
| 177 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x); | |
| 178 | 178 | return 1 + x; |
| 179 | 179 | } |
| 180 | 180 |
lib/compiler_rt/exp2.zig+13-12| ... | ... | @@ -11,18 +11,19 @@ const math = std.math; |
| 11 | 11 | const mem = std.mem; |
| 12 | 12 | const expect = std.testing.expect; |
| 13 | 13 | const expectEqual = std.testing.expectEqual; |
| 14 | const common = @import("common.zig"); | |
| 14 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 15 | const symbol = compiler_rt.symbol; | |
| 15 | 16 | |
| 16 | 17 | comptime { |
| 17 | @export(&__exp2h, .{ .name = "__exp2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&exp2f, .{ .name = "exp2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&exp2, .{ .name = "exp2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__exp2x, .{ .name = "__exp2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | if (common.want_ppc_abi) { | |
| 22 | @export(&exp2q, .{ .name = "exp2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | symbol(&__exp2h, "__exp2h"); | |
| 19 | symbol(&exp2f, "exp2f"); | |
| 20 | symbol(&exp2, "exp2"); | |
| 21 | symbol(&__exp2x, "__exp2x"); | |
| 22 | if (compiler_rt.want_ppc_abi) { | |
| 23 | symbol(&exp2q, "exp2f128"); | |
| 23 | 24 | } |
| 24 | @export(&exp2q, .{ .name = "exp2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&exp2l, .{ .name = "exp2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | symbol(&exp2q, "exp2q"); | |
| 26 | symbol(&exp2l, "exp2l"); | |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | pub fn __exp2h(x: f16) callconv(.c) f16 { |
| ... | ... | @@ -54,7 +55,7 @@ pub fn exp2f(x: f32) callconv(.c) f32 { |
| 54 | 55 | // x < -126 |
| 55 | 56 | if (u >= 0x80000000) { |
| 56 | 57 | if (u >= 0xC3160000 or u & 0x000FFFF != 0) { |
| 57 | if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); | |
| 58 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); | |
| 58 | 59 | } |
| 59 | 60 | // x <= -150 |
| 60 | 61 | if (u >= 0xC3160000) { |
| ... | ... | @@ -108,7 +109,7 @@ pub fn exp2(x: f64) callconv(.c) f64 { |
| 108 | 109 | if (ix >= 0x408FF000) { |
| 109 | 110 | // x >= 1024 or nan |
| 110 | 111 | if (ix >= 0x40900000 and ux >> 63 == 0) { |
| 111 | return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64); | |
| 112 | return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64); | |
| 112 | 113 | } |
| 113 | 114 | // -inf or -nan |
| 114 | 115 | if (ix >= 0x7FF00000) { |
| ... | ... | @@ -118,7 +119,7 @@ pub fn exp2(x: f64) callconv(.c) f64 { |
| 118 | 119 | if (ux >> 63 != 0) { |
| 119 | 120 | // underflow |
| 120 | 121 | if (x <= -1075 or x - 0x1.0p52 + 0x1.0p52 != x) { |
| 121 | if (common.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x))); | |
| 122 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x))); | |
| 122 | 123 | } |
| 123 | 124 | if (x <= -1075) { |
| 124 | 125 | return 0; |
lib/compiler_rt/extenddftf2.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const extendf = @import("./extendf.zig").extendf; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__extenddftf2, "__extenddfkf2"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_dtoq, "_Qp_dtoq"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__extenddftf2, "__extenddftf2"); |
lib/compiler_rt/extenddfxf2.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const extend_f80 = @import("./extendf.zig").extend_f80; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__extenddfxf2, "__extenddfxf2"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __extenddfxf2(a: f64) callconv(.c) f80 { |
lib/compiler_rt/extendf_test.zig+4-2| ... | ... | @@ -1,12 +1,14 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | ||
| 1 | 3 | const std = @import("std"); |
| 2 | 4 | const math = std.math; |
| 3 | const builtin = @import("builtin"); | |
| 5 | ||
| 4 | 6 | const __extendhfsf2 = @import("extendhfsf2.zig").__extendhfsf2; |
| 5 | 7 | const __extendhftf2 = @import("extendhftf2.zig").__extendhftf2; |
| 6 | 8 | const __extendsftf2 = @import("extendsftf2.zig").__extendsftf2; |
| 7 | 9 | const __extenddftf2 = @import("extenddftf2.zig").__extenddftf2; |
| 8 | 10 | const __extenddfxf2 = @import("extenddfxf2.zig").__extenddfxf2; |
| 9 | const F16T = @import("./common.zig").F16T; | |
| 11 | const F16T = @import("../compiler_rt.zig").F16T; | |
| 10 | 12 | |
| 11 | 13 | fn test__extenddfxf2(a: f64, expected: u80) !void { |
| 12 | 14 | const x = __extenddfxf2(a); |
lib/compiler_rt/extendhfdf2.zig+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const extendf = @import("./extendf.zig").extendf; |
| 4 | 4 | |
| ... | ... | @@ -6,6 +6,6 @@ comptime { |
| 6 | 6 | symbol(&__extendhfdf2, "__extendhfdf2"); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | pub fn __extendhfdf2(a: common.F16T(f64)) callconv(.c) f64 { | |
| 9 | pub fn __extendhfdf2(a: compiler_rt.F16T(f64)) callconv(.c) f64 { | |
| 10 | 10 | return extendf(f64, f16, @as(u16, @bitCast(a))); |
| 11 | 11 | } |
lib/compiler_rt/extendhfsf2.zig+5-5| ... | ... | @@ -1,21 +1,21 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const extendf = @import("./extendf.zig").extendf; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.gnu_f16_abi) { | |
| 6 | if (compiler_rt.gnu_f16_abi) { | |
| 7 | 7 | symbol(&__gnu_h2f_ieee, "__gnu_h2f_ieee"); |
| 8 | } else if (common.want_aeabi) { | |
| 8 | } else if (compiler_rt.want_aeabi) { | |
| 9 | 9 | symbol(&__aeabi_h2f, "__aeabi_h2f"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__extendhfsf2, "__extendhfsf2"); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | pub fn __extendhfsf2(a: common.F16T(f32)) callconv(.c) f32 { | |
| 14 | pub fn __extendhfsf2(a: compiler_rt.F16T(f32)) callconv(.c) f32 { | |
| 15 | 15 | return extendf(f32, f16, @as(u16, @bitCast(a))); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | fn __gnu_h2f_ieee(a: common.F16T(f32)) callconv(.c) f32 { | |
| 18 | fn __gnu_h2f_ieee(a: compiler_rt.F16T(f32)) callconv(.c) f32 { | |
| 19 | 19 | return extendf(f32, f16, @as(u16, @bitCast(a))); |
| 20 | 20 | } |
| 21 | 21 |
lib/compiler_rt/extendhftf2.zig+4-3| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const extendf = @import("./extendf.zig").extendf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__extendhftf2, "__extendhftf2"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | pub fn __extendhftf2(a: common.F16T(f128)) callconv(.c) f128 { | |
| 9 | pub fn __extendhftf2(a: compiler_rt.F16T(f128)) callconv(.c) f128 { | |
| 9 | 10 | return extendf(f128, f16, @as(u16, @bitCast(a))); |
| 10 | 11 | } |
lib/compiler_rt/extendhfxf2.zig+4-3| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const extend_f80 = @import("./extendf.zig").extend_f80; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__extendhfxf2, "__extendhfxf2"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | fn __extendhfxf2(a: common.F16T(f80)) callconv(.c) f80 { | |
| 9 | fn __extendhfxf2(a: compiler_rt.F16T(f80)) callconv(.c) f80 { | |
| 9 | 10 | return extend_f80(f16, @as(u16, @bitCast(a))); |
| 10 | 11 | } |
lib/compiler_rt/extendsfdf2.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const extendf = @import("./extendf.zig").extendf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_f2d, "__aeabi_f2d"); | |
| 7 | 8 | } else { |
| 8 | @export(&__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__extendsfdf2, "__extendsfdf2"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/extendsftf2.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const extendf = @import("./extendf.zig").extendf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__extendsftf2, "__extendsfkf2"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_stoq, "_Qp_stoq"); | |
| 9 | 10 | } |
| 10 | @export(&__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__extendsftf2, "__extendsftf2"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __extendsftf2(a: f32) callconv(.c) f128 { |
lib/compiler_rt/fabs.zig+10-9| ... | ... | @@ -1,18 +1,19 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | const common = @import("common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fabsh, .{ .name = "__fabsh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&fabsf, .{ .name = "fabsf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&fabs, .{ .name = "fabs", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__fabsx, .{ .name = "__fabsx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | if (common.want_ppc_abi) { | |
| 12 | @export(&fabsq, .{ .name = "fabsf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fabsh, "__fabsh"); | |
| 9 | symbol(&fabsf, "fabsf"); | |
| 10 | symbol(&fabs, "fabs"); | |
| 11 | symbol(&__fabsx, "__fabsx"); | |
| 12 | if (compiler_rt.want_ppc_abi) { | |
| 13 | symbol(&fabsq, "fabsf128"); | |
| 13 | 14 | } |
| 14 | @export(&fabsq, .{ .name = "fabsq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&fabsl, .{ .name = "fabsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | symbol(&fabsq, "fabsq"); | |
| 16 | symbol(&fabsl, "fabsl"); | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | pub fn __fabsh(a: f16) callconv(.c) f16 { |
lib/compiler_rt/fixdfdi.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 7 | @export(&__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_d2lz, "__aeabi_d2lz"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 10 | @export(&__fixdfdi, .{ .name = "__dtoi64", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | symbol(&__fixdfdi, "__dtoi64"); | |
| 11 | 12 | } |
| 12 | @export(&__fixdfdi, .{ .name = "__fixdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__fixdfdi, "__fixdfdi"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/fixdfei.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fixdfei, .{ .name = "__fixdfei", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fixdfei, "__fixdfei"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void { |
lib/compiler_rt/fixdfsi.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_d2iz, "__aeabi_d2iz"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__fixdfsi, "__fixdfsi"); |
lib/compiler_rt/fixdfti.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__fixdfti_windows_x86_64, "__fixdfti"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__fixdfti, "__fixdfti"); |
lib/compiler_rt/fixhfdi.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; | |
| 3 | ||
| 4 | comptime { | |
| 5 | @export(&__fixhfdi, .{ .name = "__fixhfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } | |
| 7 | ||
| 8 | fn __fixhfdi(a: f16) callconv(.c) i64 { | |
| 9 | return intFromFloat(i64, a); | |
| 10 | } |
lib/compiler_rt/fixhfei.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fixhfei, .{ .name = "__fixhfei", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fixhfei, "__fixhfei"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void { |
lib/compiler_rt/fixhfsi.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; | |
| 3 | ||
| 4 | comptime { | |
| 5 | @export(&__fixhfsi, .{ .name = "__fixhfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } | |
| 7 | ||
| 8 | fn __fixhfsi(a: f16) callconv(.c) i32 { | |
| 9 | return intFromFloat(i32, a); | |
| 10 | } |
lib/compiler_rt/fixhfti.zig deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const common = @import("./common.zig"); | |
| 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; | |
| 4 | ||
| 5 | comptime { | |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | } else { | |
| 9 | @export(&__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | } | |
| 11 | } | |
| 12 | ||
| 13 | pub fn __fixhfti(a: f16) callconv(.c) i128 { | |
| 14 | return intFromFloat(i128, a); | |
| 15 | } | |
| 16 | ||
| 17 | const v2u64 = @Vector(2, u64); | |
| 18 | ||
| 19 | fn __fixhfti_windows_x86_64(a: f16) callconv(.c) v2u64 { | |
| 20 | return @bitCast(intFromFloat(i128, a)); | |
| 21 | } |
lib/compiler_rt/fixsfdi.zig+3-3| ... | ... | @@ -1,13 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | const symbol = @import("../compiler_rt.zig").symbol; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | if (common.want_aeabi) { | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | 8 | symbol(&__aeabi_f2lz, "__aeabi_f2lz"); |
| 9 | 9 | } else { |
| 10 | if (common.want_windows_arm_abi) { | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | 11 | symbol(&__fixsfdi, "__stoi64"); |
| 12 | 12 | } |
| 13 | 13 | symbol(&__fixsfdi, "__fixsfdi"); |
lib/compiler_rt/fixsfei.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fixsfei, .{ .name = "__fixsfei", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fixsfei, "__fixsfei"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void { |
lib/compiler_rt/fixsfsi.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_f2iz, "__aeabi_f2iz"); | |
| 7 | 8 | } else { |
| 8 | @export(&__fixsfsi, .{ .name = "__fixsfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__fixsfsi, "__fixsfsi"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/fixsfti.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__fixsfti_windows_x86_64, "__fixsfti"); | |
| 8 | 9 | } else { |
| 9 | @export(&__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__fixsfti, "__fixsfti"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/fixtfdi.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__fixtfdi, "__fixkfdi"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_qtox, "_Qp_qtox"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__fixtfdi, "__fixtfdi"); |
lib/compiler_rt/fixtfei.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fixtfei, .{ .name = "__fixtfei", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fixtfei, "__fixtfei"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void { |
lib/compiler_rt/fixtfsi.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__fixtfsi, "__fixkfsi"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_qtoi, "_Qp_qtoi"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__fixtfsi, "__fixtfsi"); |
lib/compiler_rt/fixtfti.zig+3-3| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__fixtfti_windows_x86_64, "__fixtfti"); |
| 8 | 8 | } else { |
| 9 | if (common.want_ppc_abi) | |
| 9 | if (compiler_rt.want_ppc_abi) | |
| 10 | 10 | symbol(&__fixtfti, "__fixkfti"); |
| 11 | 11 | symbol(&__fixtfti, "__fixtfti"); |
| 12 | 12 | } |
lib/compiler_rt/fixunsdfdi.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 7 | @export(&__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_d2ulz, "__aeabi_d2ulz"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 10 | @export(&__fixunsdfdi, .{ .name = "__dtou64", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | symbol(&__fixunsdfdi, "__dtou64"); | |
| 11 | 12 | } |
| 12 | @export(&__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__fixunsdfdi, "__fixunsdfdi"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/fixunsdfsi.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_d2uiz, "__aeabi_d2uiz"); | |
| 7 | 8 | } else { |
| 8 | @export(&__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__fixunsdfsi, "__fixunsdfsi"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/fixunsdfti.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__fixunsdfti_windows_x86_64, "__fixunsdfti"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__fixunsdfti, "__fixunsdfti"); |
lib/compiler_rt/fixunshfsi.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__fixunshfsi, .{ .name = "__fixunshfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__fixunshfsi, "__fixunshfsi"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __fixunshfsi(a: f16) callconv(.c) u32 { |
lib/compiler_rt/fixunshfti.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__fixunshfti_windows_x86_64, "__fixunshfti"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__fixunshfti, "__fixunshfti"); |
lib/compiler_rt/fixunssfdi.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 7 | @export(&__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_f2ulz, "__aeabi_f2ulz"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 10 | @export(&__fixunssfdi, .{ .name = "__stou64", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | symbol(&__fixunssfdi, "__stou64"); | |
| 11 | 12 | } |
| 12 | @export(&__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__fixunssfdi, "__fixunssfdi"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/fixunssfsi.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_f2uiz, "__aeabi_f2uiz"); | |
| 7 | 8 | } else { |
| 8 | @export(&__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__fixunssfsi, "__fixunssfsi"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/fixunssfti.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | const symbol = @import("../compiler_rt.zig").symbol; |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | if (common.want_windows_v2u64_abi) { | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | 8 | symbol(&__fixunssfti_windows_x86_64, "__fixunssfti"); |
| 9 | 9 | } else { |
| 10 | 10 | symbol(&__fixunssfti, "__fixunssfti"); |
lib/compiler_rt/fixunstfdi.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__fixunstfdi, "__fixunskfdi"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_qtoux, "_Qp_qtoux"); | |
| 9 | 10 | } |
| 10 | @export(&__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__fixunstfdi, "__fixunstfdi"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __fixunstfdi(a: f128) callconv(.c) u64 { |
lib/compiler_rt/fixunstfsi.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__fixunstfsi, "__fixunskfsi"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_qtoui, "_Qp_qtoui"); | |
| 9 | 10 | } |
| 10 | @export(&__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__fixunstfsi, "__fixunstfsi"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __fixunstfsi(a: f128) callconv(.c) u32 { |
lib/compiler_rt/fixunstfti.zig+7-6| ... | ... | @@ -1,14 +1,15 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__fixunstfti_windows_x86_64, "__fixunstfti"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_ppc_abi) | |
| 10 | @export(&__fixunstfti, .{ .name = "__fixunskfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_ppc_abi) | |
| 11 | symbol(&__fixunstfti, "__fixunskfti"); | |
| 12 | symbol(&__fixunstfti, "__fixunstfti"); | |
| 12 | 13 | } |
| 13 | 14 | } |
| 14 | 15 |
lib/compiler_rt/fixunsxfsi.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__fixunsxfsi, .{ .name = "__fixunsxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__fixunsxfsi, "__fixunsxfsi"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __fixunsxfsi(a: f80) callconv(.c) u32 { |
lib/compiler_rt/fixunsxfti.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__fixunsxfti_windows_x86_64, "__fixunsxfti"); | |
| 8 | 9 | } else { |
| 9 | @export(&__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__fixunsxfti, "__fixunsxfti"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/fixxfei.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__fixxfei, .{ .name = "__fixxfei", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__fixxfei, "__fixxfei"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void { |
lib/compiler_rt/fixxfsi.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__fixxfsi, .{ .name = "__fixxfsi", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__fixxfsi, "__fixxfsi"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __fixxfsi(a: f80) callconv(.c) i32 { |
lib/compiler_rt/fixxfti.zig deleted-23| ... | ... | @@ -1,23 +0,0 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | ||
| 3 | const common = @import("./common.zig"); | |
| 4 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; | |
| 5 | const symbol = @import("../compiler_rt.zig").symbol; | |
| 6 | ||
| 7 | comptime { | |
| 8 | if (common.want_windows_v2u64_abi) { | |
| 9 | symbol(&__fixxfti_windows_x86_64, "__fixxfti"); | |
| 10 | } else { | |
| 11 | symbol(&__fixxfti, "__fixxfti"); | |
| 12 | } | |
| 13 | } | |
| 14 | ||
| 15 | pub fn __fixxfti(a: f80) callconv(.c) i128 { | |
| 16 | return intFromFloat(i128, a); | |
| 17 | } | |
| 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | |
| 20 | ||
| 21 | fn __fixxfti_windows_x86_64(a: f80) callconv(.c) v2u64 { | |
| 22 | return @bitCast(intFromFloat(i128, a)); | |
| 23 | } |
lib/compiler_rt/floatdidf.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 7 | @export(&__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_l2d, "__aeabi_l2d"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 10 | @export(&__floatdidf, .{ .name = "__i64tod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | symbol(&__floatdidf, "__i64tod"); | |
| 11 | 12 | } |
| 12 | @export(&__floatdidf, .{ .name = "__floatdidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__floatdidf, "__floatdidf"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/floatdisf.zig+3-3| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_l2f, "__aeabi_l2f"); |
| 8 | 8 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 9 | if (compiler_rt.want_windows_arm_abi) { | |
| 10 | 10 | symbol(&__floatdisf, "__i64tos"); |
| 11 | 11 | } |
| 12 | 12 | symbol(&__floatdisf, "__floatdisf"); |
lib/compiler_rt/floatditf.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__floatditf, "__floatdikf"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_xtoq, "_Qp_xtoq"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__floatditf, "__floatditf"); |
lib/compiler_rt/floateihf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floateihf, .{ .name = "__floateihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floateihf, "__floateihf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 { |
lib/compiler_rt/floateisf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floateisf, .{ .name = "__floateisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floateisf, "__floateisf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 { |
lib/compiler_rt/floateitf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floateitf, .{ .name = "__floateitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floateitf, "__floateitf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 { |
lib/compiler_rt/floatsidf.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_i2d, "__aeabi_i2d"); | |
| 7 | 8 | } else { |
| 8 | @export(&__floatsidf, .{ .name = "__floatsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__floatsidf, "__floatsidf"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/floatsihf.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__floatsihf, .{ .name = "__floatsihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__floatsihf, "__floatsihf"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __floatsihf(a: i32) callconv(.c) f16 { |
lib/compiler_rt/floatsisf.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_i2f, "__aeabi_i2f"); | |
| 7 | 8 | } else { |
| 8 | @export(&__floatsisf, .{ .name = "__floatsisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__floatsisf, "__floatsisf"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/floatsitf.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__floatsitf, "__floatsikf"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_itoq, "_Qp_itoq"); | |
| 9 | 10 | } |
| 10 | @export(&__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__floatsitf, "__floatsitf"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __floatsitf(a: i32) callconv(.c) f128 { |
lib/compiler_rt/floatsixf.zig+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 |
lib/compiler_rt/floattidf.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floattidf_windows_x86_64, "__floattidf"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__floattidf, "__floattidf"); |
lib/compiler_rt/floattihf.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__floattihf_windows_x86_64, "__floattihf"); | |
| 8 | 9 | } else { |
| 9 | @export(&__floattihf, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__floattihf, "__floattihf"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/floattisf.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floattisf_windows_x86_64, "__floattisf"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__floattisf, "__floattisf"); |
lib/compiler_rt/floattitf.zig+3-3| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floattitf_windows_x86_64, "__floattitf"); |
| 8 | 8 | } else { |
| 9 | if (common.want_ppc_abi) | |
| 9 | if (compiler_rt.want_ppc_abi) | |
| 10 | 10 | symbol(&__floattitf, "__floattikf"); |
| 11 | 11 | symbol(&__floattitf, "__floattitf"); |
| 12 | 12 | } |
lib/compiler_rt/floattixf.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__floattixf_windows_x86_64, "__floattixf"); | |
| 8 | 9 | } else { |
| 9 | @export(&__floattixf, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__floattixf, "__floattixf"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/floatundidf.zig+3-3| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_ul2d, "__aeabi_ul2d"); |
| 8 | 8 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 9 | if (compiler_rt.want_windows_arm_abi) { | |
| 10 | 10 | symbol(&__floatundidf, "__u64tod"); |
| 11 | 11 | } |
| 12 | 12 | symbol(&__floatundidf, "__floatundidf"); |
lib/compiler_rt/floatundihf.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__floatundihf, .{ .name = "__floatundihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__floatundihf, "__floatundihf"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __floatundihf(a: u64) callconv(.c) f16 { |
lib/compiler_rt/floatundisf.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 7 | @export(&__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_aeabi) { | |
| 8 | symbol(&__aeabi_ul2f, "__aeabi_ul2f"); | |
| 8 | 9 | } else { |
| 9 | if (common.want_windows_arm_abi) { | |
| 10 | @export(&__floatundisf, .{ .name = "__u64tos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | if (compiler_rt.want_windows_arm_abi) { | |
| 11 | symbol(&__floatundisf, "__u64tos"); | |
| 11 | 12 | } |
| 12 | @export(&__floatundisf, .{ .name = "__floatundisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__floatundisf, "__floatundisf"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/floatunditf.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__floatunditf, "__floatundikf"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_uxtoq, "_Qp_uxtoq"); | |
| 9 | 10 | } |
| 10 | @export(&__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__floatunditf, "__floatunditf"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __floatunditf(a: u64) callconv(.c) f128 { |
lib/compiler_rt/floatundixf.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__floatundixf, .{ .name = "__floatundixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__floatundixf, "__floatundixf"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __floatundixf(a: u64) callconv(.c) f80 { |
lib/compiler_rt/floatuneidf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floatuneidf, .{ .name = "__floatuneidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floatuneidf, "__floatuneidf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floatuneidf(a: [*]const u8, bits: usize) callconv(.c) f64 { |
lib/compiler_rt/floatuneihf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floatuneihf, .{ .name = "__floatuneihf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floatuneihf, "__floatuneihf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floatuneihf(a: [*]const u8, bits: usize) callconv(.c) f16 { |
lib/compiler_rt/floatuneisf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floatuneisf, .{ .name = "__floatuneisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floatuneisf, "__floatuneisf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floatuneisf(a: [*]const u8, bits: usize) callconv(.c) f32 { |
lib/compiler_rt/floatuneixf.zig+3-2| ... | ... | @@ -1,10 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt; |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__floatuneixf, .{ .name = "__floatuneixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__floatuneixf, "__floatuneixf"); | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | pub fn __floatuneixf(a: [*]const u8, bits: usize) callconv(.c) f80 { |
lib/compiler_rt/floatunsidf.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_ui2d, "__aeabi_ui2d"); | |
| 7 | 8 | } else { |
| 8 | @export(&__floatunsidf, .{ .name = "__floatunsidf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__floatunsidf, "__floatunsidf"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/floatunsisf.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_ui2f, "__aeabi_ui2f"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__floatunsisf, "__floatunsisf"); |
lib/compiler_rt/floatunsitf.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__floatunsitf, "__floatunsikf"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_uitoq, "_Qp_uitoq"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__floatunsitf, "__floatunsitf"); |
lib/compiler_rt/floatunsixf.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__floatunsixf, .{ .name = "__floatunsixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__floatunsixf, "__floatunsixf"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __floatunsixf(a: u32) callconv(.c) f80 { |
lib/compiler_rt/floatuntidf.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floatuntidf_windows_x86_64, "__floatuntidf"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__floatuntidf, "__floatuntidf"); |
lib/compiler_rt/floatuntihf.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floatuntihf_windows_x86_64, "__floatuntihf"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__floatuntihf, "__floatuntihf"); |
lib/compiler_rt/floatuntisf.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__floatuntisf_windows_x86_64, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__floatuntisf_windows_x86_64, "__floatuntisf"); | |
| 8 | 9 | } else { |
| 9 | @export(&__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__floatuntisf, "__floatuntisf"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/floatuntitf.zig+3-3| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 6 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 7 | 7 | symbol(&__floatuntitf_windows_x86_64, "__floatuntitf"); |
| 8 | 8 | } else { |
| 9 | if (common.want_ppc_abi) | |
| 9 | if (compiler_rt.want_ppc_abi) | |
| 10 | 10 | symbol(&__floatuntitf, "__floatuntikf"); |
| 11 | 11 | symbol(&__floatuntitf, "__floatuntitf"); |
| 12 | 12 | } |
lib/compiler_rt/floatuntixf.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | if (common.want_windows_v2u64_abi) { | |
| 7 | @export(&__floatuntixf_windows_x86_64, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 8 | symbol(&__floatuntixf_windows_x86_64, "__floatuntixf"); | |
| 8 | 9 | } else { |
| 9 | @export(&__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__floatuntixf, "__floatuntixf"); | |
| 10 | 11 | } |
| 11 | 12 | } |
| 12 | 13 |
lib/compiler_rt/floor_ceil.zig+6-6| ... | ... | @@ -14,7 +14,7 @@ const math = std.math; |
| 14 | 14 | const mem = std.mem; |
| 15 | 15 | const expect = std.testing.expect; |
| 16 | 16 | |
| 17 | const common = @import("common.zig"); | |
| 17 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 18 | 18 | const symbol = @import("../compiler_rt.zig").symbol; |
| 19 | 19 | |
| 20 | 20 | comptime { |
| ... | ... | @@ -23,7 +23,7 @@ comptime { |
| 23 | 23 | symbol(&floorf, "floorf"); |
| 24 | 24 | symbol(&floor, "floor"); |
| 25 | 25 | symbol(&__floorx, "__floorx"); |
| 26 | if (common.want_ppc_abi) { | |
| 26 | if (compiler_rt.want_ppc_abi) { | |
| 27 | 27 | symbol(&floorq, "floorf128"); |
| 28 | 28 | } |
| 29 | 29 | symbol(&floorq, "floorq"); |
| ... | ... | @@ -34,7 +34,7 @@ comptime { |
| 34 | 34 | symbol(&ceilf, "ceilf"); |
| 35 | 35 | symbol(&ceil, "ceil"); |
| 36 | 36 | symbol(&__ceilx, "__ceilx"); |
| 37 | if (common.want_ppc_abi) { | |
| 37 | if (compiler_rt.want_ppc_abi) { | |
| 38 | 38 | symbol(&ceilq, "ceilf128"); |
| 39 | 39 | } |
| 40 | 40 | symbol(&ceilq, "ceilq"); |
| ... | ... | @@ -106,11 +106,11 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T { |
| 106 | 106 | if (e >= 0) { |
| 107 | 107 | const m = (@as(U, 1) << @intCast(mantissa - e)) - 1; |
| 108 | 108 | if (u & m == 0) return x; |
| 109 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120); | |
| 109 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120); | |
| 110 | 110 | if (u >> bits - 1 == @intFromBool(op == .floor)) u += m; |
| 111 | 111 | return @bitCast(u & ~m); |
| 112 | 112 | } else { |
| 113 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120); | |
| 113 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120); | |
| 114 | 114 | return switch (op) { |
| 115 | 115 | .floor => if (u >> bits - 1 == 0) 0.0 else if (u << 1 != 0) -1.0 else x, |
| 116 | 116 | .ceil => if (u >> bits - 1 != 0) -0.0 else if (u << 1 != 0) 1.0 else x, |
| ... | ... | @@ -128,7 +128,7 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T { |
| 128 | 128 | x - C + C - x; |
| 129 | 129 | |
| 130 | 130 | if (e <= bias - 1) { |
| 131 | if (common.want_float_exceptions) mem.doNotOptimizeAway(y); | |
| 131 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(y); | |
| 132 | 132 | return switch (op) { |
| 133 | 133 | .floor => if (positive) 0.0 else -1.0, |
| 134 | 134 | .ceil => if (positive) 1.0 else -0.0, |
lib/compiler_rt/fma.zig+10-9| ... | ... | @@ -8,18 +8,19 @@ |
| 8 | 8 | const std = @import("std"); |
| 9 | 9 | const math = std.math; |
| 10 | 10 | const expect = std.testing.expect; |
| 11 | const common = @import("common.zig"); | |
| 11 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 12 | const symbol = compiler_rt.symbol; | |
| 12 | 13 | |
| 13 | 14 | comptime { |
| 14 | @export(&__fmah, .{ .name = "__fmah", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&fmaf, .{ .name = "fmaf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&fma, .{ .name = "fma", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&__fmax, .{ .name = "__fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | if (common.want_ppc_abi) { | |
| 19 | @export(&fmaq, .{ .name = "fmaf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | symbol(&__fmah, "__fmah"); | |
| 16 | symbol(&fmaf, "fmaf"); | |
| 17 | symbol(&fma, "fma"); | |
| 18 | symbol(&__fmax, "__fmax"); | |
| 19 | if (compiler_rt.want_ppc_abi) { | |
| 20 | symbol(&fmaq, "fmaf128"); | |
| 20 | 21 | } |
| 21 | @export(&fmaq, .{ .name = "fmaq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&fmal, .{ .name = "fmal", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | symbol(&fmaq, "fmaq"); | |
| 23 | symbol(&fmal, "fmal"); | |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | pub fn __fmah(x: f16, y: f16, z: f16) callconv(.c) f16 { |
lib/compiler_rt/fmax.zig+10-9| ... | ... | @@ -2,18 +2,19 @@ const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const math = std.math; |
| 4 | 4 | const arch = builtin.cpu.arch; |
| 5 | const common = @import("common.zig"); | |
| 5 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 6 | const symbol = compiler_rt.symbol; | |
| 6 | 7 | |
| 7 | 8 | comptime { |
| 8 | @export(&__fmaxh, .{ .name = "__fmaxh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&fmaxf, .{ .name = "fmaxf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&fmax, .{ .name = "fmax", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | if (common.want_ppc_abi) { | |
| 13 | @export(&fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__fmaxh, "__fmaxh"); | |
| 10 | symbol(&fmaxf, "fmaxf"); | |
| 11 | symbol(&fmax, "fmax"); | |
| 12 | symbol(&__fmaxx, "__fmaxx"); | |
| 13 | if (compiler_rt.want_ppc_abi) { | |
| 14 | symbol(&fmaxq, "fmaxf128"); | |
| 14 | 15 | } |
| 15 | @export(&fmaxq, .{ .name = "fmaxq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&fmaxl, .{ .name = "fmaxl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | symbol(&fmaxq, "fmaxq"); | |
| 17 | symbol(&fmaxl, "fmaxl"); | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | pub fn __fmaxh(x: f16, y: f16) callconv(.c) f16 { |
lib/compiler_rt/fmin.zig+10-9| ... | ... | @@ -2,18 +2,19 @@ const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const math = std.math; |
| 4 | 4 | const arch = builtin.cpu.arch; |
| 5 | const common = @import("common.zig"); | |
| 5 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 6 | const symbol = compiler_rt.symbol; | |
| 6 | 7 | |
| 7 | 8 | comptime { |
| 8 | @export(&__fminh, .{ .name = "__fminh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&fminf, .{ .name = "fminf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&fmin, .{ .name = "fmin", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__fminx, .{ .name = "__fminx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | if (common.want_ppc_abi) { | |
| 13 | @export(&fminq, .{ .name = "fminf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__fminh, "__fminh"); | |
| 10 | symbol(&fminf, "fminf"); | |
| 11 | symbol(&fmin, "fmin"); | |
| 12 | symbol(&__fminx, "__fminx"); | |
| 13 | if (compiler_rt.want_ppc_abi) { | |
| 14 | symbol(&fminq, "fminf128"); | |
| 14 | 15 | } |
| 15 | @export(&fminq, .{ .name = "fminq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&fminl, .{ .name = "fminl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | symbol(&fminq, "fminq"); | |
| 17 | symbol(&fminl, "fminl"); | |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | pub fn __fminh(x: f16, y: f16) callconv(.c) f16 { |
lib/compiler_rt/fmod.zig+11-10| ... | ... | @@ -3,19 +3,20 @@ const std = @import("std"); |
| 3 | 3 | const math = std.math; |
| 4 | 4 | const assert = std.debug.assert; |
| 5 | 5 | const arch = builtin.cpu.arch; |
| 6 | const common = @import("common.zig"); | |
| 7 | const normalize = common.normalize; | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | const symbol = compiler_rt.symbol; | |
| 8 | const normalize = compiler_rt.normalize; | |
| 8 | 9 | |
| 9 | 10 | comptime { |
| 10 | @export(&__fmodh, .{ .name = "__fmodh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&fmodf, .{ .name = "fmodf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&fmod, .{ .name = "fmod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__fmodx, .{ .name = "__fmodx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | if (common.want_ppc_abi) { | |
| 15 | @export(&fmodq, .{ .name = "fmodf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__fmodh, "__fmodh"); | |
| 12 | symbol(&fmodf, "fmodf"); | |
| 13 | symbol(&fmod, "fmod"); | |
| 14 | symbol(&__fmodx, "__fmodx"); | |
| 15 | if (compiler_rt.want_ppc_abi) { | |
| 16 | symbol(&fmodq, "fmodf128"); | |
| 16 | 17 | } |
| 17 | @export(&fmodq, .{ .name = "fmodq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&fmodl, .{ .name = "fmodl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | symbol(&fmodq, "fmodq"); | |
| 19 | symbol(&fmodl, "fmodl"); | |
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | pub fn __fmodh(x: f16, y: f16) callconv(.c) f16 { |
lib/compiler_rt/gedf2.zig+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | 4 | const comparef = @import("./comparef.zig"); |
| 5 | 5 | const symbol = @import("../compiler_rt.zig").symbol; |
| 6 | 6 | |
| 7 | 7 | comptime { |
| 8 | if (common.want_aeabi) { | |
| 8 | if (compiler_rt.want_aeabi) { | |
| 9 | 9 | symbol(&__aeabi_dcmpge, "__aeabi_dcmpge"); |
| 10 | 10 | symbol(&__aeabi_dcmpgt, "__aeabi_dcmpgt"); |
| 11 | 11 | } else { |
lib/compiler_rt/gesf2.zig+7-6| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const comparef = @import("./comparef.zig"); |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | if (common.want_aeabi) { | |
| 8 | @export(&__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | if (compiler_rt.want_aeabi) { | |
| 9 | symbol(&__aeabi_fcmpge, "__aeabi_fcmpge"); | |
| 10 | symbol(&__aeabi_fcmpgt, "__aeabi_fcmpgt"); | |
| 10 | 11 | } else { |
| 11 | @export(&__gesf2, .{ .name = "__gesf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | @export(&__gtsf2, .{ .name = "__gtsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | symbol(&__gesf2, "__gesf2"); | |
| 13 | symbol(&__gtsf2, "__gtsf2"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/getf2.zig+8-7| ... | ... | @@ -1,18 +1,19 @@ |
| 1 | 1 | ///! The quoted behavior definitions are from |
| 2 | 2 | ///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const comparef = @import("./comparef.zig"); |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | if (common.want_ppc_abi) { | |
| 8 | @export(&__getf2, .{ .name = "__gekf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | } else if (common.want_sparc_abi) { | |
| 8 | if (compiler_rt.want_ppc_abi) { | |
| 9 | symbol(&__getf2, "__gekf2"); | |
| 10 | symbol(&__gttf2, "__gtkf2"); | |
| 11 | } else if (compiler_rt.want_sparc_abi) { | |
| 11 | 12 | // These exports are handled in cmptf2.zig because gt and ge on sparc |
| 12 | 13 | // are based on calling _Qp_cmp. |
| 13 | 14 | } |
| 14 | @export(&__getf2, .{ .name = "__getf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__gttf2, .{ .name = "__gttf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | symbol(&__getf2, "__getf2"); | |
| 16 | symbol(&__gttf2, "__gttf2"); | |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | /// "These functions return a value greater than or equal to zero if neither |
lib/compiler_rt/hexagon.zig+27-25| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | ||
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 3 | 5 | |
| 4 | 6 | fn __hexagon_divsi3() callconv(.naked) noreturn { |
| 5 | 7 | asm volatile ( |
| ... | ... | @@ -1759,29 +1761,29 @@ fn __hexagon_sqrtdf2() align(32) callconv(.naked) noreturn { |
| 1759 | 1761 | |
| 1760 | 1762 | comptime { |
| 1761 | 1763 | if (builtin.cpu.arch == .hexagon) { |
| 1762 | @export(&__hexagon_adddf3, .{ .name = "__hexagon_adddf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1763 | @export(&__hexagon_adddf3, .{ .name = "__hexagon_fast_adddf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1764 | @export(&__hexagon_subdf3, .{ .name = "__hexagon_subdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1765 | @export(&__hexagon_subdf3, .{ .name = "__hexagon_fast_subdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1766 | @export(&__hexagon_divdf3, .{ .name = "__hexagon_divdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1767 | @export(&__hexagon_divdf3, .{ .name = "__hexagon_fast_divdf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1768 | @export(&__hexagon_muldf3, .{ .name = "__hexagon_muldf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1769 | @export(&__hexagon_muldf3, .{ .name = "__hexagon_fast_muldf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1770 | @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_sqrtdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1771 | @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_fast2_sqrtdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1772 | @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_sqrt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1773 | @export(&__hexagon_divsf3, .{ .name = "__hexagon_divsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1774 | @export(&__hexagon_divsf3, .{ .name = "__hexagon_fast_divsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1775 | @export(&__hexagon_divsi3, .{ .name = "__hexagon_divsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1776 | @export(&__hexagon_umodsi3, .{ .name = "__hexagon_umodsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1777 | @export(&__hexagon_sqrtf, .{ .name = "__hexagon_sqrtf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1778 | @export(&__hexagon_sqrtf, .{ .name = "__hexagon_fast2_sqrtf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1779 | @export(&__hexagon_moddi3, .{ .name = "__hexagon_moddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1780 | @export(&__hexagon_divdi3, .{ .name = "__hexagon_divdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1781 | @export(&__hexagon_udivdi3, .{ .name = "__hexagon_udivdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1782 | @export(&__hexagon_umoddi3, .{ .name = "__hexagon_umoddi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1783 | @export(&__hexagon_modsi3, .{ .name = "__hexagon_modsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1784 | @export(&__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes, .{ .name = "__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1785 | @export(&__hexagon_udivsi3, .{ .name = "__hexagon_udivsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 1764 | symbol(&__hexagon_adddf3, "__hexagon_adddf3"); | |
| 1765 | symbol(&__hexagon_adddf3, "__hexagon_fast_adddf3"); | |
| 1766 | symbol(&__hexagon_subdf3, "__hexagon_subdf3"); | |
| 1767 | symbol(&__hexagon_subdf3, "__hexagon_fast_subdf3"); | |
| 1768 | symbol(&__hexagon_divdf3, "__hexagon_divdf3"); | |
| 1769 | symbol(&__hexagon_divdf3, "__hexagon_fast_divdf3"); | |
| 1770 | symbol(&__hexagon_muldf3, "__hexagon_muldf3"); | |
| 1771 | symbol(&__hexagon_muldf3, "__hexagon_fast_muldf3"); | |
| 1772 | symbol(&__hexagon_sqrtdf2, "__hexagon_sqrtdf2"); | |
| 1773 | symbol(&__hexagon_sqrtdf2, "__hexagon_fast2_sqrtdf2"); | |
| 1774 | symbol(&__hexagon_sqrtdf2, "__hexagon_sqrt"); | |
| 1775 | symbol(&__hexagon_divsf3, "__hexagon_divsf3"); | |
| 1776 | symbol(&__hexagon_divsf3, "__hexagon_fast_divsf3"); | |
| 1777 | symbol(&__hexagon_divsi3, "__hexagon_divsi3"); | |
| 1778 | symbol(&__hexagon_umodsi3, "__hexagon_umodsi3"); | |
| 1779 | symbol(&__hexagon_sqrtf, "__hexagon_sqrtf"); | |
| 1780 | symbol(&__hexagon_sqrtf, "__hexagon_fast2_sqrtf"); | |
| 1781 | symbol(&__hexagon_moddi3, "__hexagon_moddi3"); | |
| 1782 | symbol(&__hexagon_divdi3, "__hexagon_divdi3"); | |
| 1783 | symbol(&__hexagon_udivdi3, "__hexagon_udivdi3"); | |
| 1784 | symbol(&__hexagon_umoddi3, "__hexagon_umoddi3"); | |
| 1785 | symbol(&__hexagon_modsi3, "__hexagon_modsi3"); | |
| 1786 | symbol(&__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes, "__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes"); | |
| 1787 | symbol(&__hexagon_udivsi3, "__hexagon_udivsi3"); | |
| 1786 | 1788 | } |
| 1787 | 1789 | } |
lib/compiler_rt/int.zig+4-4| ... | ... | @@ -8,16 +8,16 @@ const testing = std.testing; |
| 8 | 8 | const maxInt = std.math.maxInt; |
| 9 | 9 | const minInt = std.math.minInt; |
| 10 | 10 | |
| 11 | const common = @import("common.zig"); | |
| 12 | const symbol = @import("../compiler_rt.zig").symbol; | |
| 11 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 12 | const symbol = compiler_rt.symbol; | |
| 13 | 13 | const udivmod = @import("udivmod.zig").udivmod; |
| 14 | const __divti3 = @import("divti3.zig").__divti3; | |
| 14 | const __divti3 = @import("udivmod.zig").__divti3; | |
| 15 | 15 | |
| 16 | 16 | comptime { |
| 17 | 17 | symbol(&__divmodti4, "__divmodti4"); |
| 18 | 18 | symbol(&__udivmoddi4, "__udivmoddi4"); |
| 19 | 19 | symbol(&__divmoddi4, "__divmoddi4"); |
| 20 | if (common.want_aeabi) { | |
| 20 | if (compiler_rt.want_aeabi) { | |
| 21 | 21 | symbol(&__aeabi_idiv, "__aeabi_idiv"); |
| 22 | 22 | symbol(&__aeabi_uidiv, "__aeabi_uidiv"); |
| 23 | 23 | } else { |
lib/compiler_rt/int_from_float.zig+48-3| ... | ... | @@ -1,13 +1,58 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const Int = std.meta.Int; | |
| 3 | 2 | const math = std.math; |
| 4 | const Log2Int = math.Log2Int; | |
| 3 | const Log2Int = std.math.Log2Int; | |
| 4 | ||
| 5 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 6 | const symbol = compiler_rt.symbol; | |
| 7 | ||
| 8 | comptime { | |
| 9 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 10 | symbol(&__fixxfti_windows_x86_64, "__fixxfti"); | |
| 11 | } else { | |
| 12 | symbol(&__fixxfti, "__fixxfti"); | |
| 13 | } | |
| 14 | ||
| 15 | symbol(&__fixhfsi, "__fixhfsi"); | |
| 16 | symbol(&__fixhfdi, "__fixhfdi"); | |
| 17 | ||
| 18 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 19 | symbol(&__fixhfti_windows_x86_64, "__fixhfti"); | |
| 20 | } else { | |
| 21 | symbol(&__fixhfti, "__fixhfti"); | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | const v2u64 = @Vector(2, u64); | |
| 26 | ||
| 27 | pub fn __fixhfti(a: f16) callconv(.c) i128 { | |
| 28 | return intFromFloat(i128, a); | |
| 29 | } | |
| 30 | ||
| 31 | fn __fixhfti_windows_x86_64(a: f16) callconv(.c) v2u64 { | |
| 32 | return @bitCast(intFromFloat(i128, a)); | |
| 33 | } | |
| 34 | ||
| 35 | fn __fixhfdi(a: f16) callconv(.c) i64 { | |
| 36 | return intFromFloat(i64, a); | |
| 37 | } | |
| 38 | ||
| 39 | fn __fixhfsi(a: f16) callconv(.c) i32 { | |
| 40 | return intFromFloat(i32, a); | |
| 41 | } | |
| 42 | ||
| 43 | pub fn __fixxfti(a: f80) callconv(.c) i128 { | |
| 44 | return intFromFloat(i128, a); | |
| 45 | } | |
| 46 | ||
| 47 | fn __fixxfti_windows_x86_64(a: f80) callconv(.c) v2u64 { | |
| 48 | return @bitCast(intFromFloat(i128, a)); | |
| 49 | } | |
| 5 | 50 | |
| 6 | 51 | pub inline fn intFromFloat(comptime I: type, a: anytype) I { |
| 7 | 52 | const F = @TypeOf(a); |
| 8 | 53 | const float_bits = @typeInfo(F).float.bits; |
| 9 | 54 | const int_bits = @typeInfo(I).int.bits; |
| 10 | const rep_t = Int(.unsigned, float_bits); | |
| 55 | const rep_t = @Int(.unsigned, float_bits); | |
| 11 | 56 | const sig_bits = math.floatMantissaBits(F); |
| 12 | 57 | const exp_bits = math.floatExponentBits(F); |
| 13 | 58 | const fractional_bits = math.floatFractionalBits(F); |
lib/compiler_rt/log.zig+6-6| ... | ... | @@ -9,7 +9,7 @@ const math = std.math; |
| 9 | 9 | const expect = std.testing.expect; |
| 10 | 10 | const expectEqual = std.testing.expectEqual; |
| 11 | 11 | |
| 12 | const common = @import("common.zig"); | |
| 12 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 13 | 13 | const symbol = @import("../compiler_rt.zig").symbol; |
| 14 | 14 | |
| 15 | 15 | comptime { |
| ... | ... | @@ -17,7 +17,7 @@ comptime { |
| 17 | 17 | symbol(&logf, "logf"); |
| 18 | 18 | symbol(&log, "log"); |
| 19 | 19 | symbol(&__logx, "__logx"); |
| 20 | if (common.want_ppc_abi) { | |
| 20 | if (compiler_rt.want_ppc_abi) { | |
| 21 | 21 | symbol(&logq, "logf128"); |
| 22 | 22 | } |
| 23 | 23 | symbol(&logq, "logq"); |
| ... | ... | @@ -45,11 +45,11 @@ pub fn logf(x_: f32) callconv(.c) f32 { |
| 45 | 45 | if (ix < 0x00800000 or ix >> 31 != 0) { |
| 46 | 46 | // log(+-0) = -inf |
| 47 | 47 | if (ix << 1 == 0) { |
| 48 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 48 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 49 | 49 | } |
| 50 | 50 | // log(-#) = nan |
| 51 | 51 | if (ix >> 31 != 0) { |
| 52 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 52 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // subnormal, scale x |
| ... | ... | @@ -398,13 +398,13 @@ pub fn log(x: f64) callconv(.c) f64 { |
| 398 | 398 | @branchHint(.unlikely); |
| 399 | 399 | |
| 400 | 400 | if (ix << 1 == 0) |
| 401 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 401 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 402 | 402 | |
| 403 | 403 | if (ix == @as(i64, @bitCast(std.math.inf(f64)))) |
| 404 | 404 | return x; |
| 405 | 405 | |
| 406 | 406 | if (top & 0x8000 != 0 or top & 0x7ff0 == 0x7ff0) |
| 407 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 407 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 408 | 408 | |
| 409 | 409 | ix = @as(i64, @bitCast(x * 0x1p52)) - (52 << 52); |
| 410 | 410 | } |
lib/compiler_rt/log10.zig+6-6| ... | ... | @@ -10,7 +10,7 @@ const expect = std.testing.expect; |
| 10 | 10 | const expectEqual = std.testing.expectEqual; |
| 11 | 11 | const maxInt = std.math.maxInt; |
| 12 | 12 | |
| 13 | const common = @import("common.zig"); | |
| 13 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 14 | 14 | const symbol = @import("../compiler_rt.zig").symbol; |
| 15 | 15 | |
| 16 | 16 | comptime { |
| ... | ... | @@ -18,7 +18,7 @@ comptime { |
| 18 | 18 | symbol(&log10f, "log10f"); |
| 19 | 19 | symbol(&log10, "log10"); |
| 20 | 20 | symbol(&__log10x, "__log10x"); |
| 21 | if (common.want_ppc_abi) { | |
| 21 | if (compiler_rt.want_ppc_abi) { | |
| 22 | 22 | symbol(&log10q, "log10f128"); |
| 23 | 23 | } |
| 24 | 24 | symbol(&log10q, "log10q"); |
| ... | ... | @@ -49,11 +49,11 @@ pub fn log10f(x_: f32) callconv(.c) f32 { |
| 49 | 49 | if (ix < 0x00800000 or ix >> 31 != 0) { |
| 50 | 50 | // log(+-0) = -inf |
| 51 | 51 | if (ix << 1 == 0) { |
| 52 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 52 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 53 | 53 | } |
| 54 | 54 | // log(-#) = nan |
| 55 | 55 | if (ix >> 31 != 0) { |
| 56 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 56 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | k -= 25; |
| ... | ... | @@ -111,11 +111,11 @@ pub fn log10(x_: f64) callconv(.c) f64 { |
| 111 | 111 | if (hx < 0x00100000 or hx >> 31 != 0) { |
| 112 | 112 | // log(+-0) = -inf |
| 113 | 113 | if (ix << 1 == 0) { |
| 114 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 114 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 115 | 115 | } |
| 116 | 116 | // log(-#) = nan |
| 117 | 117 | if (hx >> 31 != 0) { |
| 118 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 118 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // subnormal, scale x |
lib/compiler_rt/log2.zig+14-13| ... | ... | @@ -11,18 +11,19 @@ const expect = std.testing.expect; |
| 11 | 11 | const expectEqual = std.testing.expectEqual; |
| 12 | 12 | const maxInt = std.math.maxInt; |
| 13 | 13 | const arch = builtin.cpu.arch; |
| 14 | const common = @import("common.zig"); | |
| 14 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 15 | const symbol = compiler_rt.symbol; | |
| 15 | 16 | |
| 16 | 17 | comptime { |
| 17 | @export(&__log2h, .{ .name = "__log2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&log2f, .{ .name = "log2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&log2, .{ .name = "log2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&__log2x, .{ .name = "__log2x", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | if (common.want_ppc_abi) { | |
| 22 | @export(&log2q, .{ .name = "log2f128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | symbol(&__log2h, "__log2h"); | |
| 19 | symbol(&log2f, "log2f"); | |
| 20 | symbol(&log2, "log2"); | |
| 21 | symbol(&__log2x, "__log2x"); | |
| 22 | if (compiler_rt.want_ppc_abi) { | |
| 23 | symbol(&log2q, "log2f128"); | |
| 23 | 24 | } |
| 24 | @export(&log2q, .{ .name = "log2q", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&log2l, .{ .name = "log2l", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | symbol(&log2q, "log2q"); | |
| 26 | symbol(&log2l, "log2l"); | |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | pub fn __log2h(a: f16) callconv(.c) f16 { |
| ... | ... | @@ -47,11 +48,11 @@ pub fn log2f(x_: f32) callconv(.c) f32 { |
| 47 | 48 | if (ix < 0x00800000 or ix >> 31 != 0) { |
| 48 | 49 | // log(+-0) = -inf |
| 49 | 50 | if (ix << 1 == 0) { |
| 50 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 51 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 51 | 52 | } |
| 52 | 53 | // log(-#) = nan |
| 53 | 54 | if (ix >> 31 != 0) { |
| 54 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 55 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | k -= 25; |
| ... | ... | @@ -105,11 +106,11 @@ pub fn log2(x_: f64) callconv(.c) f64 { |
| 105 | 106 | if (hx < 0x00100000 or hx >> 31 != 0) { |
| 106 | 107 | // log(+-0) = -inf |
| 107 | 108 | if (ix << 1 == 0) { |
| 108 | return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 109 | return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64); | |
| 109 | 110 | } |
| 110 | 111 | // log(-#) = nan |
| 111 | 112 | if (hx >> 31 != 0) { |
| 112 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 113 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 113 | 114 | } |
| 114 | 115 | |
| 115 | 116 | // subnormal, scale x |
lib/compiler_rt/memcpy.zig+4-4| ... | ... | @@ -1,14 +1,14 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const common = @import("./common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | 4 | const builtin = @import("builtin"); |
| 5 | 5 | |
| 6 | 6 | comptime { |
| 7 | 7 | if (builtin.object_format != .c) { |
| 8 | 8 | const export_options: std.builtin.ExportOptions = .{ |
| 9 | 9 | .name = "memcpy", |
| 10 | .linkage = common.linkage, | |
| 11 | .visibility = common.visibility, | |
| 10 | .linkage = compiler_rt.linkage, | |
| 11 | .visibility = compiler_rt.visibility, | |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | 14 | if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64) |
| ... | ... | @@ -18,7 +18,7 @@ comptime { |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | const Element = common.PreferredLoadStoreElement; | |
| 21 | const Element = compiler_rt.PreferredLoadStoreElement; | |
| 22 | 22 | |
| 23 | 23 | comptime { |
| 24 | 24 | assert(std.math.isPowerOfTwo(@sizeOf(Element))); |
lib/compiler_rt/memmove.zig+10-10| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | 3 | const builtin = @import("builtin"); |
| 4 | 4 | const assert = std.debug.assert; |
| 5 | 5 | const memcpy = @import("memcpy.zig"); |
| 6 | 6 | |
| 7 | const Element = common.PreferredLoadStoreElement; | |
| 7 | const Element = compiler_rt.PreferredLoadStoreElement; | |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | 10 | if (builtin.object_format != .c) { |
| 11 | 11 | const export_options: std.builtin.ExportOptions = .{ |
| 12 | 12 | .name = "memmove", |
| 13 | .linkage = common.linkage, | |
| 14 | .visibility = common.visibility, | |
| 13 | .linkage = compiler_rt.linkage, | |
| 14 | .visibility = compiler_rt.visibility, | |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | 17 | if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64) |
| ... | ... | @@ -39,7 +39,7 @@ fn memmoveSmall(opt_dest: ?[*]u8, opt_src: ?[*]const u8, len: usize) callconv(.c |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | fn memmoveFast(dest: ?[*]u8, src: ?[*]u8, len: usize) callconv(.c) ?[*]u8 { |
| 42 | @setRuntimeSafety(common.test_safety); | |
| 42 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 43 | 43 | const small_limit = @max(2 * @sizeOf(Element), @sizeOf(Element)); |
| 44 | 44 | |
| 45 | 45 | if (copySmallLength(small_limit, dest.?, src.?, len)) return dest; |
| ... | ... | @@ -79,7 +79,7 @@ inline fn copyLessThan16( |
| 79 | 79 | src: [*]const u8, |
| 80 | 80 | len: usize, |
| 81 | 81 | ) void { |
| 82 | @setRuntimeSafety(common.test_safety); | |
| 82 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 83 | 83 | if (len < 4) { |
| 84 | 84 | if (len == 0) return; |
| 85 | 85 | const b = len / 2; |
| ... | ... | @@ -100,7 +100,7 @@ inline fn copy16ToSmallLimit( |
| 100 | 100 | src: [*]const u8, |
| 101 | 101 | len: usize, |
| 102 | 102 | ) bool { |
| 103 | @setRuntimeSafety(common.test_safety); | |
| 103 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 104 | 104 | inline for (2..(std.math.log2(small_limit) + 1) / 2 + 1) |p| { |
| 105 | 105 | const limit = 1 << (2 * p); |
| 106 | 106 | if (len < limit) { |
| ... | ... | @@ -119,7 +119,7 @@ inline fn copyRange4( |
| 119 | 119 | src: [*]const u8, |
| 120 | 120 | len: usize, |
| 121 | 121 | ) void { |
| 122 | @setRuntimeSafety(common.test_safety); | |
| 122 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 123 | 123 | comptime assert(std.math.isPowerOfTwo(copy_len)); |
| 124 | 124 | assert(len >= copy_len); |
| 125 | 125 | assert(len < 4 * copy_len); |
| ... | ... | @@ -147,7 +147,7 @@ inline fn copyForwards( |
| 147 | 147 | src: [*]const u8, |
| 148 | 148 | len: usize, |
| 149 | 149 | ) void { |
| 150 | @setRuntimeSafety(common.test_safety); | |
| 150 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 151 | 151 | assert(len >= 2 * @sizeOf(Element)); |
| 152 | 152 | |
| 153 | 153 | const head = src[0..@sizeOf(Element)].*; |
| ... | ... | @@ -181,7 +181,7 @@ inline fn copyBlocks( |
| 181 | 181 | src: anytype, |
| 182 | 182 | max_bytes: usize, |
| 183 | 183 | ) void { |
| 184 | @setRuntimeSafety(common.test_safety); | |
| 184 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 185 | 185 | |
| 186 | 186 | const T = @typeInfo(@TypeOf(dest)).pointer.child; |
| 187 | 187 | comptime assert(T == @typeInfo(@TypeOf(src)).pointer.child); |
lib/compiler_rt/memset.zig deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const common = @import("./common.zig"); | |
| 3 | const builtin = @import("builtin"); | |
| 4 | ||
| 5 | comptime { | |
| 6 | if (builtin.object_format != .c) { | |
| 7 | @export(&memset, .{ .name = "memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__memset, .{ .name = "__memset", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | } | |
| 10 | } | |
| 11 | ||
| 12 | pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.c) ?[*]u8 { | |
| 13 | @setRuntimeSafety(false); | |
| 14 | ||
| 15 | if (len != 0) { | |
| 16 | var d = dest.?; | |
| 17 | var n = len; | |
| 18 | while (true) { | |
| 19 | d[0] = c; | |
| 20 | n -= 1; | |
| 21 | if (n == 0) break; | |
| 22 | d += 1; | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | return dest; | |
| 27 | } | |
| 28 | ||
| 29 | pub fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.c) ?[*]u8 { | |
| 30 | if (dest_n < n) | |
| 31 | @panic("buffer overflow"); | |
| 32 | return memset(dest, c, n); | |
| 33 | } |
lib/compiler_rt/modti3.zig deleted-42| ... | ... | @@ -1,42 +0,0 @@ |
| 1 | //! Ported from: | |
| 2 | //! | |
| 3 | //! https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/modti3.c | |
| 4 | ||
| 5 | const std = @import("std"); | |
| 6 | const builtin = @import("builtin"); | |
| 7 | const udivmod = @import("udivmod.zig").udivmod; | |
| 8 | const common = @import("common.zig"); | |
| 9 | ||
| 10 | comptime { | |
| 11 | if (common.want_windows_v2u64_abi) { | |
| 12 | @export(&__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | } else { | |
| 14 | @export(&__modti3, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | pub fn __modti3(a: i128, b: i128) callconv(.c) i128 { | |
| 19 | return mod(a, b); | |
| 20 | } | |
| 21 | ||
| 22 | const v2u64 = @Vector(2, u64); | |
| 23 | ||
| 24 | fn __modti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 25 | return @bitCast(mod(@as(i128, @bitCast(a)), @as(i128, @bitCast(b)))); | |
| 26 | } | |
| 27 | ||
| 28 | inline fn mod(a: i128, b: i128) i128 { | |
| 29 | const s_a = a >> (128 - 1); // s = a < 0 ? -1 : 0 | |
| 30 | const s_b = b >> (128 - 1); // s = b < 0 ? -1 : 0 | |
| 31 | ||
| 32 | const an = (a ^ s_a) -% s_a; // negate if s == -1 | |
| 33 | const bn = (b ^ s_b) -% s_b; // negate if s == -1 | |
| 34 | ||
| 35 | var r: u128 = undefined; | |
| 36 | _ = udivmod(u128, @as(u128, @bitCast(an)), @as(u128, @bitCast(bn)), &r); | |
| 37 | return (@as(i128, @bitCast(r)) ^ s_a) -% s_a; // negate if s == -1 | |
| 38 | } | |
| 39 | ||
| 40 | test { | |
| 41 | _ = @import("modti3_test.zig"); | |
| 42 | } |
lib/compiler_rt/modti3_test.zig+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const __modti3 = @import("modti3.zig").__modti3; | |
| 1 | const __modti3 = @import("udivmod.zig").__modti3; | |
| 2 | 2 | const testing = @import("std").testing; |
| 3 | 3 | |
| 4 | 4 | fn test__modti3(a: i128, b: i128, expected: i128) !void { |
lib/compiler_rt/mulXi3.zig+11-10| ... | ... | @@ -1,20 +1,21 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | const std = @import("std"); |
| 3 | 3 | const testing = std.testing; |
| 4 | const common = @import("common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 5 | 6 | const native_endian = builtin.cpu.arch.endian(); |
| 6 | 7 | |
| 7 | 8 | comptime { |
| 8 | @export(&__mulsi3, .{ .name = "__mulsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | if (common.want_aeabi) { | |
| 10 | @export(&__aeabi_lmul, .{ .name = "__aeabi_lmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__mulsi3, "__mulsi3"); | |
| 10 | if (compiler_rt.want_aeabi) { | |
| 11 | symbol(&__aeabi_lmul, "__aeabi_lmul"); | |
| 11 | 12 | } else { |
| 12 | @export(&__muldi3, .{ .name = "__muldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__muldi3, "__muldi3"); | |
| 13 | 14 | } |
| 14 | if (common.want_windows_v2u64_abi) { | |
| 15 | @export(&__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 16 | symbol(&__multi3_windows_x86_64, "__multi3"); | |
| 16 | 17 | } else { |
| 17 | @export(&__multi3, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | symbol(&__multi3, "__multi3"); | |
| 18 | 19 | } |
| 19 | 20 | } |
| 20 | 21 | |
| ... | ... | @@ -41,7 +42,7 @@ fn __aeabi_lmul(a: i64, b: i64) callconv(.{ .arm_aapcs = .{} }) i64 { |
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | inline fn mulX(comptime T: type, a: T, b: T) T { |
| 44 | const word_t = common.HalveInt(T, false); | |
| 45 | const word_t = compiler_rt.HalveInt(T, false); | |
| 45 | 46 | const x = word_t{ .all = a }; |
| 46 | 47 | const y = word_t{ .all = b }; |
| 47 | 48 | var r = switch (T) { |
| ... | ... | @@ -64,7 +65,7 @@ fn DoubleInt(comptime T: type) type { |
| 64 | 65 | |
| 65 | 66 | fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) { |
| 66 | 67 | const DT = DoubleInt(T); |
| 67 | const word_t = common.HalveInt(DT, false); | |
| 68 | const word_t = compiler_rt.HalveInt(DT, false); | |
| 68 | 69 | const bits_in_word_2 = @sizeOf(T) * 8 / 2; |
| 69 | 70 | const lower_mask = (~@as(T, 0)) >> bits_in_word_2; |
| 70 | 71 |
lib/compiler_rt/muldf3.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const mulf3 = @import("./mulf3.zig").mulf3; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_dmul, "__aeabi_dmul"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__muldf3, "__muldf3"); |
lib/compiler_rt/mulf3.zig+4-4| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const math = std.math; |
| 3 | 3 | const builtin = @import("builtin"); |
| 4 | const common = @import("./common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | 5 | |
| 6 | 6 | /// Ported from: |
| 7 | 7 | /// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/fp_mul_impl.inc |
| 8 | 8 | pub inline fn mulf3(comptime T: type, a: T, b: T) T { |
| 9 | @setRuntimeSafety(common.test_safety); | |
| 9 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 10 | 10 | const typeWidth = @typeInfo(T).float.bits; |
| 11 | 11 | const significandBits = math.floatMantissaBits(T); |
| 12 | 12 | const fractionalBits = math.floatFractionalBits(T); |
| ... | ... | @@ -97,7 +97,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T { |
| 97 | 97 | var productHi: ZSignificand = undefined; |
| 98 | 98 | var productLo: ZSignificand = undefined; |
| 99 | 99 | const left_align_shift = ZSignificandBits - fractionalBits - 1; |
| 100 | common.wideMultiply(ZSignificand, aSignificand, bSignificand << left_align_shift, &productHi, &productLo); | |
| 100 | compiler_rt.wideMultiply(ZSignificand, aSignificand, bSignificand << left_align_shift, &productHi, &productLo); | |
| 101 | 101 | |
| 102 | 102 | var productExponent: i32 = @as(i32, @intCast(aExponent + bExponent)) - exponentBias + scale; |
| 103 | 103 | |
| ... | ... | @@ -163,7 +163,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T { |
| 163 | 163 | /// |
| 164 | 164 | /// This is analogous to an shr version of `@shlWithOverflow` |
| 165 | 165 | fn wideShrWithTruncation(comptime Z: type, hi: *Z, lo: *Z, count: u32) bool { |
| 166 | @setRuntimeSafety(common.test_safety); | |
| 166 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 167 | 167 | const typeWidth = @typeInfo(Z).int.bits; |
| 168 | 168 | var inexact = false; |
| 169 | 169 | if (count < typeWidth) { |
lib/compiler_rt/mulhc3.zig+3-2| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulc3 = @import("./mulc3.zig"); |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 6 | @export(&__mulhc3, .{ .name = "__mulhc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__mulhc3, "__mulhc3"); | |
| 7 | 8 | } |
| 8 | 9 | } |
| 9 | 10 |
lib/compiler_rt/mulhf3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulf3 = @import("./mulf3.zig").mulf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__mulhf3, .{ .name = "__mulhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__mulhf3, "__mulhf3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __mulhf3(a: f16, b: f16) callconv(.c) f16 { |
lib/compiler_rt/mulo.zig+5-4| ... | ... | @@ -1,12 +1,13 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const math = std.math; |
| 4 | const common = @import("common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | @export(&__mulosi4, .{ .name = "__mulosi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | @export(&__mulodi4, .{ .name = "__mulodi4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__muloti4, .{ .name = "__muloti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | symbol(&__mulosi4, "__mulosi4"); | |
| 9 | symbol(&__mulodi4, "__mulodi4"); | |
| 10 | symbol(&__muloti4, "__muloti4"); | |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | // mulo - multiplication overflow |
lib/compiler_rt/mulsf3.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulf3 = @import("./mulf3.zig").mulf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_fmul, "__aeabi_fmul"); | |
| 7 | 8 | } else { |
| 8 | @export(&__mulsf3, .{ .name = "__mulsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__mulsf3, "__mulsf3"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/multc3.zig+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const mulc3 = @import("./mulc3.zig"); |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 7 | if (common.want_ppc_abi) | |
| 7 | if (compiler_rt.want_ppc_abi) | |
| 8 | 8 | symbol(&__multc3, "__mulkc3"); |
| 9 | 9 | symbol(&__multc3, "__multc3"); |
| 10 | 10 | } |
lib/compiler_rt/multf3.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulf3 = @import("./mulf3.zig").mulf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__multf3, .{ .name = "__mulkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__multf3, "__mulkf3"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_mul, "_Qp_mul"); | |
| 9 | 10 | } |
| 10 | @export(&__multf3, .{ .name = "__multf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__multf3, "__multf3"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __multf3(a: f128, b: f128) callconv(.c) f128 { |
lib/compiler_rt/mulxc3.zig+3-2| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulc3 = @import("./mulc3.zig"); |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | 6 | if (@import("builtin").zig_backend != .stage2_c) { |
| 6 | @export(&__mulxc3, .{ .name = "__mulxc3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__mulxc3, "__mulxc3"); | |
| 7 | 8 | } |
| 8 | 9 | } |
| 9 | 10 |
lib/compiler_rt/mulxf3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const mulf3 = @import("./mulf3.zig").mulf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__mulxf3, .{ .name = "__mulxf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__mulxf3, "__mulxf3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __mulxf3(a: f80, b: f80) callconv(.c) f80 { |
lib/compiler_rt/negXi2.zig deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | //! neg - negate (the number) | |
| 2 | //! - negXi2 for unoptimized little and big endian | |
| 3 | //! sfffffff = 2^31-1 | |
| 4 | //! two's complement inverting bits and add 1 would result in -INT_MIN == 0 | |
| 5 | //! => -INT_MIN = -2^31 forbidden | |
| 6 | //! * size optimized builds | |
| 7 | //! * machines that dont support carry operations | |
| 8 | ||
| 9 | const std = @import("std"); | |
| 10 | const builtin = @import("builtin"); | |
| 11 | const common = @import("common.zig"); | |
| 12 | ||
| 13 | comptime { | |
| 14 | @export(&__negsi2, .{ .name = "__negsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__negdi2, .{ .name = "__negdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__negti2, .{ .name = "__negti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | } | |
| 18 | ||
| 19 | pub fn __negsi2(a: i32) callconv(.c) i32 { | |
| 20 | return negXi2(i32, a); | |
| 21 | } | |
| 22 | ||
| 23 | pub fn __negdi2(a: i64) callconv(.c) i64 { | |
| 24 | return negXi2(i64, a); | |
| 25 | } | |
| 26 | ||
| 27 | pub fn __negti2(a: i128) callconv(.c) i128 { | |
| 28 | return negXi2(i128, a); | |
| 29 | } | |
| 30 | ||
| 31 | inline fn negXi2(comptime T: type, a: T) T { | |
| 32 | return -a; | |
| 33 | } | |
| 34 | ||
| 35 | test { | |
| 36 | _ = @import("negsi2_test.zig"); | |
| 37 | _ = @import("negdi2_test.zig"); | |
| 38 | _ = @import("negti2_test.zig"); | |
| 39 | } |
lib/compiler_rt/negdf2.zig deleted-17| ... | ... | @@ -1,17 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | ||
| 3 | comptime { | |
| 4 | if (common.want_aeabi) { | |
| 5 | @export(&__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } else { | |
| 7 | @export(&__negdf2, .{ .name = "__negdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | } | |
| 9 | } | |
| 10 | ||
| 11 | fn __negdf2(a: f64) callconv(.c) f64 { | |
| 12 | return common.fneg(a); | |
| 13 | } | |
| 14 | ||
| 15 | fn __aeabi_dneg(a: f64) callconv(.{ .arm_aapcs = .{} }) f64 { | |
| 16 | return common.fneg(a); | |
| 17 | } |
lib/compiler_rt/negdi2_test.zig+5-3| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | const neg = @import("negXi2.zig"); | |
| 2 | const testing = @import("std").testing; | |
| 1 | const std = @import("std"); | |
| 2 | const testing = std.testing; | |
| 3 | ||
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | 5 | |
| 4 | 6 | fn test__negdi2(a: i64, expected: i64) !void { |
| 5 | const result = neg.__negdi2(a); | |
| 7 | const result = compiler_rt.__negdi2(a); | |
| 6 | 8 | try testing.expectEqual(expected, result); |
| 7 | 9 | } |
| 8 | 10 |
lib/compiler_rt/neghf2.zig deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | ||
| 3 | comptime { | |
| 4 | @export(&__neghf2, .{ .name = "__neghf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | } | |
| 6 | ||
| 7 | fn __neghf2(a: f16) callconv(.c) f16 { | |
| 8 | return common.fneg(a); | |
| 9 | } |
lib/compiler_rt/negsf2.zig deleted-17| ... | ... | @@ -1,17 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | ||
| 3 | comptime { | |
| 4 | if (common.want_aeabi) { | |
| 5 | @export(&__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } else { | |
| 7 | @export(&__negsf2, .{ .name = "__negsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 8 | } | |
| 9 | } | |
| 10 | ||
| 11 | fn __negsf2(a: f32) callconv(.c) f32 { | |
| 12 | return common.fneg(a); | |
| 13 | } | |
| 14 | ||
| 15 | fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 { | |
| 16 | return common.fneg(a); | |
| 17 | } |
lib/compiler_rt/negsi2_test.zig+3-2| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const neg = @import("negXi2.zig"); | |
| 3 | 2 | const testing = std.testing; |
| 4 | 3 | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | ||
| 5 | 6 | const print = std.debug.print; |
| 6 | 7 | |
| 7 | 8 | fn test__negsi2(a: i32, expected: i32) !void { |
| 8 | const result = neg.__negsi2(a); | |
| 9 | const result = compiler_rt.__negsi2(a); | |
| 9 | 10 | try testing.expectEqual(expected, result); |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/negtf2.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const symbol = @import("../compiler_rt.zig").symbol; | |
| 3 | ||
| 4 | comptime { | |
| 5 | if (common.want_ppc_abi) | |
| 6 | symbol(&__negtf2, "__negkf2"); | |
| 7 | symbol(&__negtf2, "__negtf2"); | |
| 8 | } | |
| 9 | ||
| 10 | fn __negtf2(a: f128) callconv(.c) f128 { | |
| 11 | return common.fneg(a); | |
| 12 | } |
lib/compiler_rt/negti2_test.zig+5-3| ... | ... | @@ -1,8 +1,10 @@ |
| 1 | const neg = @import("negXi2.zig"); | |
| 2 | const testing = @import("std").testing; | |
| 1 | const std = @import("std"); | |
| 2 | const testing = std.testing; | |
| 3 | ||
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | 5 | |
| 4 | 6 | fn test__negti2(a: i128, expected: i128) !void { |
| 5 | const result = neg.__negti2(a); | |
| 7 | const result = compiler_rt.__negti2(a); | |
| 6 | 8 | try testing.expectEqual(expected, result); |
| 7 | 9 | } |
| 8 | 10 |
lib/compiler_rt/negv.zig+5-4| ... | ... | @@ -3,12 +3,13 @@ |
| 3 | 3 | //! - negvXi4_generic for unoptimized version |
| 4 | 4 | const std = @import("std"); |
| 5 | 5 | const builtin = @import("builtin"); |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | const symbol = compiler_rt.symbol; | |
| 7 | 8 | |
| 8 | 9 | comptime { |
| 9 | @export(&__negvsi2, .{ .name = "__negvsi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__negvdi2, .{ .name = "__negvdi2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | @export(&__negvti2, .{ .name = "__negvti2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | symbol(&__negvsi2, "__negvsi2"); | |
| 11 | symbol(&__negvdi2, "__negvdi2"); | |
| 12 | symbol(&__negvti2, "__negvti2"); | |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | pub fn __negvsi2(a: i32) callconv(.c) i32 { |
lib/compiler_rt/negxf2.zig deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | ||
| 3 | comptime { | |
| 4 | @export(&__negxf2, .{ .name = "__negxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 5 | } | |
| 6 | ||
| 7 | fn __negxf2(a: f80) callconv(.c) f80 { | |
| 8 | return common.fneg(a); | |
| 9 | } |
lib/compiler_rt/os_version_check.zig+4-3| ... | ... | @@ -1,15 +1,16 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const testing = std.testing; |
| 3 | 3 | const builtin = @import("builtin"); |
| 4 | const common = @import("common.zig"); | |
| 5 | const panic = @import("common.zig").panic; | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 6 | const panic = @import("../compiler_rt.zig").panic; | |
| 6 | 7 | |
| 7 | 8 | const have_availability_version_check = builtin.os.tag.isDarwin() and |
| 8 | 9 | builtin.os.version_range.semver.min.order(.{ .major = 10, .minor = 15, .patch = 0 }).compare(.gte); |
| 9 | 10 | |
| 10 | 11 | comptime { |
| 11 | 12 | if (have_availability_version_check) { |
| 12 | @export(&__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__isPlatformVersionAtLeast, "__isPlatformVersionAtLeast"); | |
| 13 | 14 | } |
| 14 | 15 | } |
| 15 | 16 |
lib/compiler_rt/powiXf2.zig+2-2| ... | ... | @@ -3,14 +3,14 @@ |
| 3 | 3 | //! Multiplication order (left-to-right or right-to-left) does not matter for |
| 4 | 4 | //! error propagation and this method is optimized for performance, not accuracy. |
| 5 | 5 | |
| 6 | const common = @import("common.zig"); | |
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | 7 | const symbol = @import("../compiler_rt.zig").symbol; |
| 8 | 8 | |
| 9 | 9 | comptime { |
| 10 | 10 | symbol(&__powihf2, "__powihf2"); |
| 11 | 11 | symbol(&__powisf2, "__powisf2"); |
| 12 | 12 | symbol(&__powidf2, "__powidf2"); |
| 13 | if (common.want_ppc_abi) | |
| 13 | if (compiler_rt.want_ppc_abi) | |
| 14 | 14 | symbol(&__powitf2, "__powikf2"); |
| 15 | 15 | symbol(&__powitf2, "__powitf2"); |
| 16 | 16 | symbol(&__powixf2, "__powixf2"); |
lib/compiler_rt/round.zig+14-13| ... | ... | @@ -10,18 +10,19 @@ const math = std.math; |
| 10 | 10 | const mem = std.mem; |
| 11 | 11 | const expect = std.testing.expect; |
| 12 | 12 | const arch = builtin.cpu.arch; |
| 13 | const common = @import("common.zig"); | |
| 13 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 14 | const symbol = compiler_rt.symbol; | |
| 14 | 15 | |
| 15 | 16 | comptime { |
| 16 | @export(&__roundh, .{ .name = "__roundh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&roundf, .{ .name = "roundf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&round, .{ .name = "round", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__roundx, .{ .name = "__roundx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | if (common.want_ppc_abi) { | |
| 21 | @export(&roundq, .{ .name = "roundf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | } | |
| 23 | @export(&roundq, .{ .name = "roundq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 24 | @export(&roundl, .{ .name = "roundl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | symbol(&__roundh, "__roundh"); | |
| 18 | symbol(&roundf, "roundf"); | |
| 19 | symbol(&round, "round"); | |
| 20 | symbol(&__roundx, "__roundx"); | |
| 21 | if (compiler_rt.want_ppc_abi) { | |
| 22 | symbol(&roundq, "roundf128"); | |
| 23 | } | |
| 24 | symbol(&roundq, "roundq"); | |
| 25 | symbol(&roundl, "roundl"); | |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | pub fn __roundh(x: f16) callconv(.c) f16 { |
| ... | ... | @@ -44,7 +45,7 @@ pub fn roundf(x_: f32) callconv(.c) f32 { |
| 44 | 45 | x = -x; |
| 45 | 46 | } |
| 46 | 47 | if (e < 0x7F - 1) { |
| 47 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f32_toint); | |
| 48 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f32_toint); | |
| 48 | 49 | return 0 * @as(f32, @bitCast(u)); |
| 49 | 50 | } |
| 50 | 51 | |
| ... | ... | @@ -79,7 +80,7 @@ pub fn round(x_: f64) callconv(.c) f64 { |
| 79 | 80 | x = -x; |
| 80 | 81 | } |
| 81 | 82 | if (e < 0x3ff - 1) { |
| 82 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f64_toint); | |
| 83 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f64_toint); | |
| 83 | 84 | return 0 * @as(f64, @bitCast(u)); |
| 84 | 85 | } |
| 85 | 86 | |
| ... | ... | @@ -119,7 +120,7 @@ pub fn roundq(x_: f128) callconv(.c) f128 { |
| 119 | 120 | x = -x; |
| 120 | 121 | } |
| 121 | 122 | if (e < 0x3FFF - 1) { |
| 122 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f128_toint); | |
| 123 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f128_toint); | |
| 123 | 124 | return 0 * @as(f128, @bitCast(u)); |
| 124 | 125 | } |
| 125 | 126 |
lib/compiler_rt/shift.zig+20-19| ... | ... | @@ -1,33 +1,34 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const Log2Int = std.math.Log2Int; |
| 4 | const common = @import("common.zig"); | |
| 4 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 5 | const symbol = compiler_rt.symbol; | |
| 5 | 6 | |
| 6 | 7 | comptime { |
| 7 | 8 | // symbol compatibility with libgcc |
| 8 | @export(&__ashlsi3, .{ .name = "__ashlsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | @export(&__ashrsi3, .{ .name = "__ashrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 10 | @export(&__lshrsi3, .{ .name = "__lshrsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | ||
| 12 | @export(&__ashlti3, .{ .name = "__ashlti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__ashrti3, .{ .name = "__ashrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&__lshrti3, .{ .name = "__lshrti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | ||
| 16 | if (common.want_aeabi) { | |
| 17 | @export(&__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | @export(&__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__ashlsi3, "__ashlsi3"); | |
| 10 | symbol(&__ashrsi3, "__ashrsi3"); | |
| 11 | symbol(&__lshrsi3, "__lshrsi3"); | |
| 12 | ||
| 13 | symbol(&__ashlti3, "__ashlti3"); | |
| 14 | symbol(&__ashrti3, "__ashrti3"); | |
| 15 | symbol(&__lshrti3, "__lshrti3"); | |
| 16 | ||
| 17 | if (compiler_rt.want_aeabi) { | |
| 18 | symbol(&__aeabi_llsl, "__aeabi_llsl"); | |
| 19 | symbol(&__aeabi_lasr, "__aeabi_lasr"); | |
| 20 | symbol(&__aeabi_llsr, "__aeabi_llsr"); | |
| 20 | 21 | } else { |
| 21 | @export(&__ashldi3, .{ .name = "__ashldi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | @export(&__ashrdi3, .{ .name = "__ashrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 23 | @export(&__lshrdi3, .{ .name = "__lshrdi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 22 | symbol(&__ashldi3, "__ashldi3"); | |
| 23 | symbol(&__ashrdi3, "__ashrdi3"); | |
| 24 | symbol(&__lshrdi3, "__lshrdi3"); | |
| 24 | 25 | } |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | 28 | // Arithmetic shift left: shift in 0 from right to left |
| 28 | 29 | // Precondition: 0 <= b < bits_in_dword |
| 29 | 30 | inline fn ashlXi3(comptime T: type, a: T, b: i32) T { |
| 30 | const word_t = common.HalveInt(T, false); | |
| 31 | const word_t = compiler_rt.HalveInt(T, false); | |
| 31 | 32 | |
| 32 | 33 | const input = word_t{ .all = a }; |
| 33 | 34 | var output: word_t = undefined; |
| ... | ... | @@ -49,7 +50,7 @@ inline fn ashlXi3(comptime T: type, a: T, b: i32) T { |
| 49 | 50 | // Arithmetic shift right: shift in 1 from left to right |
| 50 | 51 | // Precondition: 0 <= b < T.bit_count |
| 51 | 52 | inline fn ashrXi3(comptime T: type, a: T, b: i32) T { |
| 52 | const word_t = common.HalveInt(T, true); | |
| 53 | const word_t = compiler_rt.HalveInt(T, true); | |
| 53 | 54 | |
| 54 | 55 | const input = word_t{ .all = a }; |
| 55 | 56 | var output: word_t = undefined; |
| ... | ... | @@ -72,7 +73,7 @@ inline fn ashrXi3(comptime T: type, a: T, b: i32) T { |
| 72 | 73 | // Logical shift right: shift in 0 from left to right |
| 73 | 74 | // Precondition: 0 <= b < T.bit_count |
| 74 | 75 | inline fn lshrXi3(comptime T: type, a: T, b: i32) T { |
| 75 | const word_t = common.HalveInt(T, false); | |
| 76 | const word_t = compiler_rt.HalveInt(T, false); | |
| 76 | 77 | |
| 77 | 78 | const input = word_t{ .all = a }; |
| 78 | 79 | var output: word_t = undefined; |
lib/compiler_rt/sin.zig+4-4| ... | ... | @@ -9,7 +9,7 @@ const math = std.math; |
| 9 | 9 | const mem = std.mem; |
| 10 | 10 | const expect = std.testing.expect; |
| 11 | 11 | |
| 12 | const common = @import("common.zig"); | |
| 12 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 13 | 13 | const symbol = @import("../compiler_rt.zig").symbol; |
| 14 | 14 | const trig = @import("trig.zig"); |
| 15 | 15 | const rem_pio2 = @import("rem_pio2.zig").rem_pio2; |
| ... | ... | @@ -20,7 +20,7 @@ comptime { |
| 20 | 20 | symbol(&sinf, "sinf"); |
| 21 | 21 | symbol(&sin, "sin"); |
| 22 | 22 | symbol(&__sinx, "__sinx"); |
| 23 | if (common.want_ppc_abi) { | |
| 23 | if (compiler_rt.want_ppc_abi) { | |
| 24 | 24 | symbol(&sinq, "sinf128"); |
| 25 | 25 | } |
| 26 | 26 | symbol(&sinq, "sinq"); |
| ... | ... | @@ -46,7 +46,7 @@ pub fn sinf(x: f32) callconv(.c) f32 { |
| 46 | 46 | if (ix <= 0x3f490fda) { // |x| ~<= pi/4 |
| 47 | 47 | if (ix < 0x39800000) { // |x| < 2**-12 |
| 48 | 48 | // raise inexact if x!=0 and underflow if subnormal |
| 49 | if (common.want_float_exceptions) { | |
| 49 | if (compiler_rt.want_float_exceptions) { | |
| 50 | 50 | if (ix < 0x00800000) { |
| 51 | 51 | mem.doNotOptimizeAway(x / 0x1p120); |
| 52 | 52 | } else { |
| ... | ... | @@ -101,7 +101,7 @@ pub fn sin(x: f64) callconv(.c) f64 { |
| 101 | 101 | if (ix <= 0x3fe921fb) { |
| 102 | 102 | if (ix < 0x3e500000) { // |x| < 2**-26 |
| 103 | 103 | // raise inexact if x != 0 and underflow if subnormal |
| 104 | if (common.want_float_exceptions) { | |
| 104 | if (compiler_rt.want_float_exceptions) { | |
| 105 | 105 | if (ix < 0x00100000) { |
| 106 | 106 | mem.doNotOptimizeAway(x / 0x1p120); |
| 107 | 107 | } else { |
lib/compiler_rt/sincos.zig+13-12| ... | ... | @@ -6,18 +6,19 @@ const mem = std.mem; |
| 6 | 6 | const trig = @import("trig.zig"); |
| 7 | 7 | const rem_pio2 = @import("rem_pio2.zig").rem_pio2; |
| 8 | 8 | const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f; |
| 9 | const common = @import("common.zig"); | |
| 9 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 10 | const symbol = compiler_rt.symbol; | |
| 10 | 11 | |
| 11 | 12 | comptime { |
| 12 | @export(&__sincosh, .{ .name = "__sincosh", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&sincosf, .{ .name = "sincosf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&sincos, .{ .name = "sincos", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&__sincosx, .{ .name = "__sincosx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | if (common.want_ppc_abi) { | |
| 17 | @export(&sincosq, .{ .name = "sincosf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&__sincosh, "__sincosh"); | |
| 14 | symbol(&sincosf, "sincosf"); | |
| 15 | symbol(&sincos, "sincos"); | |
| 16 | symbol(&__sincosx, "__sincosx"); | |
| 17 | if (compiler_rt.want_ppc_abi) { | |
| 18 | symbol(&sincosq, "sincosf128"); | |
| 18 | 19 | } |
| 19 | @export(&sincosq, .{ .name = "sincosq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | @export(&sincosl, .{ .name = "sincosl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 20 | symbol(&sincosq, "sincosq"); | |
| 21 | symbol(&sincosl, "sincosl"); | |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | pub fn __sincosh(x: f16, r_sin: *f16, r_cos: *f16) callconv(.c) void { |
| ... | ... | @@ -44,7 +45,7 @@ pub fn sincosf(x: f32, r_sin: *f32, r_cos: *f32) callconv(.c) void { |
| 44 | 45 | // |x| < 2**-12 |
| 45 | 46 | if (ix < 0x39800000) { |
| 46 | 47 | // raise inexact if x!=0 and underflow if subnormal |
| 47 | if (common.want_float_exceptions) { | |
| 48 | if (compiler_rt.want_float_exceptions) { | |
| 48 | 49 | if (ix < 0x00100000) { |
| 49 | 50 | mem.doNotOptimizeAway(x / 0x1p120); |
| 50 | 51 | } else { |
| ... | ... | @@ -138,7 +139,7 @@ pub fn sincos(x: f64, r_sin: *f64, r_cos: *f64) callconv(.c) void { |
| 138 | 139 | // if |x| < 2**-27 * sqrt(2) |
| 139 | 140 | if (ix < 0x3e46a09e) { |
| 140 | 141 | // raise inexact if x != 0 and underflow if subnormal |
| 141 | if (common.want_float_exceptions) { | |
| 142 | if (compiler_rt.want_float_exceptions) { | |
| 142 | 143 | if (ix < 0x00100000) { |
| 143 | 144 | mem.doNotOptimizeAway(x / 0x1p120); |
| 144 | 145 | } else { |
| ... | ... | @@ -242,7 +243,7 @@ inline fn sincos_generic(comptime F: type, x: F, r_sin: *F, r_cos: *F) void { |
| 242 | 243 | if (se < 0x3fff - math.floatFractionalBits(F) - 1) { |
| 243 | 244 | // raise underflow if subnormal |
| 244 | 245 | if (se == 0) { |
| 245 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x * 0x1p-120); | |
| 246 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x * 0x1p-120); | |
| 246 | 247 | } |
| 247 | 248 | r_sin.* = x; |
| 248 | 249 | // raise inexact if x!=0 |
lib/compiler_rt/sqrt.zig+15-14| ... | ... | @@ -9,20 +9,21 @@ const std = @import("std"); |
| 9 | 9 | const builtin = @import("builtin"); |
| 10 | 10 | const arch = builtin.cpu.arch; |
| 11 | 11 | const math = std.math; |
| 12 | const common = @import("common.zig"); | |
| 12 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 13 | const symbol = compiler_rt.symbol; | |
| 13 | 14 | |
| 14 | 15 | comptime { |
| 15 | @export(&__sqrth, .{ .name = "__sqrth", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&sqrtf, .{ .name = "sqrtf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&sqrt, .{ .name = "sqrt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 18 | @export(&__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage, .visibility = common.visibility }); | |
| 19 | if (common.want_ppc_abi) { | |
| 20 | @export(&sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | } else if (common.want_sparc_abi) { | |
| 22 | @export(&_Qp_sqrt, .{ .name = "_Qp_sqrt", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | symbol(&__sqrth, "__sqrth"); | |
| 17 | symbol(&sqrtf, "sqrtf"); | |
| 18 | symbol(&sqrt, "sqrt"); | |
| 19 | symbol(&__sqrtx, "__sqrtx"); | |
| 20 | if (compiler_rt.want_ppc_abi) { | |
| 21 | symbol(&sqrtq, "sqrtf128"); | |
| 22 | } else if (compiler_rt.want_sparc_abi) { | |
| 23 | symbol(&_Qp_sqrt, "_Qp_sqrt"); | |
| 23 | 24 | } |
| 24 | @export(&sqrtq, .{ .name = "sqrtq", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&sqrtl, .{ .name = "sqrtl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | symbol(&sqrtq, "sqrtq"); | |
| 26 | symbol(&sqrtl, "sqrtl"); | |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | pub fn __sqrth(x: f16) callconv(.c) f16 { |
| ... | ... | @@ -103,7 +104,7 @@ pub fn sqrtf(x: f32) callconv(.c) f32 { |
| 103 | 104 | return x; |
| 104 | 105 | |
| 105 | 106 | if (ix > @as(u32, @bitCast(std.math.inf(f32)))) |
| 106 | return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f32); | |
| 107 | return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f32); | |
| 107 | 108 | |
| 108 | 109 | ix = @as(u32, @bitCast(@as(i32, @bitCast(x * 0x1p23)) - (23 << 23))); |
| 109 | 110 | } |
| ... | ... | @@ -154,7 +155,7 @@ pub fn sqrt(x: f64) callconv(.c) f64 { |
| 154 | 155 | // x < 0x1p-1022 or inf or nan. |
| 155 | 156 | if (ix & 0x7FFF_FFFF_FFFF_FFFF == 0) return x; |
| 156 | 157 | if (ix == 0x7FF0_0000_0000_0000) return x; |
| 157 | if (ix > 0x7FF0_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 158 | if (ix > 0x7FF0_0000_0000_0000) return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64); | |
| 158 | 159 | // x is subnormal, normalize it. |
| 159 | 160 | ix = @bitCast(x * 0x1p52); |
| 160 | 161 | top = (ix >> 52) -% 52; |
| ... | ... | @@ -291,7 +292,7 @@ pub fn __sqrtx(x: f80) callconv(.c) f80 { |
| 291 | 292 | // x < 0x1p-16382 or inf or nan. |
| 292 | 293 | if (ix & 0x7FFF_FFFF_FFFF_FFFF_FFFF == 0) return x; |
| 293 | 294 | if (ix == 0x7FFF_8000_0000_0000_0000) return x; |
| 294 | if (ix > 0x7FFF_8000_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f80); | |
| 295 | if (ix > 0x7FFF_8000_0000_0000_0000) return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f80); | |
| 295 | 296 | // x is subnormal, normalize it. |
| 296 | 297 | ix = @bitCast(x * 0x1p63); |
| 297 | 298 | top = (ix >> 64) -% 63; |
lib/compiler_rt/ssp.zig+12-11| ... | ... | @@ -13,7 +13,8 @@ |
| 13 | 13 | //! - __vsprintf_chk |
| 14 | 14 | |
| 15 | 15 | const std = @import("std"); |
| 16 | const common = @import("./common.zig"); | |
| 16 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 17 | const symbol = compiler_rt.symbol; | |
| 17 | 18 | const builtin = @import("builtin"); |
| 18 | 19 | |
| 19 | 20 | extern fn memset(dest: ?[*]u8, c: u8, n: usize) callconv(.c) ?[*]u8; |
| ... | ... | @@ -21,16 +22,16 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call |
| 21 | 22 | extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.c) ?[*]u8; |
| 22 | 23 | |
| 23 | 24 | comptime { |
| 24 | @export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__chk_fail, .{ .name = "__chk_fail", .linkage = common.linkage, .visibility = common.visibility }); | |
| 26 | @export(&__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = common.linkage, .visibility = common.visibility }); | |
| 27 | @export(&__strcpy_chk, .{ .name = "__strcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 28 | @export(&__strncpy_chk, .{ .name = "__strncpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 29 | @export(&__strcat_chk, .{ .name = "__strcat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | @export(&__strncat_chk, .{ .name = "__strncat_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 31 | @export(&__memcpy_chk, .{ .name = "__memcpy_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 32 | @export(&__memmove_chk, .{ .name = "__memmove_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 33 | @export(&__memset_chk, .{ .name = "__memset_chk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 25 | @export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = compiler_rt.linkage, .visibility = compiler_rt.visibility }); | |
| 26 | symbol(&__chk_fail, "__chk_fail"); | |
| 27 | symbol(&__stack_chk_guard, "__stack_chk_guard"); | |
| 28 | symbol(&__strcpy_chk, "__strcpy_chk"); | |
| 29 | symbol(&__strncpy_chk, "__strncpy_chk"); | |
| 30 | symbol(&__strcat_chk, "__strcat_chk"); | |
| 31 | symbol(&__strncat_chk, "__strncat_chk"); | |
| 32 | symbol(&__memcpy_chk, "__memcpy_chk"); | |
| 33 | symbol(&__memmove_chk, "__memmove_chk"); | |
| 34 | symbol(&__memset_chk, "__memset_chk"); | |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | fn __stack_chk_fail() callconv(.c) noreturn { |
lib/compiler_rt/stack_probe.zig+11-10| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const common = @import("common.zig"); | |
| 3 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 4 | const symbol = compiler_rt.symbol; | |
| 4 | 5 | const os_tag = builtin.os.tag; |
| 5 | 6 | const arch = builtin.cpu.arch; |
| 6 | 7 | const abi = builtin.abi; |
| ... | ... | @@ -9,16 +10,16 @@ comptime { |
| 9 | 10 | if (builtin.os.tag == .windows) { |
| 10 | 11 | // Default stack-probe functions emitted by LLVM |
| 11 | 12 | if (builtin.target.isMinGW()) { |
| 12 | @export(&_chkstk, .{ .name = "_alloca", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | @export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 14 | @export(&___chkstk, .{ .name = "__alloca", .linkage = common.linkage, .visibility = common.visibility }); | |
| 15 | @export(&___chkstk, .{ .name = "___chkstk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 16 | @export(&__chkstk_ms, .{ .name = "__chkstk_ms", .linkage = common.linkage, .visibility = common.visibility }); | |
| 17 | @export(&___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = common.linkage, .visibility = common.visibility }); | |
| 13 | symbol(&_chkstk, "_alloca"); | |
| 14 | symbol(&__chkstk, "__chkstk"); | |
| 15 | symbol(&___chkstk, "__alloca"); | |
| 16 | symbol(&___chkstk, "___chkstk"); | |
| 17 | symbol(&__chkstk_ms, "__chkstk_ms"); | |
| 18 | symbol(&___chkstk_ms, "___chkstk_ms"); | |
| 18 | 19 | } else if (!builtin.link_libc) { |
| 19 | 20 | // This symbols are otherwise exported by MSVCRT.lib |
| 20 | @export(&_chkstk, .{ .name = "_chkstk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | @export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility }); | |
| 21 | symbol(&_chkstk, "_chkstk"); | |
| 22 | symbol(&__chkstk, "__chkstk"); | |
| 22 | 23 | } |
| 23 | 24 | } |
| 24 | 25 | |
| ... | ... | @@ -26,7 +27,7 @@ comptime { |
| 26 | 27 | .x86, |
| 27 | 28 | .x86_64, |
| 28 | 29 | => { |
| 29 | @export(&zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = common.linkage, .visibility = common.visibility }); | |
| 30 | symbol(&zig_probe_stack, "__zig_probe_stack"); | |
| 30 | 31 | }, |
| 31 | 32 | else => {}, |
| 32 | 33 | } |
lib/compiler_rt/subdf3.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_dsub, "__aeabi_dsub"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__subdf3, "__subdf3"); |
lib/compiler_rt/subhf3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__subhf3, .{ .name = "__subhf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__subhf3, "__subhf3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | fn __subhf3(a: f16, b: f16) callconv(.c) f16 { |
lib/compiler_rt/subsf3.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_fsub, "__aeabi_fsub"); | |
| 7 | 8 | } else { |
| 8 | @export(&__subsf3, .{ .name = "__subsf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__subsf3, "__subsf3"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/subtf3.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const addf3 = @import("./addf3.zig").addf3; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__subtf3, .{ .name = "__subkf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__subtf3, "__subkf3"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_sub, "_Qp_sub"); | |
| 9 | 10 | } |
| 10 | @export(&__subtf3, .{ .name = "__subtf3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__subtf3, "__subtf3"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __subtf3(a: f128, b: f128) callconv(.c) f128 { |
lib/compiler_rt/subvsi3.zig+3-2| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const testing = @import("std").testing; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | @export(&__subvsi3, .{ .name = "__subvsi3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | symbol(&__subvsi3, "__subvsi3"); | |
| 6 | 7 | } |
| 7 | 8 | |
| 8 | 9 | pub fn __subvsi3(a: i32, b: i32) callconv(.c) i32 { |
lib/compiler_rt/tan.zig+4-4| ... | ... | @@ -16,7 +16,7 @@ const rem_pio2 = @import("rem_pio2.zig").rem_pio2; |
| 16 | 16 | const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f; |
| 17 | 17 | |
| 18 | 18 | const arch = builtin.cpu.arch; |
| 19 | const common = @import("common.zig"); | |
| 19 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 20 | 20 | const symbol = @import("../compiler_rt.zig").symbol; |
| 21 | 21 | |
| 22 | 22 | comptime { |
| ... | ... | @@ -24,7 +24,7 @@ comptime { |
| 24 | 24 | symbol(&tanf, "tanf"); |
| 25 | 25 | symbol(&tan, "tan"); |
| 26 | 26 | symbol(&__tanx, "__tanx"); |
| 27 | if (common.want_ppc_abi) { | |
| 27 | if (compiler_rt.want_ppc_abi) { | |
| 28 | 28 | symbol(&tanq, "tanf128"); |
| 29 | 29 | } |
| 30 | 30 | symbol(&tanq, "tanq"); |
| ... | ... | @@ -50,7 +50,7 @@ pub fn tanf(x: f32) callconv(.c) f32 { |
| 50 | 50 | if (ix <= 0x3f490fda) { // |x| ~<= pi/4 |
| 51 | 51 | if (ix < 0x39800000) { // |x| < 2**-12 |
| 52 | 52 | // raise inexact if x!=0 and underflow if subnormal |
| 53 | if (common.want_float_exceptions) { | |
| 53 | if (compiler_rt.want_float_exceptions) { | |
| 54 | 54 | if (ix < 0x00800000) { |
| 55 | 55 | mem.doNotOptimizeAway(x / 0x1p120); |
| 56 | 56 | } else { |
| ... | ... | @@ -94,7 +94,7 @@ pub fn tan(x: f64) callconv(.c) f64 { |
| 94 | 94 | if (ix <= 0x3fe921fb) { |
| 95 | 95 | if (ix < 0x3e400000) { // |x| < 2**-27 |
| 96 | 96 | // raise inexact if x!=0 and underflow if subnormal |
| 97 | if (common.want_float_exceptions) { | |
| 97 | if (compiler_rt.want_float_exceptions) { | |
| 98 | 98 | if (ix < 0x00100000) { |
| 99 | 99 | mem.doNotOptimizeAway(x / 0x1p120); |
| 100 | 100 | } else { |
lib/compiler_rt/trunc.zig+6-9| ... | ... | @@ -4,23 +4,20 @@ |
| 4 | 4 | //! https://git.musl-libc.org/cgit/musl/tree/src/math/truncf.c |
| 5 | 5 | //! https://git.musl-libc.org/cgit/musl/tree/src/math/trunc.c |
| 6 | 6 | |
| 7 | const builtin = @import("builtin"); | |
| 8 | const arch = builtin.cpu.arch; | |
| 9 | ||
| 10 | 7 | const std = @import("std"); |
| 11 | 8 | const math = std.math; |
| 12 | 9 | const mem = std.mem; |
| 13 | 10 | const expect = std.testing.expect; |
| 14 | 11 | |
| 15 | const common = @import("common.zig"); | |
| 16 | const symbol = @import("../compiler_rt.zig").symbol; | |
| 12 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 13 | const symbol = compiler_rt.symbol; | |
| 17 | 14 | |
| 18 | 15 | comptime { |
| 19 | 16 | symbol(&__trunch, "__trunch"); |
| 20 | 17 | symbol(&truncf, "truncf"); |
| 21 | 18 | symbol(&trunc, "trunc"); |
| 22 | 19 | symbol(&__truncx, "__truncx"); |
| 23 | if (common.want_ppc_abi) { | |
| 20 | if (compiler_rt.want_ppc_abi) { | |
| 24 | 21 | symbol(&truncq, "truncf128"); |
| 25 | 22 | } |
| 26 | 23 | symbol(&truncq, "truncq"); |
| ... | ... | @@ -48,7 +45,7 @@ pub fn truncf(x: f32) callconv(.c) f32 { |
| 48 | 45 | if (u & m == 0) { |
| 49 | 46 | return x; |
| 50 | 47 | } else { |
| 51 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 48 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 52 | 49 | return @bitCast(u & ~m); |
| 53 | 50 | } |
| 54 | 51 | } |
| ... | ... | @@ -69,7 +66,7 @@ pub fn trunc(x: f64) callconv(.c) f64 { |
| 69 | 66 | if (u & m == 0) { |
| 70 | 67 | return x; |
| 71 | 68 | } else { |
| 72 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 69 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 73 | 70 | return @bitCast(u & ~m); |
| 74 | 71 | } |
| 75 | 72 | } |
| ... | ... | @@ -95,7 +92,7 @@ pub fn truncq(x: f128) callconv(.c) f128 { |
| 95 | 92 | if (u & m == 0) { |
| 96 | 93 | return x; |
| 97 | 94 | } else { |
| 98 | if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 95 | if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120); | |
| 99 | 96 | return @bitCast(u & ~m); |
| 100 | 97 | } |
| 101 | 98 | } |
lib/compiler_rt/truncdfhf2.zig+3-3| ... | ... | @@ -1,15 +1,15 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const truncf = @import("./truncf.zig").truncf; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_d2h, "__aeabi_d2h"); |
| 8 | 8 | } |
| 9 | 9 | symbol(&__truncdfhf2, "__truncdfhf2"); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | pub fn __truncdfhf2(a: f64) callconv(.c) common.F16T(f64) { | |
| 12 | pub fn __truncdfhf2(a: f64) callconv(.c) compiler_rt.F16T(f64) { | |
| 13 | 13 | return @bitCast(truncf(f16, f64, a)); |
| 14 | 14 | } |
| 15 | 15 |
lib/compiler_rt/truncdfsf2.zig+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const truncf = @import("./truncf.zig").truncf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | symbol(&__aeabi_d2f, "__aeabi_d2f"); | |
| 7 | 8 | } else { |
| 8 | @export(&__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | symbol(&__truncdfsf2, "__truncdfsf2"); | |
| 9 | 10 | } |
| 10 | 11 | } |
| 11 | 12 |
lib/compiler_rt/truncsfhf2.zig+9-8| ... | ... | @@ -1,20 +1,21 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const truncf = @import("./truncf.zig").truncf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.gnu_f16_abi) { | |
| 6 | @export(&__gnu_f2h_ieee, .{ .name = "__gnu_f2h_ieee", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_aeabi) { | |
| 8 | @export(&__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.gnu_f16_abi) { | |
| 7 | symbol(&__gnu_f2h_ieee, "__gnu_f2h_ieee"); | |
| 8 | } else if (compiler_rt.want_aeabi) { | |
| 9 | symbol(&__aeabi_f2h, "__aeabi_f2h"); | |
| 9 | 10 | } |
| 10 | @export(&__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__truncsfhf2, "__truncsfhf2"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | pub fn __truncsfhf2(a: f32) callconv(.c) common.F16T(f32) { | |
| 14 | pub fn __truncsfhf2(a: f32) callconv(.c) compiler_rt.F16T(f32) { | |
| 14 | 15 | return @bitCast(truncf(f16, f32, a)); |
| 15 | 16 | } |
| 16 | 17 | |
| 17 | fn __gnu_f2h_ieee(a: f32) callconv(.c) common.F16T(f32) { | |
| 18 | fn __gnu_f2h_ieee(a: f32) callconv(.c) compiler_rt.F16T(f32) { | |
| 18 | 19 | return @bitCast(truncf(f16, f32, a)); |
| 19 | 20 | } |
| 20 | 21 |
lib/compiler_rt/trunctfdf2.zig+7-6| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | const symbol = compiler_rt.symbol; | |
| 2 | 3 | const truncf = @import("./truncf.zig").truncf; |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | @export(&_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | symbol(&__trunctfdf2, "__trunckfdf2"); | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | symbol(&_Qp_qtod, "_Qp_qtod"); | |
| 9 | 10 | } |
| 10 | @export(&__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | symbol(&__trunctfdf2, "__trunctfdf2"); | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | pub fn __trunctfdf2(a: f128) callconv(.c) f64 { |
lib/compiler_rt/trunctfhf2.zig+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const truncf = @import("./truncf.zig").truncf; |
| 4 | 4 | |
| ... | ... | @@ -6,6 +6,6 @@ comptime { |
| 6 | 6 | symbol(&__trunctfhf2, "__trunctfhf2"); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | pub fn __trunctfhf2(a: f128) callconv(.c) common.F16T(f128) { | |
| 9 | pub fn __trunctfhf2(a: f128) callconv(.c) compiler_rt.F16T(f128) { | |
| 10 | 10 | return @bitCast(truncf(f16, f128, a)); |
| 11 | 11 | } |
lib/compiler_rt/trunctfsf2.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const truncf = @import("./truncf.zig").truncf; |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_ppc_abi) { | |
| 6 | if (compiler_rt.want_ppc_abi) { | |
| 7 | 7 | symbol(&__trunctfsf2, "__trunckfsf2"); |
| 8 | } else if (common.want_sparc_abi) { | |
| 8 | } else if (compiler_rt.want_sparc_abi) { | |
| 9 | 9 | symbol(&_Qp_qtos, "_Qp_qtos"); |
| 10 | 10 | } |
| 11 | 11 | symbol(&__trunctfsf2, "__trunctfsf2"); |
lib/compiler_rt/trunctfxf2.zig+3-2| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | 1 | const math = @import("std").math; |
| 2 | const common = @import("./common.zig"); | |
| 2 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 3 | const symbol = compiler_rt.symbol; | |
| 3 | 4 | const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 4 | 5 | |
| 5 | 6 | comptime { |
| 6 | @export(&__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | symbol(&__trunctfxf2, "__trunctfxf2"); | |
| 7 | 8 | } |
| 8 | 9 | |
| 9 | 10 | pub fn __trunctfxf2(a: f128) callconv(.c) f80 { |
lib/compiler_rt/truncxfhf2.zig+2-2| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const symbol = @import("../compiler_rt.zig").symbol; |
| 3 | 3 | const trunc_f80 = @import("./truncf.zig").trunc_f80; |
| 4 | 4 | |
| ... | ... | @@ -6,6 +6,6 @@ comptime { |
| 6 | 6 | symbol(&__truncxfhf2, "__truncxfhf2"); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | fn __truncxfhf2(a: f80) callconv(.c) common.F16T(f80) { | |
| 9 | fn __truncxfhf2(a: f80) callconv(.c) compiler_rt.F16T(f80) { | |
| 10 | 10 | return @bitCast(trunc_f80(f16, a)); |
| 11 | 11 | } |
lib/compiler_rt/udivmod.zig+102-6| ... | ... | @@ -1,8 +1,98 @@ |
| 1 | const std = @import("std"); | |
| 2 | 1 | const builtin = @import("builtin"); |
| 2 | ||
| 3 | const std = @import("std"); | |
| 3 | 4 | const Log2Int = std.math.Log2Int; |
| 4 | const common = @import("common.zig"); | |
| 5 | const HalveInt = common.HalveInt; | |
| 5 | ||
| 6 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 7 | const symbol = compiler_rt.symbol; | |
| 8 | const HalveInt = compiler_rt.HalveInt; | |
| 9 | ||
| 10 | comptime { | |
| 11 | if (compiler_rt.want_windows_v2u64_abi) { | |
| 12 | symbol(&__umodti3_windows_x86_64, "__umodti3"); | |
| 13 | symbol(&__modti3_windows_x86_64, "__modti3"); | |
| 14 | symbol(&__udivti3_windows_x86_64, "__udivti3"); | |
| 15 | symbol(&__divti3_windows_x86_64, "__divti3"); | |
| 16 | symbol(&__udivmodti4_windows_x86_64, "__udivmodti4"); | |
| 17 | } else { | |
| 18 | symbol(&__umodti3, "__umodti3"); | |
| 19 | symbol(&__modti3, "__modti3"); | |
| 20 | symbol(&__udivti3, "__udivti3"); | |
| 21 | symbol(&__divti3, "__divti3"); | |
| 22 | symbol(&__udivmodti4, "__udivmodti4"); | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | const v128 = @Vector(2, u64); | |
| 27 | const v2u64 = @Vector(2, u64); | |
| 28 | ||
| 29 | pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.c) u128 { | |
| 30 | return udivmod(u128, a, b, maybe_rem); | |
| 31 | } | |
| 32 | ||
| 33 | fn __udivmodti4_windows_x86_64(a: v2u64, b: v2u64, maybe_rem: ?*u128) callconv(.c) v2u64 { | |
| 34 | return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), maybe_rem)); | |
| 35 | } | |
| 36 | ||
| 37 | pub fn __divti3(a: i128, b: i128) callconv(.c) i128 { | |
| 38 | return div(a, b); | |
| 39 | } | |
| 40 | ||
| 41 | fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.c) v128 { | |
| 42 | return @bitCast(div(@bitCast(a), @bitCast(b))); | |
| 43 | } | |
| 44 | ||
| 45 | inline fn div(a: i128, b: i128) i128 { | |
| 46 | const s_a = a >> (128 - 1); | |
| 47 | const s_b = b >> (128 - 1); | |
| 48 | ||
| 49 | const an = (a ^ s_a) -% s_a; | |
| 50 | const bn = (b ^ s_b) -% s_b; | |
| 51 | ||
| 52 | const r = udivmod(u128, @bitCast(an), @bitCast(bn), null); | |
| 53 | const s = s_a ^ s_b; | |
| 54 | return (@as(i128, @bitCast(r)) ^ s) -% s; | |
| 55 | } | |
| 56 | ||
| 57 | pub fn __udivti3(a: u128, b: u128) callconv(.c) u128 { | |
| 58 | return udivmod(u128, a, b, null); | |
| 59 | } | |
| 60 | ||
| 61 | fn __udivti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 62 | return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), null)); | |
| 63 | } | |
| 64 | ||
| 65 | pub fn __modti3(a: i128, b: i128) callconv(.c) i128 { | |
| 66 | return mod(a, b); | |
| 67 | } | |
| 68 | ||
| 69 | fn __modti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 70 | return @bitCast(mod(@as(i128, @bitCast(a)), @as(i128, @bitCast(b)))); | |
| 71 | } | |
| 72 | ||
| 73 | inline fn mod(a: i128, b: i128) i128 { | |
| 74 | const s_a = a >> (128 - 1); // s = a < 0 ? -1 : 0 | |
| 75 | const s_b = b >> (128 - 1); // s = b < 0 ? -1 : 0 | |
| 76 | ||
| 77 | const an = (a ^ s_a) -% s_a; // negate if s == -1 | |
| 78 | const bn = (b ^ s_b) -% s_b; // negate if s == -1 | |
| 79 | ||
| 80 | var r: u128 = undefined; | |
| 81 | _ = udivmod(u128, @as(u128, @bitCast(an)), @as(u128, @bitCast(bn)), &r); | |
| 82 | return (@as(i128, @bitCast(r)) ^ s_a) -% s_a; // negate if s == -1 | |
| 83 | } | |
| 84 | ||
| 85 | pub fn __umodti3(a: u128, b: u128) callconv(.c) u128 { | |
| 86 | var r: u128 = undefined; | |
| 87 | _ = udivmod(u128, a, b, &r); | |
| 88 | return r; | |
| 89 | } | |
| 90 | ||
| 91 | fn __umodti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 92 | var r: u128 = undefined; | |
| 93 | _ = udivmod(u128, @bitCast(a), @bitCast(b), &r); | |
| 94 | return @bitCast(r); | |
| 95 | } | |
| 6 | 96 | |
| 7 | 97 | const lo = switch (builtin.cpu.arch.endian()) { |
| 8 | 98 | .big => 1, |
| ... | ... | @@ -14,7 +104,7 @@ const hi = 1 - lo; |
| 14 | 104 | // Returns U / v_ and sets r = U % v_. |
| 15 | 105 | fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T { |
| 16 | 106 | const HalfT = HalveInt(T, false).HalfT; |
| 17 | @setRuntimeSafety(common.test_safety); | |
| 107 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 18 | 108 | var v = v_; |
| 19 | 109 | |
| 20 | 110 | const b = @as(T, 1) << (@bitSizeOf(T) / 2); |
| ... | ... | @@ -70,7 +160,7 @@ fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T { |
| 70 | 160 | } |
| 71 | 161 | |
| 72 | 162 | fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T { |
| 73 | @setRuntimeSafety(common.test_safety); | |
| 163 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 74 | 164 | if (T == u64 and builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag != .windows) { |
| 75 | 165 | var rem: T = undefined; |
| 76 | 166 | const quo = asm ( |
| ... | ... | @@ -90,7 +180,7 @@ fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T { |
| 90 | 180 | |
| 91 | 181 | // Returns a_ / b_ and sets maybe_rem = a_ % b. |
| 92 | 182 | pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T { |
| 93 | @setRuntimeSafety(common.test_safety); | |
| 183 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 94 | 184 | const HalfT = HalveInt(T, false).HalfT; |
| 95 | 185 | const SignedT = std.meta.Int(.signed, @bitSizeOf(T)); |
| 96 | 186 | |
| ... | ... | @@ -147,3 +237,9 @@ pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T { |
| 147 | 237 | } |
| 148 | 238 | return @bitCast(q); |
| 149 | 239 | } |
| 240 | ||
| 241 | test { | |
| 242 | _ = @import("modti3_test.zig"); | |
| 243 | _ = @import("divti3_test.zig"); | |
| 244 | _ = @import("udivmodti4_test.zig"); | |
| 245 | } |
lib/compiler_rt/udivmodei4.zig+3-3| ... | ... | @@ -5,7 +5,7 @@ const std = @import("std"); |
| 5 | 5 | const shr = std.math.shr; |
| 6 | 6 | const shl = std.math.shl; |
| 7 | 7 | |
| 8 | const common = @import("common.zig"); | |
| 8 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 9 | 9 | const symbol = @import("../compiler_rt.zig").symbol; |
| 10 | 10 | |
| 11 | 11 | const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max supported type is u65535 |
| ... | ... | @@ -115,7 +115,7 @@ pub fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32) !void { |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { |
| 118 | @setRuntimeSafety(common.test_safety); | |
| 118 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 119 | 119 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); |
| 120 | 120 | const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size])); |
| 121 | 121 | const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
| ... | ... | @@ -124,7 +124,7 @@ pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void { |
| 127 | @setRuntimeSafety(common.test_safety); | |
| 127 | @setRuntimeSafety(compiler_rt.test_safety); | |
| 128 | 128 | const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits)); |
| 129 | 129 | const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size])); |
| 130 | 130 | const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size])); |
lib/compiler_rt/udivmodti4.zig deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const udivmod = @import("udivmod.zig").udivmod; | |
| 4 | const common = @import("common.zig"); | |
| 5 | ||
| 6 | comptime { | |
| 7 | if (common.want_windows_v2u64_abi) { | |
| 8 | @export(&__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | } else { | |
| 10 | @export(&__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | } | |
| 12 | } | |
| 13 | ||
| 14 | pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.c) u128 { | |
| 15 | return udivmod(u128, a, b, maybe_rem); | |
| 16 | } | |
| 17 | ||
| 18 | const v2u64 = @Vector(2, u64); | |
| 19 | ||
| 20 | fn __udivmodti4_windows_x86_64(a: v2u64, b: v2u64, maybe_rem: ?*u128) callconv(.c) v2u64 { | |
| 21 | return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), maybe_rem)); | |
| 22 | } | |
| 23 | ||
| 24 | test { | |
| 25 | _ = @import("udivmodti4_test.zig"); | |
| 26 | } |
lib/compiler_rt/udivmodti4_test.zig+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | // Disable formatting to avoid unnecessary source repository bloat. |
| 2 | 2 | // zig fmt: off |
| 3 | const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4; | |
| 3 | const __udivmodti4 = @import("udivmod.zig").__udivmodti4; | |
| 4 | 4 | const testing = @import("std").testing; |
| 5 | 5 | |
| 6 | 6 | fn test__udivmodti4(a: u128, b: u128, expected_q: u128, expected_r: u128) !void { |
lib/compiler_rt/udivti3.zig deleted-22| ... | ... | @@ -1,22 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const udivmod = @import("udivmod.zig").udivmod; | |
| 4 | const common = @import("common.zig"); | |
| 5 | ||
| 6 | comptime { | |
| 7 | if (common.want_windows_v2u64_abi) { | |
| 8 | @export(&__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | } else { | |
| 10 | @export(&__udivti3, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | } | |
| 12 | } | |
| 13 | ||
| 14 | pub fn __udivti3(a: u128, b: u128) callconv(.c) u128 { | |
| 15 | return udivmod(u128, a, b, null); | |
| 16 | } | |
| 17 | ||
| 18 | const v2u64 = @Vector(2, u64); | |
| 19 | ||
| 20 | fn __udivti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 21 | return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), null)); | |
| 22 | } |
lib/compiler_rt/umodti3.zig deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const builtin = @import("builtin"); | |
| 3 | const udivmod = @import("udivmod.zig").udivmod; | |
| 4 | const common = @import("common.zig"); | |
| 5 | ||
| 6 | comptime { | |
| 7 | if (common.want_windows_v2u64_abi) { | |
| 8 | @export(&__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | } else { | |
| 10 | @export(&__umodti3, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility }); | |
| 11 | } | |
| 12 | } | |
| 13 | ||
| 14 | pub fn __umodti3(a: u128, b: u128) callconv(.c) u128 { | |
| 15 | var r: u128 = undefined; | |
| 16 | _ = udivmod(u128, a, b, &r); | |
| 17 | return r; | |
| 18 | } | |
| 19 | ||
| 20 | const v2u64 = @Vector(2, u64); | |
| 21 | ||
| 22 | fn __umodti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 { | |
| 23 | var r: u128 = undefined; | |
| 24 | _ = udivmod(u128, @bitCast(a), @bitCast(b), &r); | |
| 25 | return @bitCast(r); | |
| 26 | } |
lib/compiler_rt/unorddf2.zig+2-2| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | const common = @import("./common.zig"); | |
| 1 | const compiler_rt = @import("../compiler_rt.zig"); | |
| 2 | 2 | const comparef = @import("./comparef.zig"); |
| 3 | 3 | const symbol = @import("../compiler_rt.zig").symbol; |
| 4 | 4 | |
| 5 | 5 | comptime { |
| 6 | if (common.want_aeabi) { | |
| 6 | if (compiler_rt.want_aeabi) { | |
| 7 | 7 | symbol(&__aeabi_dcmpun, "__aeabi_dcmpun"); |
| 8 | 8 | } else { |
| 9 | 9 | symbol(&__unorddf2, "__unorddf2"); |
lib/compiler_rt/unordhf2.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const comparef = @import("./comparef.zig"); | |
| 3 | ||
| 4 | comptime { | |
| 5 | @export(&__unordhf2, .{ .name = "__unordhf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } | |
| 7 | ||
| 8 | pub fn __unordhf2(a: f16, b: f16) callconv(.c) i32 { | |
| 9 | return comparef.unordcmp(f16, a, b); | |
| 10 | } |
lib/compiler_rt/unordsf2.zig deleted-18| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const comparef = @import("./comparef.zig"); | |
| 3 | ||
| 4 | comptime { | |
| 5 | if (common.want_aeabi) { | |
| 6 | @export(&__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else { | |
| 8 | @export(&__unordsf2, .{ .name = "__unordsf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 9 | } | |
| 10 | } | |
| 11 | ||
| 12 | pub fn __unordsf2(a: f32, b: f32) callconv(.c) i32 { | |
| 13 | return comparef.unordcmp(f32, a, b); | |
| 14 | } | |
| 15 | ||
| 16 | fn __aeabi_fcmpun(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { | |
| 17 | return comparef.unordcmp(f32, a, b); | |
| 18 | } |
lib/compiler_rt/unordtf2.zig deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const comparef = @import("./comparef.zig"); | |
| 3 | ||
| 4 | comptime { | |
| 5 | if (common.want_ppc_abi) { | |
| 6 | @export(&__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 7 | } else if (common.want_sparc_abi) { | |
| 8 | // These exports are handled in cmptf2.zig because unordered comparisons | |
| 9 | // are based on calling _Qp_cmp. | |
| 10 | } | |
| 11 | @export(&__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 12 | } | |
| 13 | ||
| 14 | fn __unordtf2(a: f128, b: f128) callconv(.c) i32 { | |
| 15 | return comparef.unordcmp(f128, a, b); | |
| 16 | } |
lib/compiler_rt/unordxf2.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | const common = @import("./common.zig"); | |
| 2 | const comparef = @import("./comparef.zig"); | |
| 3 | ||
| 4 | comptime { | |
| 5 | @export(&__unordxf2, .{ .name = "__unordxf2", .linkage = common.linkage, .visibility = common.visibility }); | |
| 6 | } | |
| 7 | ||
| 8 | pub fn __unordxf2(a: f80, b: f80) callconv(.c) i32 { | |
| 9 | return comparef.unordcmp(f80, a, b); | |
| 10 | } |