Skip to content

Commit 83938ba

Browse files
committed
avr: Skip No More!
1 parent 571ce5f commit 83938ba

File tree

14 files changed

+110
-125
lines changed

14 files changed

+110
-125
lines changed

src/float/add.rs

-2
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,12 @@ where
189189
}
190190

191191
intrinsics! {
192-
#[avr_skip]
193192
#[aapcs_on_arm]
194193
#[arm_aeabi_alias = __aeabi_fadd]
195194
pub extern "C" fn __addsf3(a: f32, b: f32) -> f32 {
196195
add(a, b)
197196
}
198197

199-
#[avr_skip]
200198
#[aapcs_on_arm]
201199
#[arm_aeabi_alias = __aeabi_dadd]
202200
pub extern "C" fn __adddf3(a: f64, b: f64) -> f64 {

src/float/cmp.rs

+32-47
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
use crate::float::Float;
44
use crate::int::MinInt;
55

6+
#[cfg(target_arch = "avr")]
7+
type CmpResult = i8;
8+
9+
#[cfg(not(target_arch = "avr"))]
10+
type CmpResult = i32;
11+
612
#[derive(Clone, Copy)]
713
enum Result {
814
Less,
@@ -12,7 +18,7 @@ enum Result {
1218
}
1319

1420
impl Result {
15-
fn to_le_abi(self) -> i32 {
21+
fn to_le_abi(self) -> CmpResult {
1622
match self {
1723
Result::Less => -1,
1824
Result::Equal => 0,
@@ -21,7 +27,7 @@ impl Result {
2127
}
2228
}
2329

24-
fn to_ge_abi(self) -> i32 {
30+
fn to_ge_abi(self) -> CmpResult {
2531
match self {
2632
Result::Less => -1,
2733
Result::Equal => 0,
@@ -99,120 +105,99 @@ fn unord<F: Float>(a: F, b: F) -> bool {
99105
}
100106

101107
intrinsics! {
102-
#[avr_skip]
103-
pub extern "C" fn __lesf2(a: f32, b: f32) -> i32 {
108+
pub extern "C" fn __lesf2(a: f32, b: f32) -> CmpResult {
104109
cmp(a, b).to_le_abi()
105110
}
106111

107-
#[avr_skip]
108-
pub extern "C" fn __gesf2(a: f32, b: f32) -> i32 {
112+
pub extern "C" fn __gesf2(a: f32, b: f32) -> CmpResult {
109113
cmp(a, b).to_ge_abi()
110114
}
111115

112-
#[avr_skip]
113116
#[arm_aeabi_alias = __aeabi_fcmpun]
114-
pub extern "C" fn __unordsf2(a: f32, b: f32) -> i32 {
115-
unord(a, b) as i32
117+
pub extern "C" fn __unordsf2(a: f32, b: f32) -> CmpResult {
118+
unord(a, b) as CmpResult
116119
}
117120

118-
#[avr_skip]
119-
pub extern "C" fn __eqsf2(a: f32, b: f32) -> i32 {
121+
pub extern "C" fn __eqsf2(a: f32, b: f32) -> CmpResult {
120122
cmp(a, b).to_le_abi()
121123
}
122124

123-
#[avr_skip]
124-
pub extern "C" fn __ltsf2(a: f32, b: f32) -> i32 {
125+
pub extern "C" fn __ltsf2(a: f32, b: f32) -> CmpResult {
125126
cmp(a, b).to_le_abi()
126127
}
127128

128-
#[avr_skip]
129-
pub extern "C" fn __nesf2(a: f32, b: f32) -> i32 {
129+
pub extern "C" fn __nesf2(a: f32, b: f32) -> CmpResult {
130130
cmp(a, b).to_le_abi()
131131
}
132132

133-
#[avr_skip]
134-
pub extern "C" fn __gtsf2(a: f32, b: f32) -> i32 {
133+
pub extern "C" fn __gtsf2(a: f32, b: f32) -> CmpResult {
135134
cmp(a, b).to_ge_abi()
136135
}
137136

138-
#[avr_skip]
139-
pub extern "C" fn __ledf2(a: f64, b: f64) -> i32 {
137+
pub extern "C" fn __ledf2(a: f64, b: f64) -> CmpResult {
140138
cmp(a, b).to_le_abi()
141139
}
142140

143-
#[avr_skip]
144-
pub extern "C" fn __gedf2(a: f64, b: f64) -> i32 {
141+
pub extern "C" fn __gedf2(a: f64, b: f64) -> CmpResult {
145142
cmp(a, b).to_ge_abi()
146143
}
147144

148-
#[avr_skip]
149145
#[arm_aeabi_alias = __aeabi_dcmpun]
150-
pub extern "C" fn __unorddf2(a: f64, b: f64) -> i32 {
151-
unord(a, b) as i32
146+
pub extern "C" fn __unorddf2(a: f64, b: f64) -> CmpResult {
147+
unord(a, b) as CmpResult
152148
}
153149

154-
#[avr_skip]
155-
pub extern "C" fn __eqdf2(a: f64, b: f64) -> i32 {
150+
pub extern "C" fn __eqdf2(a: f64, b: f64) -> CmpResult {
156151
cmp(a, b).to_le_abi()
157152
}
158153

159-
#[avr_skip]
160-
pub extern "C" fn __ltdf2(a: f64, b: f64) -> i32 {
154+
pub extern "C" fn __ltdf2(a: f64, b: f64) -> CmpResult {
161155
cmp(a, b).to_le_abi()
162156
}
163157

164-
#[avr_skip]
165-
pub extern "C" fn __nedf2(a: f64, b: f64) -> i32 {
158+
pub extern "C" fn __nedf2(a: f64, b: f64) -> CmpResult {
166159
cmp(a, b).to_le_abi()
167160
}
168161

169-
#[avr_skip]
170-
pub extern "C" fn __gtdf2(a: f64, b: f64) -> i32 {
162+
pub extern "C" fn __gtdf2(a: f64, b: f64) -> CmpResult {
171163
cmp(a, b).to_ge_abi()
172164
}
173165
}
174166

175167
#[cfg(f128_enabled)]
176168
intrinsics! {
177-
#[avr_skip]
178169
#[ppc_alias = __lekf2]
179-
pub extern "C" fn __letf2(a: f128, b: f128) -> i32 {
170+
pub extern "C" fn __letf2(a: f128, b: f128) -> CmpResult {
180171
cmp(a, b).to_le_abi()
181172
}
182173

183-
#[avr_skip]
184174
#[ppc_alias = __gekf2]
185-
pub extern "C" fn __getf2(a: f128, b: f128) -> i32 {
175+
pub extern "C" fn __getf2(a: f128, b: f128) -> CmpResult {
186176
cmp(a, b).to_ge_abi()
187177
}
188178

189-
#[avr_skip]
190179
#[ppc_alias = __unordkf2]
191-
pub extern "C" fn __unordtf2(a: f128, b: f128) -> i32 {
192-
unord(a, b) as i32
180+
pub extern "C" fn __unordtf2(a: f128, b: f128) -> CmpResult {
181+
unord(a, b) as CmpResult
193182
}
194183

195-
#[avr_skip]
196184
#[ppc_alias = __eqkf2]
197-
pub extern "C" fn __eqtf2(a: f128, b: f128) -> i32 {
185+
pub extern "C" fn __eqtf2(a: f128, b: f128) -> CmpResult {
198186
cmp(a, b).to_le_abi()
199187
}
200188

201-
#[avr_skip]
202189
#[ppc_alias = __ltkf2]
203-
pub extern "C" fn __lttf2(a: f128, b: f128) -> i32 {
190+
pub extern "C" fn __lttf2(a: f128, b: f128) -> CmpResult {
204191
cmp(a, b).to_le_abi()
205192
}
206193

207-
#[avr_skip]
208194
#[ppc_alias = __nekf2]
209-
pub extern "C" fn __netf2(a: f128, b: f128) -> i32 {
195+
pub extern "C" fn __netf2(a: f128, b: f128) -> CmpResult {
210196
cmp(a, b).to_le_abi()
211197
}
212198

213-
#[avr_skip]
214199
#[ppc_alias = __gtkf2]
215-
pub extern "C" fn __gttf2(a: f128, b: f128) -> i32 {
200+
pub extern "C" fn __gttf2(a: f128, b: f128) -> CmpResult {
216201
cmp(a, b).to_ge_abi()
217202
}
218203
}

src/float/div.rs

-3
Original file line numberDiff line numberDiff line change
@@ -606,19 +606,16 @@ where
606606
}
607607

608608
intrinsics! {
609-
#[avr_skip]
610609
#[arm_aeabi_alias = __aeabi_fdiv]
611610
pub extern "C" fn __divsf3(a: f32, b: f32) -> f32 {
612611
div(a, b)
613612
}
614613

615-
#[avr_skip]
616614
#[arm_aeabi_alias = __aeabi_ddiv]
617615
pub extern "C" fn __divdf3(a: f64, b: f64) -> f64 {
618616
div(a, b)
619617
}
620618

621-
#[avr_skip]
622619
#[ppc_alias = __divkf3]
623620
#[cfg(f128_enabled)]
624621
pub extern "C" fn __divtf3(a: f128, b: f128) -> f128 {

src/float/extend.rs

-7
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ where
7070
}
7171

7272
intrinsics! {
73-
#[avr_skip]
7473
#[aapcs_on_arm]
7574
#[arm_aeabi_alias = __aeabi_f2d]
7675
pub extern "C" fn __extendsfdf2(a: f32) -> f64 {
@@ -79,7 +78,6 @@ intrinsics! {
7978
}
8079

8180
intrinsics! {
82-
#[avr_skip]
8381
#[aapcs_on_arm]
8482
#[apple_f16_arg_abi]
8583
#[arm_aeabi_alias = __aeabi_h2f]
@@ -88,39 +86,34 @@ intrinsics! {
8886
extend(a)
8987
}
9088

91-
#[avr_skip]
9289
#[aapcs_on_arm]
9390
#[apple_f16_arg_abi]
9491
#[cfg(f16_enabled)]
9592
pub extern "C" fn __gnu_h2f_ieee(a: f16) -> f32 {
9693
extend(a)
9794
}
9895

99-
#[avr_skip]
10096
#[aapcs_on_arm]
10197
#[apple_f16_arg_abi]
10298
#[cfg(f16_enabled)]
10399
pub extern "C" fn __extendhfdf2(a: f16) -> f64 {
104100
extend(a)
105101
}
106102

107-
#[avr_skip]
108103
#[aapcs_on_arm]
109104
#[ppc_alias = __extendhfkf2]
110105
#[cfg(all(f16_enabled, f128_enabled))]
111106
pub extern "C" fn __extendhftf2(a: f16) -> f128 {
112107
extend(a)
113108
}
114109

115-
#[avr_skip]
116110
#[aapcs_on_arm]
117111
#[ppc_alias = __extendsfkf2]
118112
#[cfg(f128_enabled)]
119113
pub extern "C" fn __extendsftf2(a: f32) -> f128 {
120114
extend(a)
121115
}
122116

123-
#[avr_skip]
124117
#[aapcs_on_arm]
125118
#[ppc_alias = __extenddfkf2]
126119
#[cfg(f128_enabled)]

src/float/mul.rs

-2
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,12 @@ where
180180
}
181181

182182
intrinsics! {
183-
#[avr_skip]
184183
#[aapcs_on_arm]
185184
#[arm_aeabi_alias = __aeabi_fmul]
186185
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {
187186
mul(a, b)
188187
}
189188

190-
#[avr_skip]
191189
#[aapcs_on_arm]
192190
#[arm_aeabi_alias = __aeabi_dmul]
193191
pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 {

src/float/pow.rs

-3
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ fn pow<F: Float>(a: F, b: i32) -> F {
2626
}
2727

2828
intrinsics! {
29-
#[avr_skip]
3029
pub extern "C" fn __powisf2(a: f32, b: i32) -> f32 {
3130
pow(a, b)
3231
}
3332

34-
#[avr_skip]
3533
pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 {
3634
pow(a, b)
3735
}
3836

39-
#[avr_skip]
4037
#[ppc_alias = __powikf2]
4138
#[cfg(f128_enabled)]
4239
// FIXME(f16_f128): MSVC cannot build these until `__divtf3` is available in nightly.

src/float/sub.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use crate::float::Float;
22

33
intrinsics! {
4-
#[avr_skip]
54
#[arm_aeabi_alias = __aeabi_fsub]
65
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
76
crate::float::add::__addsf3(a, f32::from_bits(b.to_bits() ^ f32::SIGN_MASK))
87
}
98

10-
#[avr_skip]
119
#[arm_aeabi_alias = __aeabi_dsub]
1210
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
1311
crate::float::add::__adddf3(a, f64::from_bits(b.to_bits() ^ f64::SIGN_MASK))

src/float/trunc.rs

-7
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ where
115115
}
116116

117117
intrinsics! {
118-
#[avr_skip]
119118
#[aapcs_on_arm]
120119
#[arm_aeabi_alias = __aeabi_d2f]
121120
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {
@@ -124,7 +123,6 @@ intrinsics! {
124123
}
125124

126125
intrinsics! {
127-
#[avr_skip]
128126
#[aapcs_on_arm]
129127
#[apple_f16_ret_abi]
130128
#[arm_aeabi_alias = __aeabi_f2h]
@@ -133,15 +131,13 @@ intrinsics! {
133131
trunc(a)
134132
}
135133

136-
#[avr_skip]
137134
#[aapcs_on_arm]
138135
#[apple_f16_ret_abi]
139136
#[cfg(f16_enabled)]
140137
pub extern "C" fn __gnu_f2h_ieee(a: f32) -> f16 {
141138
trunc(a)
142139
}
143140

144-
#[avr_skip]
145141
#[aapcs_on_arm]
146142
#[apple_f16_ret_abi]
147143
#[arm_aeabi_alias = __aeabi_d2h]
@@ -150,23 +146,20 @@ intrinsics! {
150146
trunc(a)
151147
}
152148

153-
#[avr_skip]
154149
#[aapcs_on_arm]
155150
#[ppc_alias = __trunckfhf2]
156151
#[cfg(all(f16_enabled, f128_enabled))]
157152
pub extern "C" fn __trunctfhf2(a: f128) -> f16 {
158153
trunc(a)
159154
}
160155

161-
#[avr_skip]
162156
#[aapcs_on_arm]
163157
#[ppc_alias = __trunckfsf2]
164158
#[cfg(f128_enabled)]
165159
pub extern "C" fn __trunctfsf2(a: f128) -> f32 {
166160
trunc(a)
167161
}
168162

169-
#[avr_skip]
170163
#[aapcs_on_arm]
171164
#[ppc_alias = __trunckfdf2]
172165
#[cfg(f128_enabled)]

src/int/bswap.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
intrinsics! {
22
#[maybe_use_optimized_c_shim]
3-
#[avr_skip]
43
/// Swaps bytes in 32-bit number
54
pub extern "C" fn __bswapsi2(x: u32) -> u32 {
65
x.swap_bytes()
76
}
87

98
#[maybe_use_optimized_c_shim]
10-
#[avr_skip]
119
/// Swaps bytes in 64-bit number
1210
pub extern "C" fn __bswapdi2(x: u64) -> u64 {
1311
x.swap_bytes()
1412
}
1513

1614
#[maybe_use_optimized_c_shim]
17-
#[avr_skip]
1815
/// Swaps bytes in 128-bit number
1916
pub extern "C" fn __bswapti2(x: u128) -> u128 {
2017
x.swap_bytes()

0 commit comments

Comments
 (0)