The conversion was discarding f80's explicit leading significand bit
and using incorrect shift and sticky-bit calculations. Now we
preserve that bit and correct the rounding logic. Also ensures
f128 NaNs remain NaNs when converted to f80, even when their payload
is truncated away, rather than becoming infinity.
Add four assembly files for half-float to integer conversions using
QFloat (qf16) on Hexagon V79.
Each function provides IEEE round-to-nearest-even or fast
round-half-away-from-zero conversion for signed and unsigned 8-bit and
16-bit integer destinations.
V79 lacks direct half-float to integer conversion. V75 and below have
native IEEE vcvt instructions,
while V81 and newer have dedicated hardware support.
Co-authored-by: Sumanth Gundapaneni <sgundapa@quicinc.com>
* We need to add current_dtv_offset in __tls_get_addr() because we aren't
reading the actual DTV entry (where that value would be baked in).
* In both __tls_get_addr() and __tls_get_offset(), we need to subtract
area_info.abi_tcb.offset rather than area_info.block.size because we apply
align_factor to the block size when computing the area layout.
As with __zig_elf_auxv, we need a canonical location for __tls_get_addr (or
__tls_get_offset on s390x), and compiler-rt is the obvious place. But that also
means that moving all of std.os.linux.tls there just makes sense. I decided not
to namespace this under linux because it's expected that most of this code will
apply to the BSDs too.
The ABI that std now expects is:
extern fn __zig_elf_static_tls_init(phdrs: [*]elf.ElfN.Phdr, phnum: usize) void;
extern fn __zig_elf_static_tls_fill(area: [*]u8) usize;
extern var __zig_elf_static_tls: extern struct {
size: usize,
alignment: usize,
gdt_entry_number: usize,
};
Users can override all three weak symbols with strong symbols if they want to
provide their own ELF TLS implementation, which may be useful to do when doing
manual dynamic loading from a static executable. Note that __tls_get_addr (or
__tls_get_offset on s390x) must also be provided, per the ELF TLS specification.
This gets rid of the super confusing and (as far as I can tell) incorrect
getauxval logic in std.os.linux, and clarifies exactly who owns this state.
The ABI that std now expects is:
extern var __zig_elf_auxv: [*]std.elf.Auxv;
Users can technically override this weak symbol with a strong symbol if they
wish, although I see no particularly useful reason to do so.
It is now a compile error to use std.os.linux.getauxval if libc is linked,
whereas previously it would just give useless results in some cases. I consider
this to be strictly an improvement. Just use std.c.getauxval when linking libc,
which std already does correctly where it needs getauxval.
This code is expected to be further simplified once our baseline Linux version
allows implementing https://codeberg.org/ziglang/zig/issues/31290.
closes https://codeberg.org/ziglang/zig/issues/36203
and remove "release" from the enum tag names.
no functional change, however, despite the addition of
backwards-compatibile declarations in this patch, it is breaking because
expressions that use `==` or `!=` operators will not able to use the
deprecated names.
I predict these names to survive until the 1.0 tag without any more
breakage.
LLVM requires frontends to lower i128 to <2 x i64> in IR to get the correct
__int128 ABI on x86_64-windows; this is what Clang does. I'm guessing our LLVM
backend didn't do this in the past, which made these hacks necessary. But it
does do so now, so just get rid of this stuff.