about summary refs log tree commit diff
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2022-03-29 22:51:00 -0400
committerGitHub <noreply@github.com>2022-03-29 22:51:00 -0400
commita445bcb53d5f62d188ef9c1bb107668293fd9013 (patch)
treeff0c76ba37ec4f34a7fe8fcd8ad3208f3b8b803f
parent13ab1ab9de20dc7571347ff5c72026052e415dda (diff)
parent267e5e1ea78138543c99330b784a5b013ee03064 (diff)
downloadrust-a445bcb53d5f62d188ef9c1bb107668293fd9013.tar.gz
rust-a445bcb53d5f62d188ef9c1bb107668293fd9013.zip
Merge pull request #149 from rust-lang/missing-comments
Add support for target builtins
-rw-r--r--src/builder.rs4
-rw-r--r--src/int.rs4
-rw-r--r--src/intrinsic/simd.rs4
3 files changed, 10 insertions, 2 deletions
diff --git a/src/builder.rs b/src/builder.rs
index d53e1712dc8..a4616d8673e 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -231,6 +231,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
                     }
                     else {
                         assert!(!((actual_ty.is_vector() && !expected_ty.is_vector()) || (!actual_ty.is_vector() && expected_ty.is_vector())), "{:?} ({}) -> {:?} ({}), index: {:?}[{}]", actual_ty, actual_ty.is_vector(), expected_ty, expected_ty.is_vector(), func_ptr, index);
+                        // TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
                         self.bitcast(actual_val, expected_ty)
                     }
                 }
@@ -1320,11 +1321,13 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
             if vec_num_units < mask_num_units {
                 // NOTE: the mask needs to be the same length as the input vectors, so join the 2
                 // vectors and create a dummy second vector.
+                // TODO(antoyo): switch to using new_vector_access.
                 let array = self.context.new_bitcast(None, v1, array_type);
                 let mut elements = vec![];
                 for i in 0..vec_num_units {
                     elements.push(self.context.new_array_access(None, array, self.context.new_rvalue_from_int(self.int_type, i as i32)).to_rvalue());
                 }
+                // TODO(antoyo): switch to using new_vector_access.
                 let array = self.context.new_bitcast(None, v2, array_type);
                 for i in 0..vec_num_units {
                     elements.push(self.context.new_array_access(None, array, self.context.new_rvalue_from_int(self.int_type, i as i32)).to_rvalue());
@@ -1347,6 +1350,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
             // NOTE: if padding was added, only select the number of elements of the masks to
             // remove that padding in the result.
             let mut elements = vec![];
+            // TODO(antoyo): switch to using new_vector_access.
             let array = self.context.new_bitcast(None, result, array_type);
             for i in 0..mask_num_units {
                 elements.push(self.context.new_array_access(None, array, self.context.new_rvalue_from_int(self.int_type, i as i32)).to_rvalue());
diff --git a/src/int.rs b/src/int.rs
index ed779d5d888..0c5dab00466 100644
--- a/src/int.rs
+++ b/src/int.rs
@@ -156,6 +156,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
             if a_type != b_type {
                 if a_type.is_vector() {
                     // Vector types need to be bitcast.
+                    // TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
                     b = self.context.new_bitcast(None, b, a.get_type());
                 }
                 else {
@@ -649,8 +650,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
             // Since u128 and i128 are the only types that can be unsupported, we know the type of
             // value and the destination type have the same size, so a bitcast is fine.
 
-            // TODO(antoyo): perhaps use __builtin_convertvector for vector casting. (This is elsewhere,
-            // though.)
+            // TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
             self.context.new_bitcast(None, value, dest_typ)
         }
     }
diff --git a/src/intrinsic/simd.rs b/src/intrinsic/simd.rs
index 11f1e7dd999..b8c6038896d 100644
--- a/src/intrinsic/simd.rs
+++ b/src/intrinsic/simd.rs
@@ -203,12 +203,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>,
         let param1_type = builtin.get_param(0).to_rvalue().get_type();
         let vector =
             if vector.get_type() != param1_type {
+                // TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
                 bx.context.new_bitcast(None, vector, param1_type)
             }
             else {
                 vector
             };
         let result = bx.context.new_call(None, builtin, &[vector, value, bx.context.new_cast(None, index, bx.int_type)]);
+        // TODO(antoyo): perhaps use __builtin_convertvector for vector casting.
         return Ok(bx.context.new_bitcast(None, result, vector.get_type()));
     }
     if name == sym::simd_extract {
@@ -277,6 +279,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>,
             let vector_type = bx.context.new_vector_type(out_type, 8);
             let vector = args[0].immediate();
             let array_type = bx.context.new_array_type(None, in_type, 8);
+            // TODO(antoyo): switch to using new_vector_access or __builtin_convertvector for vector casting.
             let array = bx.context.new_bitcast(None, vector, array_type);
 
             let cast_vec_element = |index| {
@@ -533,6 +536,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>,
 
         let func = bx.context.get_target_builtin_function(builtin_name);
         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));
     }