aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--cse.c11
-rw-r--r--validation/optim/cse-setfval.c12
2 files changed, 23 insertions, 0 deletions
diff --git a/cse.c b/cse.c
index 6987645c..269f03ba 100644
--- a/cse.c
+++ b/cse.c
@@ -90,6 +90,10 @@ static void clean_up_one_instruction(struct basic_block *bb, struct instruction
hash += hashval(insn->val);
break;
+ case OP_SETFVAL:
+ hash += hashval(insn->fvalue);
+ break;
+
case OP_SYMADDR:
hash += hashval(insn->symbol);
break;
@@ -179,6 +183,7 @@ static int insn_compare(const void *_i1, const void *_i2)
{
const struct instruction *i1 = _i1;
const struct instruction *i2 = _i2;
+ int diff;
if (i1->opcode != i2->opcode)
return i1->opcode < i2->opcode ? -1 : 1;
@@ -242,6 +247,12 @@ static int insn_compare(const void *_i1, const void *_i2)
return i1->val < i2->val ? -1 : 1;
break;
+ case OP_SETFVAL:
+ diff = memcmp(&i1->fvalue, &i2->fvalue, sizeof(i1->fvalue));
+ if (diff)
+ return diff;
+ break;
+
/* Other */
case OP_PHI:
return phi_list_compare(i1->phi_list, i2->phi_list);
diff --git a/validation/optim/cse-setfval.c b/validation/optim/cse-setfval.c
new file mode 100644
index 00000000..15ff67d0
--- /dev/null
+++ b/validation/optim/cse-setfval.c
@@ -0,0 +1,12 @@
+int ftest(double a, double b)
+{
+ return a == 0.125 || b == 0.125;
+}
+
+/*
+ * check-name: CSE OP_SETFVAL
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-pattern(1): setfval\\.
+ */