@@ -11,7 +11,6 @@ use crate::common::intrinsic_types::IntrinsicTypeDefinition;
11
11
use crate :: common:: write_file;
12
12
use itertools:: Itertools ;
13
13
use rayon:: prelude:: * ;
14
- use std:: collections:: BTreeMap ;
15
14
16
15
// The number of times each intrinsic will be called.
17
16
const PASSES : u32 = 20 ;
@@ -162,11 +161,11 @@ fn generate_rust_program_arm(
162
161
163
162
fn compile_c_arm (
164
163
intrinsics_name_list : & Vec < String > ,
165
- _filename_mapping : BTreeMap < & String , String > ,
166
164
compiler : & str ,
167
165
target : & str ,
168
166
cxx_toolchain_dir : Option < & str > ,
169
167
) -> bool {
168
+ // -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations
170
169
let mut command = CompilationCommandBuilder :: new ( )
171
170
. add_arch_flags ( vec ! [ "armv8.6-a" , "crypto" , "crc" , "dotprod" , "fp16" ] )
172
171
. set_compiler ( compiler)
@@ -180,8 +179,17 @@ fn compile_c_arm(
180
179
command = command. add_arch_flags ( vec ! [ "faminmax" , "lut" , "sha3" ] ) ;
181
180
}
182
181
183
- command = if target == "aarch64_be-unknown-linux-gnu" {
184
- command
182
+ /*
183
+ * clang++ cannot link an aarch64_be object file, so we invoke
184
+ * aarch64_be-unknown-linux-gnu's C++ linker. This ensures that we
185
+ * are testing the intrinsics against LLVM.
186
+ *
187
+ * Note: setting `--sysroot=<...>` which is the obvious thing to do
188
+ * does not work as it gets caught up with `#include_next <stdlib.h>`
189
+ * not existing...
190
+ */
191
+ if target == "aarch64_be-unknown-linux-gnu" {
192
+ command = command
185
193
. set_linker (
186
194
cxx_toolchain_dir. unwrap_or ( "" ) . to_string ( ) + "/bin/aarch64_be-none-linux-gnu-g++" ,
187
195
)
@@ -192,14 +200,12 @@ fn compile_c_arm(
192
200
"/aarch64_be-none-linux-gnu/include/c++/14.2.1/aarch64_be-none-linux-gnu" ,
193
201
"/aarch64_be-none-linux-gnu/include/c++/14.2.1/backward" ,
194
202
"/aarch64_be-none-linux-gnu/libc/usr/include" ,
195
- ] )
196
- } else {
197
- if compiler. contains ( "clang" ) {
198
- command. add_extra_flag ( format ! ( "-target {target}" ) . as_str ( ) )
199
- } else {
200
- command. add_extra_flag ( "-flax-vector-conversions" )
201
- }
202
- } ;
203
+ ] ) ;
204
+ }
205
+
206
+ if !compiler. contains ( "clang" ) {
207
+ command = command. add_extra_flag ( "-flax-vector-conversions" ) ;
208
+ }
203
209
204
210
let compiler_commands = intrinsics_name_list
205
211
. iter ( )
@@ -237,13 +243,7 @@ pub fn build_c(
237
243
238
244
match compiler {
239
245
None => true ,
240
- Some ( compiler) => compile_c_arm (
241
- & intrinsics_name_list,
242
- filename_mapping,
243
- compiler,
244
- target,
245
- cxx_toolchain_dir,
246
- ) ,
246
+ Some ( compiler) => compile_c_arm ( & intrinsics_name_list, compiler, target, cxx_toolchain_dir) ,
247
247
}
248
248
}
249
249
0 commit comments