aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c2
-rw-r--r--validation/optim/call-inlined.c11
-rw-r--r--validation/optim/select-self-zero.c1
3 files changed, 5 insertions, 9 deletions
diff --git a/simplify.c b/simplify.c
index 95ccd4c0..6713e8af 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1778,6 +1778,8 @@ static int simplify_select(struct instruction *insn)
}
if (cond == src2 && is_zero(src1)) // SEL(x, 0, x) --> 0
return replace_with_pseudo(insn, src1);
+ if (cond == src1 && is_zero(src2)) // SEL(x, x, 0) --> x
+ return replace_with_pseudo(insn, cond);
switch (DEF_OPCODE(def, cond)) {
case OP_SET_EQ:
diff --git a/validation/optim/call-inlined.c b/validation/optim/call-inlined.c
index f21b3294..7f5f4e89 100644
--- a/validation/optim/call-inlined.c
+++ b/validation/optim/call-inlined.c
@@ -18,13 +18,6 @@ int foo(int a, int b, int p)
* check-name: call-inlined
* check-command: test-linearize -Wno-decl $file
*
- * check-output-start
-foo:
-.L0:
- <entry-point>
- select.32 %r10 <- %arg3, %arg3, $0
- ret.32 %r10
-
-
- * check-output-end
+ * check-output-ignore
+ * check-output-returns: %arg3
*/
diff --git a/validation/optim/select-self-zero.c b/validation/optim/select-self-zero.c
index ea309894..73b3a3dc 100644
--- a/validation/optim/select-self-zero.c
+++ b/validation/optim/select-self-zero.c
@@ -1,4 +1,5 @@
int sel_self0x(int x) { return (x ? 0 : x) == 0; }
+int sel_selfx0(int x) { return (x ? x : 0) == x; }
/*
* check-name: select-self-zero