@@ -66,10 +66,10 @@ module Make (Target : Cfg_selectgen_target_intf.S) = struct
66
66
(* avoid reordering *)
67
67
(* The remaining operations are simple if their args are *)
68
68
| Cload _ | Caddi | Csubi | Cmuli | Cmulhi _ | Cdivi | Cmodi | Cand | Cor
69
- | Cxor | Clsl | Clsr | Casr | Ccmpi _ | Caddv | Cadda | Ccmpa _ | Cnegf _
70
- | Cclz _ | Cctz _ | Cpopcnt | Cbswap _ | Ccsel _ | Cabsf _ | Caddf _
71
- | Csubf _ | Cmulf _ | Cdivf _ | Cpackf32 | Creinterpret_cast _
72
- | Cstatic_cast _ | Ctuple_field _ | Ccmpf _ | Cdls_get ->
69
+ | Cxor | Clsl | Clsr | Casr | Ccmpi _ | Caddv | Cadda | Cnegf _ | Cclz _
70
+ | Cctz _ | Cpopcnt | Cbswap _ | Ccsel _ | Cabsf _ | Caddf _ | Csubf _
71
+ | Cmulf _ | Cdivf _ | Cpackf32 | Creinterpret_cast _ | Cstatic_cast _
72
+ | Ctuple_field _ | Ccmpf _ | Cdls_get ->
73
73
List. for_all is_simple_expr args)
74
74
| Cifthenelse _ | Cswitch _ | Ccatch _ | Cexit _ -> false
75
75
@@ -121,9 +121,9 @@ module Make (Target : Cfg_selectgen_target_intf.S) = struct
121
121
| Cprobe_is_enabled _ -> EC. coeffect_only Arbitrary
122
122
| Ctuple_field _ | Caddi | Csubi | Cmuli | Cmulhi _ | Cdivi | Cmodi
123
123
| Cand | Cor | Cxor | Cbswap _ | Ccsel _ | Cclz _ | Cctz _ | Cpopcnt
124
- | Clsl | Clsr | Casr | Ccmpi _ | Caddv | Cadda | Ccmpa _ | Cnegf _
125
- | Cabsf _ | Caddf _ | Csubf _ | Cmulf _ | Cdivf _ | Cpackf32
126
- | Creinterpret_cast _ | Cstatic_cast _ | Ccmpf _ ->
124
+ | Clsl | Clsr | Casr | Ccmpi _ | Caddv | Cadda | Cnegf _ | Cabsf _
125
+ | Caddf _ | Csubf _ | Cmulf _ | Cdivf _ | Cpackf32 | Creinterpret_cast _
126
+ | Cstatic_cast _ | Ccmpf _ ->
127
127
EC. none
128
128
in
129
129
EC. join from_op (EC. join_list_map args effects_of)
@@ -156,20 +156,13 @@ module Make (Target : Cfg_selectgen_target_intf.S) = struct
156
156
let select_condition (arg : Cmm.expression ) : Operation. test * Cmm. expression
157
157
=
158
158
match arg with
159
- | Cop (Ccmpi cmp, [arg1; Cconst_int (n, _)], _)
160
- when is_immediate_test ( Isigned cmp) n ->
161
- Iinttest_imm (Isigned cmp, n), arg1
159
+ | Cop (Ccmpi cmp, [arg1; Cconst_int (n, _)], _) when is_immediate_test cmp n
160
+ ->
161
+ Iinttest_imm (cmp, n), arg1
162
162
| Cop (Ccmpi cmp, [Cconst_int (n, _); arg2], _)
163
- when is_immediate_test (Isigned (Cmm. swap_integer_comparison cmp)) n ->
164
- Iinttest_imm (Isigned (Cmm. swap_integer_comparison cmp), n), arg2
165
- | Cop (Ccmpi cmp , args , _ ) -> Iinttest (Isigned cmp), Ctuple args
166
- | Cop (Ccmpa cmp, [arg1; Cconst_int (n, _)], _)
167
- when is_immediate_test (Iunsigned cmp) n ->
168
- Iinttest_imm (Iunsigned cmp, n), arg1
169
- | Cop (Ccmpa cmp, [Cconst_int (n, _); arg2], _)
170
- when is_immediate_test (Iunsigned (Cmm. swap_integer_comparison cmp)) n ->
171
- Iinttest_imm (Iunsigned (Cmm. swap_integer_comparison cmp), n), arg2
172
- | Cop (Ccmpa cmp , args , _ ) -> Iinttest (Iunsigned cmp), Ctuple args
163
+ when is_immediate_test (Cmm. swap_integer_comparison cmp) n ->
164
+ Iinttest_imm (Cmm. swap_integer_comparison cmp, n), arg2
165
+ | Cop (Ccmpi cmp , args , _ ) -> Iinttest cmp, Ctuple args
173
166
| Cop (Ccmpf (width , cmp ), args , _ ) -> Ifloattest (width, cmp), Ctuple args
174
167
| Cop (Cand, [arg1 ; Cconst_int (1 , _ )], _ ) -> Ioddtest , arg1
175
168
| _ -> Itruetest , arg
@@ -245,8 +238,10 @@ module Make (Target : Cfg_selectgen_target_intf.S) = struct
245
238
| [arg; Cconst_int (n, _)] when is_immediate (Operation. Icomp cmp) n ->
246
239
SU. basic_op (Intop_imm (Icomp cmp, n)), [arg]
247
240
| [Cconst_int (n, _); arg]
248
- when is_immediate (Operation. Icomp (SU. swap_intcomp cmp)) n ->
249
- SU. basic_op (Intop_imm (Icomp (SU. swap_intcomp cmp), n)), [arg]
241
+ when is_immediate (Operation. Icomp (Scalar.Integer_comparison. swap cmp)) n
242
+ ->
243
+ ( SU. basic_op (Intop_imm (Icomp (Scalar.Integer_comparison. swap cmp), n)),
244
+ [arg] )
250
245
| _ -> SU. basic_op (Intop (Icomp cmp)), args
251
246
252
247
(* Default instruction selection for operators *)
@@ -353,10 +348,9 @@ module Make (Target : Cfg_selectgen_target_intf.S) = struct
353
348
| Cctz { arg_is_non_zero } ->
354
349
SU. basic_op (Intop (Ictz { arg_is_non_zero })), args
355
350
| Cpopcnt -> SU. basic_op (Intop Ipopcnt ), args
356
- | Ccmpi comp -> select_arith_comp ( Isigned comp) args
351
+ | Ccmpi comp -> select_arith_comp comp args
357
352
| Caddv -> select_arith_comm Iadd args
358
353
| Cadda -> select_arith_comm Iadd args
359
- | Ccmpa comp -> select_arith_comp (Iunsigned comp) args
360
354
| Ccmpf (w , comp ) -> SU. basic_op (Floatop (w, Icompf comp)), args
361
355
| Ccsel _ ->
362
356
let cond, ifso, ifnot = three_args () in
0 commit comments