@@ -904,6 +904,12 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
904904 }
905905}
906906
907+ /// Runs stdarch's intrinsic-test binary crate to verify that Rust's `core::arch`
908+ /// SIMD intrinsics produce the same results as their C counterparts.
909+ ///
910+ /// First runs the `intrinsic-test` binary, which generates C wrapper programs
911+ /// and a Rust Cargo workspace. Then runs `cargo test` on that workspace
912+ /// which compiles both versions and compares their outputs on random inputs.
907913#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
908914pub struct IntrinsicTest {
909915 host : TargetSelection ,
@@ -917,12 +923,12 @@ impl Step for IntrinsicTest {
917923 run. path ( "library/stdarch/crates/intrinsic-test" ) . path ( "library/stdarch/crates/core_arch" )
918924 }
919925
920- fn is_default_step ( _builder : & Builder < ' _ > ) -> bool {
921- true
922- }
923-
924926 fn make_run ( run : RunConfig < ' _ > ) {
925- run. builder . ensure ( IntrinsicTest { host : run. target } ) ;
927+ let target = run. target ;
928+ if !target. contains ( "aarch64-unknown-linux" ) && !target. contains ( "x86_64-unknown-linux" ) {
929+ return ;
930+ }
931+ run. builder . ensure ( IntrinsicTest { host : target } ) ;
926932 }
927933
928934 fn run ( self , builder : & Builder < ' _ > ) {
@@ -949,16 +955,22 @@ impl Step for IntrinsicTest {
949955 None ,
950956 )
951957 } else {
952- return ;
958+ panic ! ( "intrinsic-test only supports aarch64/x86_64 Linux, got {host}" ) ;
953959 } ;
954960
955961 let out_dir = builder. out . join ( host) . join ( "intrinsic-test" ) ;
956962 t ! ( fs:: create_dir_all( & out_dir) ) ;
957963
958964 let crates_link = out_dir. join ( "crates" ) ;
959965 if !crates_link. exists ( ) {
960- std:: os:: unix:: fs:: symlink ( builder. src . join ( "library/stdarch/crates" ) , & crates_link)
961- . unwrap ( ) ;
966+ t ! (
967+ helpers:: symlink_dir(
968+ & builder. config,
969+ & builder. src. join( "library/stdarch/crates" ) ,
970+ & crates_link
971+ ) ,
972+ format!( "failed to symlink stdarch crates into {}" , crates_link. display( ) )
973+ ) ;
962974 }
963975
964976 let mut cmd = builder. tool_cmd ( Tool :: IntrinsicTest ) ;
@@ -967,7 +979,7 @@ impl Step for IntrinsicTest {
967979 cmd. arg ( "--target" ) . arg ( & * host. triple ) ;
968980 cmd. arg ( "--skip" ) . arg ( & skip_file) ;
969981 cmd. arg ( "--sample-percentage" ) . arg ( "10" ) ;
970- cmd. env ( "CC" , "clang" ) ;
982+ cmd. env ( "CC" , builder . cc ( host ) ) ;
971983 cmd. env ( "CFLAGS" , cflags) ;
972984 cmd. run ( builder) ;
973985
@@ -978,7 +990,7 @@ impl Step for IntrinsicTest {
978990 cargo. arg ( "--manifest-path" ) . arg ( & manifest) ;
979991 cargo. arg ( "--target" ) . arg ( & * host. triple ) ;
980992 cargo. arg ( "--profile" ) . arg ( "release" ) ;
981- cargo. env ( "CC" , "clang" ) ;
993+ cargo. env ( "CC" , builder . cc ( host ) ) ;
982994 cargo. env ( "CFLAGS" , cflags) ;
983995 cargo. env ( "RUSTC" , & builder. initial_rustc ) ;
984996 cargo. env ( "RUSTC_BOOTSTRAP" , "1" ) ;
0 commit comments