summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-15 14:40:50 +0200
committerGitHub <noreply@github.com>2024-06-15 14:40:50 +0200
commit3775f2f5d0292608ad31a26db99a0e3a39b86602 (patch)
tree03a7317c835bca22aa264d39d798fe6bfbd18bbb /tests
parenta2249027cda5e59d293a2b013551d87bc68c0323 (diff)
parente649042316ec3f832cfe120d04068b6e3e6c1791 (diff)
Rollup merge of #126429 - tgross35:f16-f128-const-eval, r=RalfJung
Add `f16` and `f128` const eval for binary and unary operationations Add const evaluation and Miri support for f16 and f128, including unary and binary operations. Casts are not yet included. Fixes https://github.com/rust-lang/rust/issues/124583 r? ``@RalfJung``
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/124583.rs5
-rw-r--r--tests/ui/numbers-arithmetic/f16-f128-lit.rs4
2 files changed, 4 insertions, 5 deletions
diff --git a/tests/crashes/124583.rs b/tests/crashes/124583.rs
deleted file mode 100644
index ffd9d7521ad..00000000000
--- a/tests/crashes/124583.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-//@ known-bug: rust-lang/rust#124583
-
-fn main() {
- let _ = -(-0.0f16);
-}
diff --git a/tests/ui/numbers-arithmetic/f16-f128-lit.rs b/tests/ui/numbers-arithmetic/f16-f128-lit.rs
index 762436edb16..7fd20d91d82 100644
--- a/tests/ui/numbers-arithmetic/f16-f128-lit.rs
+++ b/tests/ui/numbers-arithmetic/f16-f128-lit.rs
@@ -1,3 +1,5 @@
+// Make sure negation happens correctly. Also included:
+// issue: rust-lang/rust#124583
//@ run-pass
#![feature(f16)]
@@ -8,9 +10,11 @@ fn main() {
assert_eq!((-0.0_f16).to_bits(), 0x8000);
assert_eq!(10.0_f16.to_bits(), 0x4900);
assert_eq!((-10.0_f16).to_bits(), 0xC900);
+ assert_eq!((-(-0.0f16)).to_bits(), 0x0000);
assert_eq!(0.0_f128.to_bits(), 0x0000_0000_0000_0000_0000_0000_0000_0000);
assert_eq!((-0.0_f128).to_bits(), 0x8000_0000_0000_0000_0000_0000_0000_0000);
assert_eq!(10.0_f128.to_bits(), 0x4002_4000_0000_0000_0000_0000_0000_0000);
assert_eq!((-10.0_f128).to_bits(), 0xC002_4000_0000_0000_0000_0000_0000_0000);
+ assert_eq!((-(-0.0f128)).to_bits(), 0x0000_0000_0000_0000_0000_0000_0000_0000);
}