Skip to content

Commit 5088fb3

Browse files
committed
Cast arguments in SIMD function
1 parent 852735d commit 5088fb3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/intrinsic/simd.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>,
539539
let vec_ty = bx.cx.type_vector(elem_ty, in_len as u64);
540540

541541
let func = bx.context.get_target_builtin_function(builtin_name);
542+
let param1_type = func.get_parameter(0).get_type();
543+
let lhs =
544+
if lhs.get_type() != param1_type {
545+
bx.context.new_bitcast(None, lhs, param1_type)
546+
}
547+
else {
548+
lhs
549+
};
542550
let result = bx.context.new_call(None, func, &[lhs, rhs]);
543551
// TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
544552
return Ok(bx.context.new_bitcast(None, result, vec_ty));

0 commit comments

Comments
 (0)