aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/simplify.c
diff options
Diffstat (limited to 'simplify.c')
-rw-r--r--simplify.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/simplify.c b/simplify.c
index db2fba7f..412bfb6a 100644
--- a/simplify.c
+++ b/simplify.c
@@ -591,6 +591,14 @@ static int simplify_seteq_setne(struct instruction *insn, long long value)
return 0;
inverse = (insn->opcode == OP_SET_NE) == value;
+ if (!inverse && def->size == 1) {
+ // Replace:
+ // setne %r <- %s, $0
+ // or:
+ // seteq %r <- %s, $1
+ // by %s when boolean
+ return replace_with_pseudo(insn, old);
+ }
opcode = def->opcode;
switch (opcode) {
case OP_FPCMP ... OP_BINCMP_END: