Skip to content

Commit 7a399da

Browse files
authored
Disable unsupported tests in Rosetta 2 (#2272)
disable bmi tests under rosetta2
1 parent d846574 commit 7a399da

File tree

2 files changed

+30
-72
lines changed

2 files changed

+30
-72
lines changed

tests/simd/dune

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
; Tests with external assembler
1818

1919
(executables
20-
(names basic ops arrays scalar_ops)
21-
(modules basic ops arrays scalar_ops)
20+
(names basic ops arrays scalar_ops consts)
21+
(modules basic ops arrays scalar_ops consts)
2222
(libraries simd_test_helpers)
2323
(foreign_archives stubs)
2424
(ocamlopt_flags
@@ -27,8 +27,8 @@
2727
(rule
2828
(enabled_if
2929
(= %{context_name} "main"))
30-
(targets basic.out ops.out arrays.out scalar_ops.out)
31-
(deps basic.exe ops.exe arrays.exe scalar_ops.exe)
30+
(targets basic.out ops.out arrays.out scalar_ops.out consts.out)
31+
(deps basic.exe ops.exe arrays.exe scalar_ops.exe consts.exe)
3232
(action
3333
(progn
3434
(with-outputs-to
@@ -42,7 +42,10 @@
4242
(run ./arrays.exe))
4343
(with-outputs-to
4444
scalar_ops.out
45-
(run ./scalar_ops.exe)))))
45+
(run ./scalar_ops.exe))
46+
(with-outputs-to
47+
consts.out
48+
(run ./consts.exe)))))
4649

4750
(rule
4851
(alias runtest)
@@ -53,38 +56,8 @@
5356
(diff empty.expected basic.out)
5457
(diff empty.expected ops.out)
5558
(diff empty.expected arrays.out)
56-
(diff empty.expected scalar_ops.out))))
57-
58-
; Constants - proper inlining not supported on closure
59-
; CR mslater: these should run on flambda1 and 2, but dune doesn't know about 2
60-
61-
(executable
62-
(name consts)
63-
(modules consts)
64-
(foreign_archives stubs)
65-
(ocamlopt_flags
66-
(:standard -extension simd)))
67-
68-
(rule
69-
(enabled_if
70-
(and
71-
(= %{context_name} "main")
72-
%{ocaml-config:flambda}))
73-
(target consts.out)
74-
(deps consts.exe)
75-
(action
76-
(with-outputs-to
77-
consts.out
78-
(run ./consts.exe))))
79-
80-
(rule
81-
(alias runtest)
82-
(enabled_if
83-
(and
84-
(= %{context_name} "main")
85-
%{ocaml-config:flambda}))
86-
(action
87-
(diff empty.expected consts.out)))
59+
(diff empty.expected scalar_ops.out)
60+
(diff empty.expected consts.out))))
8861

8962
; Tests with probes / internal assembler - not supported on macOS
9063

@@ -166,18 +139,7 @@
166139
(run ./arrays_internal.exe))
167140
(with-outputs-to
168141
scalar_ops_internal.out
169-
(run ./scalar_ops_internal.exe)))))
170-
171-
(rule
172-
(enabled_if
173-
(and
174-
(= %{context_name} "main")
175-
(<> %{system} macosx)
176-
%{ocaml-config:flambda}))
177-
(targets consts_internal.out)
178-
(deps consts_internal.exe)
179-
(action
180-
(progn
142+
(run ./scalar_ops_internal.exe))
181143
(with-outputs-to
182144
consts_internal.out
183145
(run ./consts_internal.exe)))))
@@ -194,15 +156,5 @@
194156
(diff empty.expected basic_internal.out)
195157
(diff empty.expected ops_internal.out)
196158
(diff empty.expected arrays_internal.out)
197-
(diff empty.expected scalar_ops_internal.out))))
198-
199-
(rule
200-
(alias runtest)
201-
(enabled_if
202-
(and
203-
(= %{context_name} "main")
204-
(<> %{system} macosx)
205-
%{ocaml-config:flambda}))
206-
(action
207-
(progn
159+
(diff empty.expected scalar_ops_internal.out)
208160
(diff empty.expected consts_internal.out))))

tests/simd/scalar_ops.ml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ module Int = struct
102102
;;
103103

104104
let () =
105-
check count_leading_zeros clz;
106-
check count_leading_zeros2 clz;
105+
Test_helpers.run_if_not_under_rosetta2 ~f:(fun () ->
106+
check count_leading_zeros clz;
107+
check count_leading_zeros2 clz;
108+
check count_trailing_zeros ctz
109+
);
107110
check count_set_bits popcnt;
108-
check count_set_bits2 popcnt;
109-
check count_trailing_zeros ctz
111+
check count_set_bits2 popcnt
110112
;;
111113
end
112114

@@ -194,10 +196,12 @@ module Int64 = struct
194196
;;
195197

196198
let () =
197-
check count_leading_zeros clz;
198-
check ~nonzero:true count_leading_zeros_nonzero_arg clz;
199-
check count_trailing_zeros ctz;
200-
check ~nonzero:true count_trailing_zeros_nonzero_arg ctz;
199+
Test_helpers.run_if_not_under_rosetta2 ~f:(fun () ->
200+
check count_leading_zeros clz;
201+
check ~nonzero:true count_leading_zeros_nonzero_arg clz;
202+
check count_trailing_zeros ctz;
203+
check ~nonzero:true count_trailing_zeros_nonzero_arg ctz
204+
);
201205
check count_set_bits popcnt
202206
;;
203207
end
@@ -271,10 +275,12 @@ module Int32 = struct
271275
;;
272276

273277
let () =
274-
check count_leading_zeros clz;
275-
check ~nonzero:true count_leading_zeros_nonzero_arg clz;
276-
check count_trailing_zeros ctz;
277-
check ~nonzero:true count_trailing_zeros_nonzero_arg ctz;
278+
Test_helpers.run_if_not_under_rosetta2 ~f:(fun () ->
279+
check count_leading_zeros clz;
280+
check ~nonzero:true count_leading_zeros_nonzero_arg clz;
281+
check count_trailing_zeros ctz;
282+
check ~nonzero:true count_trailing_zeros_nonzero_arg ctz
283+
);
278284
check count_set_bits popcnt
279285
;;
280286
end

0 commit comments

Comments
 (0)