Commit Graph

1533 Commits

Author SHA1 Message Date
Trevor Gross
7065cd0420 Rename EXP_MAX to EXP_SAT
"Maximum" is technically correct here with regards to what the
bitpattern can represent, but it is not the numeric maximum value of the
exponent which has a relationship with the bias. So, replace the maximum
terminology with "saturated" to indicate it only means the full
bitpattern.

This change is more relevant to `libm` than `compiler-builtins`.
2025-01-03 02:56:34 +00:00
Trevor Gross
b47d3cc2f8 Shorten prefixes for float constants
Change `SIGNIFICAND_*` to `SIG_*` and `EXPONENT_*` to `EXP_*`. This
makes things more consistent with `libm`, and terseness is convenient
here since there isn't anything to confuse.
2025-01-03 02:54:56 +00:00
github-actions[bot]
a078f5a0c5 chore: release v0.1.140 2024-12-26 00:16:33 -05:00
Sebastian Neubauer
e8eb76a45a Disable f128 for amdgpu (#737)
`compiler_builtins` fails to compile to amdgpu if f128 is enabled.
The reason seems to be that compiler_builtins uses libcalls in the
implementation. I’m not really familiar with what libcalls are, but the
LLVM amdgpu backend explicitly does not support them.

Error message:
```
LLVM ERROR: unsupported libcall legalization
```
2024-12-26 00:01:14 -05:00
Trevor Gross
cd4b4a6cbf Merge pull request #736 from tgross35/fix-abs-diff
Fix a bug in `abs_diff`
2024-12-22 17:25:43 -05:00
Trevor Gross
a4d9b4a6a2 Fix a bug in abs_diff
These implementations of `abs_diff` were added in c2ff1b3119
("Completely overhaul fuzz testing"), but the signed implementation is
wrong when |x| + |y| exceeds the integer's limits (e.g.
`(-128).abs_diff(1)` should be 128 but currently these return 127.

Resolve this by just using `std`'s implementation since that is stable
now. This isn't used anywhere critical, we probably just weren't hitting
the edge case.
2024-12-22 22:08:31 +00:00
Trevor Gross
09d628d5e1 Merge pull request #730 from tgross35/f16-f128-config-update
Disable `f16` on platforms that have recursion problems
2024-11-05 07:16:23 -06:00
Trevor Gross
04ccb683d9 Disable f16 on platforms that have recursion problems
CI in [1] seems to indicate that there are cases where the `f16`
infinite recursion bug ([2], [3]) can make its way into what gets called
during tests, even though this doesn't seem to be the usual case. In
order to make sure that we avoid these completely, just unset
`f16_enabled` on any platforms that have the recursion problem.

This also refactors the `match` statement to be more in line with
`library/std/build.rs`.

[1]: https://github.com/rust-lang/compiler-builtins/pull/729
[2]: https://github.com/llvm/llvm-project/issues/97981
[3]: https://github.com/rust-lang/compiler-builtins/issues/651
2024-11-05 02:57:34 -06:00
Trevor Gross
63e801bbf8 Merge pull request #728 from rust-lang/release-plz-2024-11-03T23-08-40Z
chore: release v0.1.139
2024-11-03 17:35:48 -06:00
github-actions[bot]
c33f521bb5 chore: release v0.1.139 2024-11-03 23:08:41 +00:00
Trevor Gross
83641751f8 Merge pull request #727 from beetrees/remove-sparcv9-pattern
Remove incorrect `sparcv9` match pattern from `configure_f16_f128`
2024-11-03 17:08:18 -06:00
beetrees
10bdf3b6c1 Remove incorrect sparcv9 match pattern from configure_f16_f128 2024-11-03 22:54:01 +00:00
Trevor Gross
dd750943bb Merge pull request #725 from rust-lang/release-plz-2024-11-01T10-00-30Z
chore: release v0.1.138
2024-11-01 06:07:40 -05:00
github-actions[bot]
4c7450d10c chore: release v0.1.138 2024-11-01 11:00:27 +00:00
Trevor Gross
28fb4bc868 Enable the changelog for release-plz
This crate isn't meant for direct use, but having an easy way to see
what changed between versions would still be helpful when this crate is
updated in rust-lang/rust.
2024-11-01 05:59:57 -05:00
WANG Rui
ec673535f7 ci: add support for loongarch64-unknown-linux-gnu 2024-11-01 05:48:47 -05:00
hev
ca996df5c1 Use f16_enabled/f128_enabled in examples/intrinsics.rs (#724)
Enable conditional compilation for intrinsics with `f16_enabled` and `f128_enabled`
2024-11-01 10:34:51 +00:00
hev
53b3e71bbc Disable f16 for LoongArch64 (#722)
Disable `f161` for LoongArch64 due to incorrect code generation on LLVM 19,
which causes failures in `testcrate/tests/conv.rs`. This workaround will
remain in place until llvm/llvm-project#109093 is merged or we upgrade to
LLVM 20.
2024-11-01 10:00:00 +00:00
github-actions[bot]
94e6ed373a chore: release v0.1.137 2024-10-31 19:13:38 -05:00
Trevor Gross
717128af3c Merge pull request #624 from tgross35/f128-int-to-float
Add f128 int to float conversions
2024-10-30 12:36:12 -05:00
Trevor Gross
9818afad7c Remove the unneeded isqrt feature gate
[1] has been stabilized so we no longer need to enable it.

[1]: https://github.com/rust-lang/rust/issues/116226
2024-10-30 12:27:59 -05:00
Trevor Gross
fbd6907358 Add integer to f128 conversions 2024-10-30 12:25:24 -05:00
Trevor Gross
51dd4da053 Refactor integer to float conversion
Extract some common routines to separate functions in order to
deduplicate code and remove some of the magic.
2024-10-30 12:25:22 -05:00
Trevor Gross
1dc50415cd Add an apfloat fallback for int to float tests 2024-10-30 12:22:57 -05:00
Trevor Gross
ad465ce6bd Merge pull request #719 from rust-lang/release-plz-2024-10-25T19-38-24Z
chore: release v0.1.136
2024-10-26 18:35:41 -05:00
github-actions[bot]
f9914e98b3 chore: release v0.1.136 2024-10-26 23:29:14 +00:00
Trevor Gross
73f1e5b8c2 Merge pull request #720 from tgross35/update-libm
Update the libm submodule
2024-10-26 18:28:48 -05:00
Trevor Gross
01a2a13a01 Update the libm submodule 2024-10-26 18:22:14 -05:00
Trevor Gross
0d241d63ea Merge pull request #717 from tgross35/update-licensing
Update licensing to Apache-2.0 WITH LLVM-exception AND MIT
2024-10-26 17:43:20 -05:00
Trevor Gross
6399bed36c Update licensing to MIT AND Apache-2.0 WITH LLVM-exception
Currently, Cargo.toml specifies Apache-2.0 OR MIT, but LICENSE.txt
describes MIT OR NCSA. compiler-builtins is derived from LLVM's
compiler-rt. LICENSE.txt correctly reflects the state of compiler-rt
prior to relicensing on 2019-01-19, during which time software was
available for use under either MIT or the University of Illinois NCSA
license. After relicensing, however, compiler-rt is available for use
only under Apache-2.0 with the LLVM exception; this is not reflected
anywhere in the repository.

Update the SPDX license identifier to `MIT AND Apache-2.0 WITH
LLVM-exception AND (MIT OR Apache-2.0)`. Each AND portion covers
something specific:

* Apache-2.0 WITH LLVM-exception: this covers work that is derived from
  the LLVM repository since after the LLVM relicensing.
* MIT: This covers work that is derived from LLVM before the LLVM
  relicensing (under MIT OR NCSA), as well as the vendored `libm`
  components.
* MIT AND Apache-2.0: This ensures that any contributions to this
  repository, in addition to meeting the above required licenses, is
  also released for use under the Rust-standard Apache-2.0 with no LLVM
  exception.

See also the parallel license update in rust-lang/libm [1].

Fixes: https://github.com/rust-lang/compiler-builtins/issues/307
Closes: https://github.com/rust-lang/compiler-builtins/pull/511
Link: https://rust-lang.zulipchat.com/#narrow/channel/335408-foundation/topic/Request.20for.20legal.20team.20input.20on.20crate.20licensing
Link: https://github.com/rust-lang/libm/pull/317 [1]
2024-10-26 17:35:26 -05:00
Trevor Gross
8184473187 Merge pull request #718 from tgross35/float-trait-refactor
Rename Float::repr and Float::from_repr
2024-10-25 14:38:01 -05:00
Trevor Gross
394fb9f2bc Add an abs function to the Float trait
There is no in-crate use for this yet, but we will make use of it in
`libm`.
2024-10-25 14:30:03 -05:00
Trevor Gross
2f7fafd182 Rename Float::repr and Float::from_repr
`to_bits` and `from_bits` are builtin methods on float types. Rename
`repr` to `to_bits` and `from_repr` to `from_bits` so this is consistent
with usage that doesn't go through the trait.
2024-10-25 14:18:53 -05:00
Trevor Gross
e4948d4295 Merge pull request #716 from rust-lang/release-plz-2024-10-23T09-57-02Z
chore: release v0.1.135
2024-10-23 05:06:04 -05:00
github-actions[bot]
ce89a70ae4 chore: release v0.1.135 2024-10-23 09:57:03 +00:00
Trevor Gross
8c26f3dd26 Merge pull request #715 from YtvwlD/math-i686-uefi
Re-enable math module on i686-unknown-uefi
2024-10-23 04:56:30 -05:00
Niklas Sombert
68b820187b Re-enable math module on i686-unknown-uefi
In 9ba77d1583e6de5ab9cf7c9b82827ba8fcb9062f, this was disabled for x86
without sse2. It should be fine to re-enable it for UEFI, as explained at
<https://github.com/rust-lang/rust/issues/128533#issuecomment-2408699671>.
2024-10-23 11:39:33 +02:00
Trevor Gross
8c66edb244 Merge pull request #714 from rust-lang/release-plz-2024-10-17T23-55-24Z
chore: release v0.1.134
2024-10-17 19:03:22 -05:00
github-actions[bot]
3e922da156 chore: release v0.1.134 2024-10-17 23:55:25 +00:00
Trevor Gross
26ca96a2f9 Merge pull request #713 from saethlin/permissive-memcpy
Use wrapping pointer arithmetic in mem/impls.rs
2024-10-17 18:55:02 -05:00
Ben Kimock
2a738c50ab Use wrapping pointer arithmetic in mem/impls.rs
Add a comment (and fix a typo)
2024-10-16 22:37:42 -04:00
Trevor Gross
fff4c16873 Merge pull request #709 from rust-lang/release-plz-2024-10-06T02-07-59Z
chore: release v0.1.133
2024-10-05 22:21:06 -04:00
github-actions[bot]
fedfc6aaab chore: release 2024-10-06 02:08:00 +00:00
Trevor Gross
a2d66e9869 Merge pull request #708 from tgross35/raskyld/master
fix(int): avoid infinite recursion on left shift #707
2024-10-05 22:07:36 -04:00
Trevor Gross
996799a896 Add a note about avoiding default implemenations in some places
Link: https://github.com/rust-lang/compiler-builtins/pull/707
2024-10-05 20:55:47 -05:00
Enzo "raskyld" Nocera
8153729f91 fix(int): avoid infinite recursion on left shift
Please, see this discussion for the full
context: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.5Bwasm32.5D.20Infinite.20recursion.20.60compiler-builtins.60.20.60__multi3.60

Signed-off-by: Enzo "raskyld" Nocera <enzo@nocera.eu>

We determined that some recursion problems on SPARC and WASM were due to
infinite recusion. This was introduced at 9c6fcb56e8 ("Split Int into
Int and MinInt") when moving the implementation of `widen_hi` from
something on each `impl` block to a default on the trait. The reasoning
is not fully understood, but undoing this portion of the change seems to
resolve the issue.

[ add the above context - Trevor ]

Signed-off-by: Trevor Gross <tmgross@umich.edu>
2024-10-05 20:49:45 -05:00
Trevor Gross
d150d472fe Merge pull request #705 from rust-lang/release-plz-2024-10-03T15-57-49Z
chore: release v0.1.132
2024-10-04 13:24:32 -04:00
github-actions[bot]
3edc27ef56 chore: release 2024-10-04 17:17:03 +00:00
Trevor Gross
ef4c4f2eb7 Merge pull request #706 from XrXr/limit-fix
Allow implicit function decl on A64
2024-10-04 13:16:32 -04:00
Alan Wu
3f70601e3c Allow implicit function decl on A64
Testing in <https://github.com/rust-lang/rust/pull/131221>, we found
that <https://github.com/rust-lang/compiler-builtins/pull/627> is
unusable with the current LLVM version.
2024-10-04 12:33:16 -04:00