Skip to content

Commit 06b0360

Browse files
committed
Unpin compiler-builtins
1 parent 98ed962 commit 06b0360

File tree

6 files changed

+38
-77
lines changed

6 files changed

+38
-77
lines changed

Cargo.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build_system/build_sysroot/Cargo.lock

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build_system/build_sysroot/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ resolver = "2"
66

77
[dependencies]
88
core = { path = "./sysroot_src/library/core" }
9-
# TODO: after the sync, revert to using version 0.1.
10-
# compiler_builtins = "0.1"
11-
compiler_builtins = "=0.1.109"
9+
compiler_builtins = "0.1"
1210
alloc = { path = "./sysroot_src/library/alloc" }
1311
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
1412
test = { path = "./sysroot_src/library/test" }

src/context.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -228,48 +228,14 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
228228
"__builtin_umul_overflow",
229229
"__builtin_usubll_overflow",
230230
"__builtin_usub_overflow",
231-
"sqrtf",
232-
"sqrt",
233231
"__builtin_powif",
234232
"__builtin_powi",
235-
"sinf",
236-
"sin",
237-
"cosf",
238-
"cos",
239-
"powf",
240-
"pow",
241-
"expf",
242-
"exp",
243-
"exp2f",
244-
"exp2",
245-
"logf",
246-
"log",
247-
"log10f",
248-
"log10",
249-
"log2f",
250-
"log2",
251-
"fmaf",
252-
"fma",
253233
"fabsf",
254234
"fabs",
255-
"fminf",
256-
"fmin",
257-
"fmaxf",
258-
"fmax",
259235
"copysignf",
260236
"copysign",
261-
"floorf",
262-
"floor",
263-
"ceilf",
264-
"ceil",
265-
"truncf",
266-
"trunc",
267-
"rintf",
268-
"rint",
269237
"nearbyintf",
270238
"nearbyint",
271-
"roundf",
272-
"round",
273239
];
274240

275241
for builtin in builtins.iter() {

src/intrinsic/mod.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,10 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
127127
// https://github.com/rust-lang/rust-clippy/issues/12497
128128
// and leave `else if use_integer_compare` to be placed "as is".
129129
#[allow(clippy::suspicious_else_formatting)]
130-
let llval = match name {
130+
let value = match name {
131131
_ if simple.is_some() => {
132-
// FIXME(antoyo): remove this cast when the API supports function.
133-
let func = unsafe {
134-
std::mem::transmute::<Function<'gcc>, RValue<'gcc>>(simple.expect("simple"))
135-
};
136-
self.call(
137-
self.type_void(),
138-
None,
139-
None,
140-
func,
141-
&args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>(),
142-
None,
143-
None,
144-
)
132+
let func = simple.expect("simple function");
133+
self.cx.context.new_call(self.location, func, &args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>())
145134
}
146135
sym::likely => self.expect(args[0].immediate(), true),
147136
sym::unlikely => self.expect(args[0].immediate(), false),
@@ -383,7 +372,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
383372

384373
_ if name_str.starts_with("simd_") => {
385374
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {
386-
Ok(llval) => llval,
375+
Ok(value) => value,
387376
Err(()) => return Ok(()),
388377
}
389378
}
@@ -396,9 +385,9 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
396385
if let PassMode::Cast { cast: ref ty, .. } = fn_abi.ret.mode {
397386
let ptr_llty = self.type_ptr_to(ty.gcc_type(self));
398387
let ptr = self.pointercast(result.val.llval, ptr_llty);
399-
self.store(llval, ptr, result.val.align);
388+
self.store(value, ptr, result.val.align);
400389
} else {
401-
OperandRef::from_immediate_or_packed_pair(self, llval, result.layout)
390+
OperandRef::from_immediate_or_packed_pair(self, value, result.layout)
402391
.val
403392
.store(self, result);
404393
}

src/intrinsic/simd.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
765765
_ => return_error!(InvalidMonomorphization::UnrecognizedIntrinsic { span, name }),
766766
};
767767
let builtin_name = format!("{}{}", intr_name, elem_ty_str);
768-
let funcs = bx.cx.functions.borrow();
769-
let function = funcs
770-
.get(&builtin_name)
771-
.unwrap_or_else(|| panic!("unable to find builtin function {}", builtin_name));
768+
let function = bx.context.get_builtin_function(builtin_name);
772769

773770
// TODO(antoyo): add platform-specific behavior here for architectures that have these
774771
// intrinsics as instructions (for instance, gpus)
@@ -786,7 +783,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
786783
.map(|arg| bx.extract_element(arg.immediate(), index).to_rvalue())
787784
.collect()
788785
};
789-
vector_elements.push(bx.context.new_call(None, *function, &arguments));
786+
vector_elements.push(bx.context.new_call(None, function, &arguments));
790787
}
791788
let c = bx.context.new_rvalue_from_vector(None, vec_ty, &vector_elements);
792789
Ok(c)

0 commit comments

Comments
 (0)