diff mbox series

[1/9] change testing of signed compares against SMIN or SMAX

Message ID 20210310214950.84192-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series simplify CMP(AND(x,M), C) and CMP(OR(x,M), C) | expand

Commit Message

Luc Van Oostenryck March 10, 2021, 9:49 p.m. UTC
These tests are written by testing if the comparisons are equal
to their expected value: 0 or 1. So, a compare of a compare
but such compares of compare have their own simplification
which defeats what's tested here.

So, rewrite the test to avoid such compares of compare.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/optim/cmps-minmax.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/validation/optim/cmps-minmax.c b/validation/optim/cmps-minmax.c
index 5802cdbcafd1..0b1a0a099d7d 100644
--- a/validation/optim/cmps-minmax.c
+++ b/validation/optim/cmps-minmax.c
@@ -1,11 +1,11 @@ 
 #define SMAX __INT_MAX__
 #define SMIN (-__INT_MAX__-1)
 
-int lt_smin(int a) { return (a <  SMIN) == 0; }
-int le_smax(int a) { return (a <= SMAX) == 1; }
+int lt_smin(int a) { return (a <  SMIN) + 1; }
+int le_smax(int a) { return (a <= SMAX) + 0; }
 
-int ge_smin(int a) { return (a >= SMIN) == 1; }
-int gt_smax(int a) { return (a >  SMAX) == 0; }
+int ge_smin(int a) { return (a >= SMIN) + 0; }
+int gt_smax(int a) { return (a >  SMAX) + 1; }
 
 /*
  * check-name: cmps-minmax