Skip to content

Commit f328359

Browse files
authored
Merge pull request rust-lang#1216 from bjorn3/reduce_cg_clif_compile_times
Refactor the intrinsics module for slightly better build times
2 parents e4fff03 + b7cda37 commit f328359

File tree

3 files changed

+328
-397
lines changed

3 files changed

+328
-397
lines changed

src/intrinsics/llvm.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,30 @@ pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
7373
kind => unreachable!("kind {:?}", kind),
7474
};
7575

76-
simd_pair_for_each_lane(fx, x, y, ret, |fx, lane_layout, res_lane_layout, x_lane, y_lane| {
77-
let res_lane = match lane_layout.ty.kind() {
76+
simd_pair_for_each_lane(fx, x, y, ret, &|fx, lane_ty, res_lane_ty, x_lane, y_lane| {
77+
let res_lane = match lane_ty.kind() {
7878
ty::Float(_) => fx.bcx.ins().fcmp(flt_cc, x_lane, y_lane),
79-
_ => unreachable!("{:?}", lane_layout.ty),
79+
_ => unreachable!("{:?}", lane_ty),
8080
};
81-
bool_to_zero_or_max_uint(fx, res_lane_layout, res_lane)
81+
bool_to_zero_or_max_uint(fx, res_lane_ty, res_lane)
8282
});
8383
};
8484
"llvm.x86.sse2.psrli.d", (c a, o imm8) {
8585
let imm8 = crate::constant::mir_operand_get_const_val(fx, imm8).expect("llvm.x86.sse2.psrli.d imm8 not const");
86-
simd_for_each_lane(fx, a, ret, |fx, _lane_layout, res_lane_layout, lane| {
87-
let res_lane = match imm8.try_to_bits(Size::from_bytes(4)).unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8)) {
86+
simd_for_each_lane(fx, a, ret, &|fx, _lane_ty, _res_lane_ty, lane| {
87+
match imm8.try_to_bits(Size::from_bytes(4)).unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8)) {
8888
imm8 if imm8 < 32 => fx.bcx.ins().ushr_imm(lane, i64::from(imm8 as u8)),
8989
_ => fx.bcx.ins().iconst(types::I32, 0),
90-
};
91-
CValue::by_val(res_lane, res_lane_layout)
90+
}
9291
});
9392
};
9493
"llvm.x86.sse2.pslli.d", (c a, o imm8) {
9594
let imm8 = crate::constant::mir_operand_get_const_val(fx, imm8).expect("llvm.x86.sse2.psrli.d imm8 not const");
96-
simd_for_each_lane(fx, a, ret, |fx, _lane_layout, res_lane_layout, lane| {
97-
let res_lane = match imm8.try_to_bits(Size::from_bytes(4)).unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8)) {
95+
simd_for_each_lane(fx, a, ret, &|fx, _lane_ty, _res_lane_ty, lane| {
96+
match imm8.try_to_bits(Size::from_bytes(4)).unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8)) {
9897
imm8 if imm8 < 32 => fx.bcx.ins().ishl_imm(lane, i64::from(imm8 as u8)),
9998
_ => fx.bcx.ins().iconst(types::I32, 0),
100-
};
101-
CValue::by_val(res_lane, res_lane_layout)
99+
}
102100
});
103101
};
104102
"llvm.x86.sse2.storeu.dq", (v mem_addr, c a) {

0 commit comments

Comments
 (0)