@@ -8,6 +8,30 @@ use crate::common::{
88/// Maximum size of a SVE vector
99pub const MAX_SVE_BITS : u32 = 2048 ;
1010
11+ /// Writes a string defining a static variable with test values used for all intrinsics with
12+ /// arguments of type `ty` to `w`.
13+ ///
14+ /// e.g.
15+ /// ```rust,ignore
16+ /// static U8_20: [u8; 20] = [
17+ /// 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xf0,
18+ /// 0x80, 0x3b, 0xff,
19+ /// ];
20+ /// ```
21+ pub fn test_values_array_static < T : IntrinsicTypeDefinition > (
22+ w : & mut impl std:: io:: Write ,
23+ ty : & T ,
24+ ) -> std:: io:: Result < ( ) > {
25+ writeln ! (
26+ w,
27+ "static {name}: [{ty}; {load_size}] = {values};\n " ,
28+ name = test_values_array_name( ty) ,
29+ ty = ty. rust_scalar_type( ) ,
30+ load_size = test_values_array_length( & ty) ,
31+ values = test_values_array( & ty)
32+ )
33+ }
34+
1135/// Returns a string with the name of the static variable containing test values for intrinsic
1236/// arguments of this type.
1337pub fn test_values_array_name < T : IntrinsicTypeDefinition > ( ty : & T ) -> String {
@@ -20,7 +44,7 @@ pub fn test_values_array_name<T: IntrinsicTypeDefinition>(ty: &T) -> String {
2044
2145/// Returns the elements used in the test value arrays in `gen_arg_rust`. Uses the
2246/// `test_values_array_length` fn to determine the number of values that
23- /// `ArgumentList::gen_arg_rust ` expects and `ArgumentList::load_values_rust` needs.
47+ /// `test_values_array_static ` expects and `ArgumentList::load_values_rust` needs.
2448///
2549/// Each value in the array starts as a bit pattern from `bit_pattern_for_test_values_array`
2650/// which is then printed as a hex value in the generated code (and if identified as a negative
0 commit comments