Skip to content

Commit 5ecdffd

Browse files
committed
CHB:ARM: allow for predicated test instructions
1 parent 2ecfe6f commit 5ecdffd

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

CodeHawk/CHB/bchlibarm32/bCHARMConditionalExpr.ml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
66
7-
Copyright (c) 2021-2024 Aarno Labs LLC
7+
Copyright (c) 2021-2025 Aarno Labs LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
1010
of this software and associated documentation files (the "Software"), to deal
@@ -211,9 +211,9 @@ let cc_expr
211211

212212
(* ---------------------------------------------------------- Compare --- *)
213213

214-
| (Compare (ACCAlways, x, y, _), ACCEqual) ->
214+
| (Compare (_, x, y, _), ACCEqual) ->
215215
(XOp (XEq, [v x; v y]), [x; y])
216-
| (Compare (ACCAlways, x, y, _), ACCNotEqual) ->
216+
| (Compare (_, x, y, _), ACCNotEqual) ->
217217
(XOp (XNe, [v x; v y]), [x; y])
218218

219219
(* Occasionally the compiler will generate a a carryset condition for
@@ -292,19 +292,19 @@ let cc_expr
292292
(XOp (XLAnd, [XOp (XLt, [vu x; vu y]);
293293
XOp (XGe, [vu x; zero_constant_expr])]), [x; y])
294294

295-
| (Compare (ACCAlways, x, y, _), ACCUnsignedHigher) ->
295+
| (Compare (_, x, y, _), ACCUnsignedHigher) ->
296296
(XOp (XGt, [vu x; vu y]), [x; y])
297-
| (Compare (ACCAlways, x, y, _), ACCNotUnsignedHigher) ->
297+
| (Compare (_, x, y, _), ACCNotUnsignedHigher) ->
298298
(XOp (XLe, [vu x; vu y]), [x; y])
299299

300-
| (Compare (ACCAlways, x, y, _), ACCSignedGE) ->
300+
| (Compare (_, x, y, _), ACCSignedGE) ->
301301
(XOp (XGe, [v x; v y]), [x; y])
302-
| (Compare (ACCAlways, x, y, _), ACCSignedLT) ->
302+
| (Compare (_, x, y, _), ACCSignedLT) ->
303303
(XOp (XLt, [v x; v y]), [x; y])
304304

305-
| (Compare (ACCAlways, x, y, _), ACCSignedLE) ->
305+
| (Compare (_, x, y, _), ACCSignedLE) ->
306306
(XOp (XLe, [v x; v y]), [x; y])
307-
| (Compare (ACCAlways, x, y, _), ACCSignedGT) ->
307+
| (Compare (_, x, y, _), ACCSignedGT) ->
308308
(XOp (XGt, [v x; v y]), [x; y])
309309

310310
| (LogicalShiftLeft (true, ACCAlways, _, x, y, _), ACCNonNegative) ->
@@ -315,7 +315,7 @@ let cc_expr
315315
| (CompareNegative (ACCAlways, x, y), ACCEqual) ->
316316
(XOp (XEq, [XOp (XPlus, [v x; v y]); zero_constant_expr]), [x; y])
317317

318-
| (CompareNegative (ACCAlways, x, y), ACCNotEqual) ->
318+
| (CompareNegative (_, x, y), ACCNotEqual) ->
319319
(XOp (XNe, [XOp (XPlus, [v x; v y]); zero_constant_expr]), [x; y])
320320

321321
| (CompareNegative (ACCAlways, x, y), ACCCarrySet) ->
@@ -516,4 +516,16 @@ let arm_conditional_conditional_expr
516516
condfloc#set_test_expr xpr;
517517
(frozenVars#toList, Some xpr, opsused)
518518
end
519-
| _ -> (frozenVars#toList, None, opsused)
519+
| _ ->
520+
let _ =
521+
if collect_diagnostics () then
522+
ch_diagnostics_log#add
523+
"unused conditional condition expression"
524+
(LBLOCK [
525+
STR (arm_opcode_to_string condopc);
526+
STR "; ";
527+
STR (arm_opcode_to_string testopc);
528+
STR "; ";
529+
STR (arm_opcode_to_string testtestopc)
530+
]) in
531+
(frozenVars#toList, None, opsused)

0 commit comments

Comments
 (0)