diff options
| author | Antoni Boucher <bouanto@zoho.com> | 2022-04-24 12:02:16 -0400 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2022-05-03 17:47:46 -0400 |
| commit | 5088fb3d3b20fa20a72425e1d214343c9ed7251a (patch) | |
| tree | 9b47ce749e9b6a50ad34821ddc924495df62757f | |
| parent | 852735da05d741317014bc54cb5933820e19cc72 (diff) | |
| download | rust-5088fb3d3b20fa20a72425e1d214343c9ed7251a.tar.gz rust-5088fb3d3b20fa20a72425e1d214343c9ed7251a.zip | |
Cast arguments in SIMD function
| -rw-r--r-- | src/intrinsic/simd.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/intrinsic/simd.rs b/src/intrinsic/simd.rs index f1167bc3a3b..e5753e318c7 100644 --- a/src/intrinsic/simd.rs +++ b/src/intrinsic/simd.rs @@ -539,6 +539,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, let vec_ty = bx.cx.type_vector(elem_ty, in_len as u64); let func = bx.context.get_target_builtin_function(builtin_name); + let param1_type = func.get_parameter(0).get_type(); + let lhs = + if lhs.get_type() != param1_type { + bx.context.new_bitcast(None, lhs, param1_type) + } + else { + lhs + }; let result = bx.context.new_call(None, func, &[lhs, rhs]); // TODO(antoyo): perhaps use __builtin_convertvector for vector casting. return Ok(bx.context.new_bitcast(None, result, vec_ty)); |
