Skip to content

Commit fc4afea

Browse files
committed
simd intrinsics with mask: accept unsigned integer masks
1 parent b25a593 commit fc4afea

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/intrinsic/simd.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
443443
m_len == v_len,
444444
InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len }
445445
);
446+
// TODO: also support unsigned integers.
446447
match *m_elem_ty.kind() {
447448
ty::Int(_) => {}
448-
_ => return_error!(InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }),
449+
_ => return_error!(InvalidMonomorphization::MaskWrongElementType {
450+
span,
451+
name,
452+
ty: m_elem_ty
453+
}),
449454
}
450455
return Ok(bx.vector_select(args[0].immediate(), args[1].immediate(), args[2].immediate()));
451456
}
@@ -987,19 +992,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
987992
assert_eq!(pointer_count - 1, ptr_count(element_ty0));
988993
assert_eq!(underlying_ty, non_ptr(element_ty0));
989994

990-
// The element type of the third argument must be a signed integer type of any width:
995+
// The element type of the third argument must be an integer type of any width:
996+
// TODO: also support unsigned integers.
991997
let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx());
992998
match *element_ty2.kind() {
993999
ty::Int(_) => (),
9941000
_ => {
9951001
require!(
9961002
false,
997-
InvalidMonomorphization::ThirdArgElementType {
998-
span,
999-
name,
1000-
expected_element: element_ty2,
1001-
third_arg: arg_tys[2]
1002-
}
1003+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
10031004
);
10041005
}
10051006
}
@@ -1105,17 +1106,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
11051106
assert_eq!(underlying_ty, non_ptr(element_ty0));
11061107

11071108
// The element type of the third argument must be a signed integer type of any width:
1109+
// TODO: also support unsigned integers.
11081110
match *element_ty2.kind() {
11091111
ty::Int(_) => (),
11101112
_ => {
11111113
require!(
11121114
false,
1113-
InvalidMonomorphization::ThirdArgElementType {
1114-
span,
1115-
name,
1116-
expected_element: element_ty2,
1117-
third_arg: arg_tys[2]
1118-
}
1115+
InvalidMonomorphization::MaskWrongElementType { span, name, ty: element_ty2 }
11191116
);
11201117
}
11211118
}

0 commit comments

Comments
 (0)