Skip to content

Commit d957015

Browse files
committed
Implement _mm_slli_epi64
1 parent cb0a9b9 commit d957015

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/intrinsics/llvm_x86.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,24 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
326326
.try_to_bits(Size::from_bytes(4))
327327
.unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8))
328328
{
329-
imm8 if imm8 < 32 => fx.bcx.ins().ushr_imm(lane, i64::from(imm8 as u8)),
329+
imm8 if imm8 < 64 => fx.bcx.ins().ushr_imm(lane, i64::from(imm8 as u8)),
330+
_ => fx.bcx.ins().iconst(types::I32, 0),
331+
});
332+
}
333+
"llvm.x86.sse2.pslli.q" => {
334+
let (a, imm8) = match args {
335+
[a, imm8] => (a, imm8),
336+
_ => bug!("wrong number of args for intrinsic {intrinsic}"),
337+
};
338+
let a = codegen_operand(fx, a);
339+
let imm8 = crate::constant::mir_operand_get_const_val(fx, imm8)
340+
.expect("llvm.x86.avx.pslli.q imm8 not const");
341+
342+
simd_for_each_lane(fx, a, ret, &|fx, _lane_ty, _res_lane_ty, lane| match imm8
343+
.try_to_bits(Size::from_bytes(4))
344+
.unwrap_or_else(|| panic!("imm8 not scalar: {:?}", imm8))
345+
{
346+
imm8 if imm8 < 64 => fx.bcx.ins().ishl_imm(lane, i64::from(imm8 as u8)),
330347
_ => fx.bcx.ins().iconst(types::I32, 0),
331348
});
332349
}

0 commit comments

Comments
 (0)