Skip to content

Commit ae5309b

Browse files
committed
squash
1 parent 372bee2 commit ae5309b

File tree

180 files changed

+11559
-1946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+11559
-1946
lines changed

backend/afl_instrument.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ and instrument = function
101101

102102
(* these are base cases and have no logging *)
103103
| Cconst_int _ | Cconst_natint _ | Cconst_float32 _ | Cconst_float _
104-
| Cconst_vec128 _ | Cconst_symbol _
104+
| Cconst_vec128 _ | Cconst_vec256 _ | Cconst_vec512 _ | Cconst_symbol _
105105
| Cvar _ as c -> c
106106

107107
let instrument_function c dbg =

backend/amd64/CSE.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ let class_of_operation (op : Operation.t)
5252
| Csel _
5353
| Reinterpret_cast _ | Static_cast _
5454
| Const_int _ | Const_float32 _ | Const_float _
55-
| Const_symbol _ | Const_vec128 _
55+
| Const_symbol _ | Const_vec128 _ | Const_vec256 _ | Const_vec512 _
5656
| Stackoffset _ | Load _ | Store _ | Alloc _
5757
| Intop _ | Intop_imm _ | Intop_atomic _
5858
| Name_for_debugger _ | Probe_is_enabled _ | Opaque

backend/amd64/arch.ml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module Extension = struct
3030
| LZCNT
3131
| BMI
3232
| BMI2
33+
| AVX
34+
| AVX2
35+
| AVX512F
3336

3437
let rank = function
3538
| POPCNT -> 0
@@ -43,6 +46,9 @@ module Extension = struct
4346
| LZCNT -> 8
4447
| BMI -> 9
4548
| BMI2 -> 10
49+
| AVX -> 11
50+
| AVX2 -> 12
51+
| AVX512F -> 13
4652

4753
let compare left right = Int.compare (rank left) (rank right)
4854
end
@@ -62,6 +68,9 @@ module Extension = struct
6268
| LZCNT -> "LZCNT"
6369
| BMI -> "BMI"
6470
| BMI2 -> "BMI2"
71+
| AVX -> "AVX"
72+
| AVX2 -> "AVX2"
73+
| AVX512F -> "AVX512F"
6574

6675
let generation = function
6776
| POPCNT -> "Nehalem+"
@@ -75,18 +84,29 @@ module Extension = struct
7584
| LZCNT -> "Haswell+"
7685
| BMI -> "Haswell+"
7786
| BMI2 -> "Haswell+"
87+
| AVX -> "Sandybridge+"
88+
| AVX2 -> "Haswell+"
89+
| AVX512F -> "SkylakeXeon+"
7890

7991
let enabled_by_default = function
8092
| SSE3 | SSSE3 | SSE4_1 | SSE4_2
81-
| POPCNT | CLMUL | LZCNT | BMI | BMI2 -> true
82-
| PREFETCHW | PREFETCHWT1 -> false
93+
| POPCNT | CLMUL | LZCNT | BMI | BMI2 | AVX | AVX2 -> true
94+
| PREFETCHW | PREFETCHWT1 | AVX512F -> false
8395

84-
let all = Set.of_list [ POPCNT; PREFETCHW; PREFETCHWT1; SSE3; SSSE3; SSE4_1; SSE4_2; CLMUL; LZCNT; BMI; BMI2 ]
96+
let all = Set.of_list [ POPCNT; PREFETCHW; PREFETCHWT1; SSE3; SSSE3; SSE4_1; SSE4_2; CLMUL; LZCNT; BMI; BMI2; AVX; AVX2; AVX512F ]
8597
let config = ref (Set.filter enabled_by_default all)
8698

8799
let enabled t = Set.mem t !config
88100
let disabled t = not (enabled t)
89101

102+
let allow_vec256 () = List.exists enabled [AVX; AVX2; AVX512F]
103+
let allow_vec512 () = List.exists enabled [AVX512F]
104+
105+
let require_vec256 () =
106+
if not (allow_vec256 ()) then Misc.fatal_error "AVX or AVX512 is required for 256-bit vectors"
107+
let require_vec512 () =
108+
if not (allow_vec512 ()) then Misc.fatal_error "AVX512 is required for 512-bit vectors"
109+
90110
let args =
91111
let y t = "-f" ^ (name t |> String.lowercase_ascii) in
92112
let n t = "-fno-" ^ (name t |> String.lowercase_ascii) in
@@ -206,6 +226,8 @@ let size_int = 8
206226
let size_float = 8
207227

208228
let size_vec128 = 16
229+
let size_vec256 = 32
230+
let size_vec512 = 64
209231

210232
let allow_unaligned_access = true
211233

backend/amd64/arch.mli

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@ module Extension : sig
3131
to Haswell, i.e. they do not cause an illegal instruction fault.
3232
That means code using LZCNT/TZCNT will silently produce wrong results. *)
3333
| BMI2
34+
| AVX
35+
| AVX2
36+
| AVX512F
3437

3538
val name : t -> string
3639

3740
val enabled : t -> bool
3841
val available : unit -> t list
42+
43+
val allow_vec256 : unit -> bool
44+
val allow_vec512 : unit -> bool
45+
val require_vec256 : unit -> unit
46+
val require_vec512 : unit -> unit
3947
end
4048

4149
val trap_notes : bool ref
@@ -116,6 +124,10 @@ val size_float : int
116124

117125
val size_vec128 : int
118126

127+
val size_vec256 : int
128+
129+
val size_vec512 : int
130+
119131
val allow_unaligned_access : bool
120132

121133
val division_crashes_on_overflow : bool

backend/amd64/cfg_selection.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ let rcx = phys_reg Int 5
9595

9696
let rdx = phys_reg Int 4
9797

98-
let _xmm0v () = phys_reg Vec128 100
99-
10098
let select_locality (l : Cmm.prefetch_temporal_locality_hint) :
10199
Arch.prefetch_temporal_locality_hint =
102100
match l with
@@ -213,8 +211,8 @@ let pseudoregs_for_operation op arg res =
213211
| Ioffset_loc (_, _)
214212
| Irdtsc | Icldemote _ | Iprefetch _ )
215213
| Move | Spill | Reload | Reinterpret_cast _ | Static_cast _ | Const_int _
216-
| Const_float32 _ | Const_float _ | Const_vec128 _ | Const_symbol _
217-
| Stackoffset _ | Load _
214+
| Const_float32 _ | Const_float _ | Const_vec128 _ | Const_vec256 _
215+
| Const_vec512 _ | Const_symbol _ | Stackoffset _ | Load _
218216
| Store (_, _, _)
219217
| Alloc _ | Name_for_debugger _ | Probe_is_enabled _ | Opaque | Begin_region
220218
| End_region | Poll | Dls_get ->
@@ -271,7 +269,7 @@ let select_store ~is_assign addr (exp : Cmm.expression) :
271269
(Specific (Istore_int (Nativeint.of_int n, addr, is_assign)), Ctuple [])
272270
| Cconst_natint (n, _dbg) when is_immediate_natint n ->
273271
Rewritten (Specific (Istore_int (n, addr, is_assign)), Ctuple [])
274-
| Cconst_int _ | Cconst_vec128 _
272+
| Cconst_int _ | Cconst_vec128 _ | Cconst_vec256 _ | Cconst_vec512 _
275273
| Cconst_natint (_, _)
276274
| Cconst_float32 (_, _)
277275
| Cconst_float (_, _)

0 commit comments

Comments
 (0)