@@ -1168,13 +1168,13 @@ end
1168
1168
module File_kind = struct
1169
1169
type asm =
1170
1170
{ syntax : [ `Gas | `Intel ]
1171
- ; arch : [ `Amd64 ] option
1171
+ ; arch : Arch .t option
1172
1172
; os : [ `Win | `Unix ] option
1173
1173
; assembler : [ `C_comp | `Msvc_asm ]
1174
1174
}
1175
1175
1176
1176
type c =
1177
- { arch : [ `Arm64 | `X86 ] option
1177
+ { arch : Arch .t option
1178
1178
; flags : string list
1179
1179
}
1180
1180
@@ -1213,11 +1213,11 @@ module File_kind = struct
1213
1213
let fn = Filename. remove_extension fn in
1214
1214
let check suffix = String. ends_with fn ~suffix in
1215
1215
if check " x86-64_unix"
1216
- then Some `Unix , Some `Amd64 , `C_comp
1216
+ then Some `Unix , Some `amd64 , `C_comp
1217
1217
else if check " x86-64_windows_gnu"
1218
- then Some `Win , Some `Amd64 , `C_comp
1218
+ then Some `Win , Some `amd64 , `C_comp
1219
1219
else if check " x86-64_windows_msvc"
1220
- then Some `Win , Some `Amd64 , `Msvc_asm
1220
+ then Some `Win , Some `amd64 , `Msvc_asm
1221
1221
else None , None , `C_comp
1222
1222
in
1223
1223
Some (Asm { syntax; arch; os; assembler })
@@ -1227,7 +1227,7 @@ module File_kind = struct
1227
1227
let check suffix = String. ends_with fn ~suffix in
1228
1228
let x86 gnu _msvc =
1229
1229
(* CR rgrinberg: select msvc flags on windows *)
1230
- Some `X86 , gnu
1230
+ Some `amd64 , gnu
1231
1231
in
1232
1232
if check " _sse2"
1233
1233
then x86 [ " -msse2" ] [ " /arch:SSE2" ]
@@ -1238,7 +1238,7 @@ module File_kind = struct
1238
1238
else if check " _avx512"
1239
1239
then x86 [ " -mavx512f" ; " -mavx512vl" ; " -mavx512bw" ] [ " /arch:AVX512" ]
1240
1240
else if String. ends_with fn ~suffix: " _neon"
1241
- then Some `Arm64 , []
1241
+ then Some `arm64 , []
1242
1242
else None , []
1243
1243
in
1244
1244
Some (C { arch; flags })
@@ -1415,6 +1415,12 @@ module Library = struct
1415
1415
; asm_files : Source .asm_file list
1416
1416
}
1417
1417
1418
+ let is_target_arch ~architecture (arch : Arch.t option ) =
1419
+ match arch with
1420
+ | None -> true
1421
+ | Some arch -> architecture = arch
1422
+ ;;
1423
+
1418
1424
let keep_asm
1419
1425
{ File_kind. syntax; arch; os; assembler = _ }
1420
1426
~ccomp_type
@@ -1430,18 +1436,11 @@ module Library = struct
1430
1436
| `Gas , `Msvc -> false
1431
1437
| `Gas , _ -> true
1432
1438
| `Intel , _ -> false )
1433
- &&
1434
- match arch, architecture with
1435
- | None , _ -> true
1436
- | Some `Amd64 , `amd64 -> true
1437
- | Some `Amd64 , _ -> false
1439
+ && is_target_arch ~architecture arch
1438
1440
;;
1439
1441
1440
1442
let keep_c { File_kind. arch; flags = _ } ~architecture =
1441
- match arch with
1442
- | None -> true
1443
- | Some `Arm64 -> architecture = `arm64
1444
- | Some `X86 -> architecture = `amd64
1443
+ is_target_arch ~architecture arch
1445
1444
;;
1446
1445
1447
1446
let make_c (c : File_kind.c ) ~fn ~os_type ~word_size =
0 commit comments