Skip to content

Commit 38cebba

Browse files
committed
Mark float intrinsics with no preconditions as safe
1 parent 0266a08 commit 38cebba

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

crates/core_arch/src/aarch64/neon/generated.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10183,7 +10183,7 @@ pub fn vfmad_lane_f64<const LANE: i32>(a: f64, b: f64, c: float64x1_t) -> f64 {
1018310183
#[target_feature(enable = "neon,fp16")]
1018410184
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
1018510185
pub fn vfmah_f16(a: f16, b: f16, c: f16) -> f16 {
10186-
unsafe { fmaf16(b, c, a) }
10186+
fmaf16(b, c, a)
1018710187
}
1018810188
#[doc = "Floating-point fused multiply-add to accumulator"]
1018910189
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vfmah_lane_f16)"]
@@ -23045,7 +23045,7 @@ pub fn vrndaq_f64(a: float64x2_t) -> float64x2_t {
2304523045
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
2304623046
#[cfg_attr(test, assert_instr(frinta))]
2304723047
pub fn vrndah_f16(a: f16) -> f16 {
23048-
unsafe { roundf16(a) }
23048+
roundf16(a)
2304923049
}
2305023050
#[doc = "Floating-point round to integral, to nearest with ties to away"]
2305123051
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndh_f16)"]
@@ -23054,7 +23054,7 @@ pub fn vrndah_f16(a: f16) -> f16 {
2305423054
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
2305523055
#[cfg_attr(test, assert_instr(frintz))]
2305623056
pub fn vrndh_f16(a: f16) -> f16 {
23057-
unsafe { truncf16(a) }
23057+
truncf16(a)
2305823058
}
2305923059
#[doc = "Floating-point round to integral, using current rounding mode"]
2306023060
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndi_f16)"]
@@ -23229,7 +23229,7 @@ pub fn vrndmq_f64(a: float64x2_t) -> float64x2_t {
2322923229
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
2323023230
#[cfg_attr(test, assert_instr(frintm))]
2323123231
pub fn vrndmh_f16(a: f16) -> f16 {
23232-
unsafe { floorf16(a) }
23232+
floorf16(a)
2323323233
}
2323423234
#[doc = "Floating-point round to integral, to nearest with ties to even"]
2323523235
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndn_f64)"]
@@ -23356,7 +23356,7 @@ pub fn vrndpq_f64(a: float64x2_t) -> float64x2_t {
2335623356
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
2335723357
#[cfg_attr(test, assert_instr(frintp))]
2335823358
pub fn vrndph_f16(a: f16) -> f16 {
23359-
unsafe { ceilf16(a) }
23359+
ceilf16(a)
2336023360
}
2336123361
#[doc = "Floating-point round to integral exact, using current rounding mode"]
2336223362
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrndx_f16)"]
@@ -24846,7 +24846,7 @@ pub fn vsqrtq_f64(a: float64x2_t) -> float64x2_t {
2484624846
#[unstable(feature = "stdarch_neon_f16", issue = "136306")]
2484724847
#[cfg_attr(test, assert_instr(fsqrt))]
2484824848
pub fn vsqrth_f16(a: f16) -> f16 {
24849-
unsafe { sqrtf16(a) }
24849+
sqrtf16(a)
2485024850
}
2485124851
#[doc = "Shift Right and Insert (immediate)"]
2485224852
#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsri_n_s8)"]

crates/core_arch/src/wasm32/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn unreachable() -> ! {
4343
#[must_use = "method returns a new number and does not mutate the original value"]
4444
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
4545
pub fn f32_ceil(a: f32) -> f32 {
46-
unsafe { crate::intrinsics::ceilf32(a) }
46+
crate::intrinsics::ceilf32(a)
4747
}
4848

4949
/// Generates the [`f32.floor`] instruction, returning the largest integer less than or equal to `a`.
@@ -57,7 +57,7 @@ pub fn f32_ceil(a: f32) -> f32 {
5757
#[must_use = "method returns a new number and does not mutate the original value"]
5858
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
5959
pub fn f32_floor(a: f32) -> f32 {
60-
unsafe { crate::intrinsics::floorf32(a) }
60+
crate::intrinsics::floorf32(a)
6161
}
6262

6363
/// Generates the [`f32.trunc`] instruction, roundinging to the nearest integer towards zero.
@@ -71,7 +71,7 @@ pub fn f32_floor(a: f32) -> f32 {
7171
#[must_use = "method returns a new number and does not mutate the original value"]
7272
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
7373
pub fn f32_trunc(a: f32) -> f32 {
74-
unsafe { crate::intrinsics::truncf32(a) }
74+
crate::intrinsics::truncf32(a)
7575
}
7676

7777
/// Generates the [`f32.nearest`] instruction, roundinging to the nearest integer. Rounds half-way
@@ -100,7 +100,7 @@ pub fn f32_nearest(a: f32) -> f32 {
100100
#[must_use = "method returns a new number and does not mutate the original value"]
101101
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
102102
pub fn f32_sqrt(a: f32) -> f32 {
103-
unsafe { crate::intrinsics::sqrtf32(a) }
103+
crate::intrinsics::sqrtf32(a)
104104
}
105105

106106
/// Generates the [`f64.ceil`] instruction, returning the smallest integer greater than or equal to `a`.
@@ -114,7 +114,7 @@ pub fn f32_sqrt(a: f32) -> f32 {
114114
#[must_use = "method returns a new number and does not mutate the original value"]
115115
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
116116
pub fn f64_ceil(a: f64) -> f64 {
117-
unsafe { crate::intrinsics::ceilf64(a) }
117+
crate::intrinsics::ceilf64(a)
118118
}
119119

120120
/// Generates the [`f64.floor`] instruction, returning the largest integer less than or equal to `a`.
@@ -128,7 +128,7 @@ pub fn f64_ceil(a: f64) -> f64 {
128128
#[must_use = "method returns a new number and does not mutate the original value"]
129129
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
130130
pub fn f64_floor(a: f64) -> f64 {
131-
unsafe { crate::intrinsics::floorf64(a) }
131+
crate::intrinsics::floorf64(a)
132132
}
133133

134134
/// Generates the [`f64.trunc`] instruction, roundinging to the nearest integer towards zero.
@@ -142,7 +142,7 @@ pub fn f64_floor(a: f64) -> f64 {
142142
#[must_use = "method returns a new number and does not mutate the original value"]
143143
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
144144
pub fn f64_trunc(a: f64) -> f64 {
145-
unsafe { crate::intrinsics::truncf64(a) }
145+
crate::intrinsics::truncf64(a)
146146
}
147147

148148
/// Generates the [`f64.nearest`] instruction, roundinging to the nearest integer. Rounds half-way
@@ -171,7 +171,7 @@ pub fn f64_nearest(a: f64) -> f64 {
171171
#[must_use = "method returns a new number and does not mutate the original value"]
172172
#[unstable(feature = "wasm_numeric_instr", issue = "133908")]
173173
pub fn f64_sqrt(a: f64) -> f64 {
174-
unsafe { crate::intrinsics::sqrtf64(a) }
174+
crate::intrinsics::sqrtf64(a)
175175
}
176176

177177
unsafe extern "C-unwind" {

crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,7 +3054,7 @@ intrinsics:
30543054
types:
30553055
- [f16, 'h_']
30563056
compose:
3057-
- FnCall: [roundf16, [a], [], true]
3057+
- FnCall: [roundf16, [a], []]
30583058

30593059
- name: "vrndn{neon_type.no}"
30603060
doc: "Floating-point round to integral, to nearest with ties to even"
@@ -3151,7 +3151,7 @@ intrinsics:
31513151
types:
31523152
- [f16, 'h_']
31533153
compose:
3154-
- FnCall: [floorf16, [a], [], true]
3154+
- FnCall: [floorf16, [a], []]
31553155

31563156

31573157

@@ -3198,7 +3198,7 @@ intrinsics:
31983198
types:
31993199
- [f16, 'h_']
32003200
compose:
3201-
- FnCall: [ceilf16, [a], [], true]
3201+
- FnCall: [ceilf16, [a], []]
32023202

32033203
- name: "vrnd{neon_type.no}"
32043204
doc: "Floating-point round to integral, toward zero"
@@ -3243,7 +3243,7 @@ intrinsics:
32433243
types:
32443244
- [f16, 'h_']
32453245
compose:
3246-
- FnCall: [truncf16, [a], [], true]
3246+
- FnCall: [truncf16, [a], []]
32473247

32483248

32493249
- name: "vrndi{neon_type.no}"
@@ -8398,7 +8398,7 @@ intrinsics:
83988398
types:
83998399
- [f16, 'h_']
84008400
compose:
8401-
- FnCall: [sqrtf16, [a], [], true]
8401+
- FnCall: [sqrtf16, [a], []]
84028402

84038403
- name: "vrsqrts{type[0]}"
84048404
doc: "Floating-point reciprocal square root step"
@@ -10346,7 +10346,7 @@ intrinsics:
1034610346
types:
1034710347
- ["f16", "h_f16"]
1034810348
compose:
10349-
- FnCall: [fmaf16, [b, c, a], [], true]
10349+
- FnCall: [fmaf16, [b, c, a], []]
1035010350

1035110351

1035210352
- name: "vfmah_lane{type[2]}"

0 commit comments

Comments
 (0)