Commit graph

204 commits

Author SHA1 Message Date
dweiller
63f5a80b71 compiler-rt: workaround miscompilation in memmove 2025-01-30 19:56:57 +11:00
dweiller
4db01eb130 compiler-rt: optimize memmove 2025-01-30 19:56:57 +11:00
Andrew Kelley
eed3b9567d
Merge pull request #22610 from jacobly0/x86_64-rewrite
x86_64: rewrite `@min`/`@max` for scalar floats
2025-01-27 11:47:52 -08:00
dweiller
df1cd62720 compiler-rt: ensure memcpy Element has no unused bytes 2025-01-26 07:00:24 -08:00
Jacob Young
0c890bb9a4 x86_64: rewrite @min/@max for scalar floats 2025-01-26 06:58:37 -05:00
Alex Rønne Petersen
673544b783
compiler-rt: Pass called functions into inline asm so the compiler sees the usage. 2025-01-25 14:54:02 +01:00
Alex Rønne Petersen
35da1e1e8f
compiler-rt: Don't export __a(u)ll(div,rem) if linking libc.
libc provides these when targeting MSVC.
2025-01-25 13:49:21 +01:00
Alex Rønne Petersen
05a877a9a1
compiler-rt: More accurately export Windows Arm functions. 2025-01-25 13:49:21 +01:00
mlugg
38b47034f7
compiler_rt: upgrade to new panic interface 2025-01-24 22:33:23 +00:00
dweiller
b7a887f0fb compiler-rt: optimize memcpy
The new memcpy function aims to be more generic than the previous
implementation which was adapted from an implementation optimized for
x86_64 avx2 machines. Even on x86_64 avx2 machines this implementation
should be generally be faster due to fewer branches in the small length
cases and generating less machine code.

Note that the new memcpy function no longer acts as a memmove.
2025-01-20 18:29:15 +11:00
dweiller
d6e1166f1a compiler-rt: reduce memmove and memcpy size for ReleaseSmall 2025-01-20 18:29:15 +11:00
dweiller
bf89482f23 compiler-rt: move memmove back to memmove.zig 2025-01-20 17:16:24 +11:00
Alex Rønne Petersen
515c97065a
Revert "work around llvm failing to lower memcpy"
This reverts commit acf7043955.

Fixed as of ec768b7fa2f9c7dea6b92651bef59a7eea3299f2.
2025-01-18 12:59:41 +01:00
Andrew Kelley
acf7043955 work around llvm failing to lower memcpy
triggers an assertion in LegalizeDAG otherwise
2025-01-17 13:21:30 -08:00
Andrew Kelley
59acfb1263 compiler_rt: don't rely on weak aliases 2025-01-17 12:53:25 -08:00
David Rubin
f278038923 replace compiler_rt memcpy with a better version 2025-01-17 12:34:15 -08:00
GalaxyShard
e6879e99e2 compiler_rt: fix incorrect __clzsi2_thumb1 lookup table usage 2025-01-02 01:01:06 +01:00
Liam Swayne
b976e89c16 Add branch hint to unlikely branch of rem_pio2_large
Adds a `@branchHint` to a 1 in 12 branch of the pi/2 remainder calculation.
2024-12-23 14:41:43 -05:00
Alex Rønne Petersen
620f69c3b4
compiler-rt: Disable __aeabi_drsub test on armeb.
https://github.com/ziglang/zig/issues/22061
2024-12-13 03:13:14 +01:00
Alex Rønne Petersen
62074ec61b
compiler-rt: Fix Hexagon routines to use the new @export() pointer semantics. 2024-11-24 08:19:15 +01:00
Alex Rønne Petersen
47f84acc12
compiler-rt: Remove duplicate __hexagon_divsf3 export. 2024-11-24 08:19:15 +01:00
Alex Rønne Petersen
1285d41186
compiler-rt: Fix duplicate labels in Hexagon routines. 2024-11-24 08:19:15 +01:00
Brian Cain
4aa6246345
compiler_rt: Add hexagon builtins (#22029)
Signed-off-by: Brian Cain <bcain@quicinc.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2024-11-24 01:17:21 +00:00
Alex Rønne Petersen
2742ab4b5a compiler-rt: Fix R_ARM_ABS32 relocation error in __clzsi2_thumb1().
Closes #22050.
2024-11-23 17:53:31 +01:00
Alex Rønne Petersen
3054486d1d
Merge pull request #21843 from alexrp/callconv-followup
Some follow-up work for #21697
2024-11-03 14:27:09 +01:00
Alex Rønne Petersen
c9e67e71c1
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
The old isARM() function was a portability trap. With the name it had, it seemed
like the obviously correct function to use, but it didn't include Thumb. In the
vast majority of cases where someone wants to ask "is the target Arm?", Thumb
*should* be included.

There are exactly 3 cases in the codebase where we do actually need to exclude
Thumb, although one of those is in Aro and mirrors a check in Clang that is
itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-03 09:29:30 +01:00
Alex Rønne Petersen
baf60426d4
std.Target: Rename amdgpu module to amdgcn.
This was an inconsistency left over from c825b567b2.
2024-11-02 10:44:14 +01:00
mlugg
cf39652500
compiler_rt: remove bogus tests
These only worked before because our lowering of the `AAPCS` calling
convention was incorrect in a way which happened to match the ABI of
these functions. The tests aren't actually very helpful -- there are
already tests for `divmoddi4` etc -- so rather than using inline asm on
the caller side to match the ABI, we just delete these two tests.

We were for some reason missing a direct test for `__udivmodsi4`, so one
has been added.
2024-10-19 19:44:53 +01:00
Andrew Kelley
8504e1f550
Merge pull request #21610 from alexrp/riscv-abis
Fix some RISC-V ABI issues and add ILP32/LP64 (soft float) to module tests
2024-10-17 12:54:44 -07:00
Alex Rønne Petersen
dd983e12aa
compiler-rt: Use loongarch clear_cache() implementation for loongarch32 too. 2024-10-16 01:10:35 +02:00
Alex Rønne Petersen
0941364d70
compiler-rt: Always use f16 as the half type for riscv. 2024-10-15 19:29:56 +02:00
Alex Rønne Petersen
9b273f6b9a
Merge pull request #21570 from alexrp/windows-itanium
Initial port work for `*-windows-itanium` support.
2024-10-03 21:53:22 +02:00
Alex Rønne Petersen
e0ac776749
Merge pull request #21504 from alexrp/android-softfp
`std.Target`: Introduce `Abi.androideabi` to distinguish the soft float case.
2024-10-03 00:15:35 +02:00
Alex Rønne Petersen
537a873b17
Initial port work for *-windows-itanium support.
https://llvm.org/docs/HowToBuildWindowsItaniumPrograms.html

This is a weird middle ground between `*-windows-gnu` and `*-windows-msvc`. It
uses the C++ ABI of the former while using the system libraries of the latter.
2024-09-28 21:43:52 +02:00
Andrew Kelley
c9c080a187 embrace panic helpers
Introduces `std.builtin.Panic` which is a complete interface for
panicking. Provide `std.debug.FormattedPanic` and
`std.debug.SimplePanic` and let the user choose, or make their own.
2024-09-26 16:06:05 -07:00
Andrew Kelley
4f8d244e7e remove formatted panics
implements #17969
2024-09-26 12:35:14 -07:00
Alex Rønne Petersen
ebbc50d8be
std.Target: Introduce Abi.androideabi to distinguish the soft float case.
Abi.android on its own is not enough to know whether soft float or hard float
should be used. In the C world, androideabi is typically used for the soft float
case, so let's go with that.

Note that Android doesn't have a hard float ABI, so no androideabihf.

Closes #21488.
2024-09-24 09:23:24 +02:00
Alex Rønne Petersen
d3ba5f397d compiler-rt: Export extra soft float libcall names for thumb-windows-gnu. 2024-09-23 21:20:00 -07:00
Andrew Kelley
cefcf39faa compiler_rt: strong linkage when compiling to .c
This works around a problem that started happening with LLD around
version 18.1.8:

```
lld-link: error: duplicate symbol: .weak.__nexf2.default
>>> defined at CMakeFiles/zig2.dir/compiler_rt.c.obj
>>> defined at compiler_rt.lib(compiler_rt.lib.obj)
```
2024-09-19 18:20:22 -07:00
Alex Rønne Petersen
f1645772c1
compiler_rt: Export __truncdfhf2() for AEABI too.
Similar to __truncsfhf2() and __extendhfsf2().
2024-09-10 08:53:30 +02:00
Jeremy Hertel
227fb4875f std.math: rename make_f80 to F80.toFloat and break_f80 to F80.fromFloat 2024-09-02 00:10:22 +03:00
Andrew Kelley
a4cc43c42b
Merge pull request #21174 from alexrp/win-arm
Change `arm-windows-gnu` to `thumb-windows-gnu`, plus some initial port work
2024-08-30 14:34:53 -07:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
Alex Rønne Petersen
f02b93002c
compiler_rt: Export arm div helpers with correct names for thumb-linux-gnu. 2024-08-28 03:13:00 +02:00
Alex Rønne Petersen
3106998412
compiler_rt: Implement __chkstk() for thumb-windows-gnu.
ad435bcc14/compiler-rt/lib/builtins/arm/chkstk.S
2024-08-28 03:10:43 +02:00
mlugg
6808ce27bd
compiler,lib,test,langref: migrate @setCold to @branchHint 2024-08-27 00:44:35 +01:00
mlugg
a3a737e9a6
lib,test,tools,doc: update usages of @export 2024-08-27 00:44:35 +01:00
Alex Rønne Petersen
87ec4e11c9 compiler-rt: Fix the leoncasa CPU feature check for sparc32. 2024-08-12 14:36:21 -07:00
YANG Xudong
6d54f20c47
loongarch: add __clear_cache builtin implementation (#21008) 2024-08-10 01:24:01 -07:00
Alex Rønne Petersen
e5c75479c2
std.Target: Rework isPPC()/isPPC64() functions.
* Rename isPPC() -> isPowerPC32().
* Rename isPPC64() -> isPowerPC64().
* Add new isPowerPC() function which covers both.

There was confusion even in the standard library about what isPPC() meant. This
change makes these functions work how I think most people actually expect them
to work, and makes them consistent with isMIPS(), isSPARC(), etc.

I chose to rename from PPC to PowerPC because 1) it's more consistent with the
other functions, and 2) it'll cause loud rather than silent breakage for anyone
who might have been depending on isPPC() while misunderstanding it.
2024-08-01 20:58:05 +02:00