Skip to content

Commit 3aeb91f

Browse files
authored
Merge pull request #910 from folkertdev/use-float-fallbacks
use core fallbacks for more `f16`/`f128` operations
2 parents 2467b67 + 75f5d18 commit 3aeb91f

1 file changed

Lines changed: 5 additions & 31 deletions

File tree

src/intrinsic/mod.rs

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
9595
sym::floorf64 => "floor",
9696
sym::ceilf32 => "ceilf",
9797
sym::ceilf64 => "ceil",
98-
sym::powf128 => return float_intrinsic(cx, cx.type_f128(), "powf128"),
9998
sym::truncf32 => "truncf",
10099
sym::truncf64 => "trunc",
101100
// We match the LLVM backend and lower this to `rint`.
@@ -118,12 +117,7 @@ fn get_simple_function_f128<'gcc, 'tcx>(
118117
let func_name = match name {
119118
sym::ceilf128 => "ceilf128",
120119
sym::fabs => "fabsf128",
121-
sym::expf128 => "expf128",
122-
sym::exp2f128 => "exp2f128",
123120
sym::floorf128 => "floorf128",
124-
sym::logf128 => "logf128",
125-
sym::log2f128 => "log2f128",
126-
sym::log10f128 => "log10f128",
127121
sym::truncf128 => "truncf128",
128122
sym::roundf128 => "roundf128",
129123
sym::round_ties_even_f128 => "roundevenf128",
@@ -167,14 +161,8 @@ fn f16_builtin<'gcc, 'tcx>(
167161
let builtin_name = match name {
168162
sym::ceilf16 => "__builtin_ceilf",
169163
sym::copysignf16 => "__builtin_copysignf",
170-
sym::expf16 => "expf",
171-
sym::exp2f16 => "exp2f",
172164
sym::floorf16 => "__builtin_floorf",
173165
sym::fmaf16 => "fmaf",
174-
sym::logf16 => "logf",
175-
sym::log2f16 => "log2f",
176-
sym::log10f16 => "log10f",
177-
sym::powf16 => "__builtin_powf",
178166
sym::roundf16 => "__builtin_roundf",
179167
sym::round_ties_even_f16 => "__builtin_rintf",
180168
sym::sqrtf16 => "__builtin_sqrtf",
@@ -209,14 +197,11 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
209197
let simple = get_simple_intrinsic(self, name);
210198

211199
let value = match name {
212-
_ if simple.is_some() => {
213-
let func = simple.expect("simple intrinsic function");
214-
self.cx.context.new_call(
215-
self.location,
216-
func,
217-
&args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>(),
218-
)
219-
}
200+
_ if let Some(func) = simple => self.cx.context.new_call(
201+
self.location,
202+
func,
203+
&args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>(),
204+
),
220205
// FIXME(antoyo): We can probably remove these and use the fallback intrinsic implementation.
221206
sym::minimumf32 | sym::minimumf64 | sym::maximumf32 | sym::maximumf64 => {
222207
let (ty, func_name) = match name {
@@ -245,14 +230,8 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
245230
}
246231
sym::ceilf16
247232
| sym::copysignf16
248-
| sym::expf16
249-
| sym::exp2f16
250233
| sym::floorf16
251234
| sym::fmaf16
252-
| sym::logf16
253-
| sym::log2f16
254-
| sym::log10f16
255-
| sym::powf16
256235
| sym::roundf16
257236
| sym::round_ties_even_f16
258237
| sym::sqrtf16
@@ -263,11 +242,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
263242
| sym::roundf128
264243
| sym::round_ties_even_f128
265244
| sym::sqrtf128
266-
| sym::expf128
267-
| sym::exp2f128
268-
| sym::logf128
269-
| sym::log2f128
270-
| sym::log10f128
271245
if self.cx.supports_f128_type =>
272246
{
273247
let func = get_simple_function_f128(span, self, name);

0 commit comments

Comments
 (0)