about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-08-12 17:09:15 +0200
committerGitHub <noreply@github.com>2024-08-12 17:09:15 +0200
commit13e7329fa64939a896da1f0a2987e7afe08faf34 (patch)
tree2fb4a26e5f8ef67811cb38a5fd62565e278fea6b
parentc5172fd0a76302a8d5ba5b63961ab321abc52d2c (diff)
parent7969ae336915e738926d8e9c98e56101516ccb9a (diff)
downloadrust-13e7329fa64939a896da1f0a2987e7afe08faf34.tar.gz
rust-13e7329fa64939a896da1f0a2987e7afe08faf34.zip
Rollup merge of #128537 - Jamesbarford:118980-const-vector, r=RalfJung,nikic
const vector passed through to codegen

This allows constant vectors using a repr(simd) type to be propagated
through to the backend by reusing the functionality used to do a similar
thing for the simd_shuffle intrinsic

#118209

r​? RalfJung
-rw-r--r--src/common.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common.rs b/src/common.rs
index 7a456e1c5d6..dca6b6494f9 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -160,6 +160,11 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         self.context.new_struct_constructor(None, struct_type.as_type(), None, values)
     }
 
+    fn const_vector(&self, values: &[RValue<'gcc>]) -> RValue<'gcc> {
+        let typ = self.type_vector(values[0].get_type(), values.len() as u64);
+        self.context.new_rvalue_from_vector(None, typ, values)
+    }
+
     fn const_to_opt_uint(&self, _v: RValue<'gcc>) -> Option<u64> {
         // TODO(antoyo)
         None