aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linearize.c
diff options
authorAlexander Viro <viro@www.linux.org.uk>2004-07-23 22:35:40 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:17 -0700
commit5b1132531e902676c9872ffc2ab80ee3aac40aab (patch)
treed4b137f50471c099317d8aab5b76c3c2e30f3847 /linearize.c
parent5023b2c4d6c1251dd4895e10c7eb93f45b20b42e (diff)
downloadsparse-dev-5b1132531e902676c9872ffc2ab80ee3aac40aab.tar.gz
[PATCH] comparison operations fix
simplify_int_binop() was completely broken for comparisons - there the signedness of (converted) arguments can not be obtained from type of result. IOW, we had all comparisons in constant expressions done as signed ones. Fixed by introducing new primitives for unsigned versions of comparions (SPECIAL_UNSIGNED_LT, etc.) and remapping in evaluate_compare() once we know the types. That also fixes similar mess in compile-i386 and linearize.
Diffstat (limited to 'linearize.c')
-rw-r--r--linearize.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/linearize.c b/linearize.c
index 35af2b46..1fdb55bd 100644
--- a/linearize.c
+++ b/linearize.c
@@ -177,6 +177,10 @@ static void show_instruction(struct instruction *insn)
[OP_SET_GE - OP_BINCMP] = "setge",
[OP_SET_LT - OP_BINCMP] = "setlt",
[OP_SET_GT - OP_BINCMP] = "setgt",
+ [OP_SET_BE - OP_BINCMP] = "setbe",
+ [OP_SET_AE - OP_BINCMP] = "setae",
+ [OP_SET_A - OP_BINCMP] = "seta",
+ [OP_SET_B - OP_BINCMP] = "setb",
};
printf("\t%%r%d <- %s %%r%d, %%r%d\n",
insn->target->nr,
@@ -602,6 +606,10 @@ static pseudo_t linearize_compare(struct entrypoint *ep, struct expression *expr
[SPECIAL_NOTEQUAL] = OP_SET_NE,
[SPECIAL_GTE] = OP_SET_GE,
[SPECIAL_LTE] = OP_SET_LE,
+ [SPECIAL_UNSIGNED_LT] = OP_SET_B,
+ [SPECIAL_UNSIGNED_GT] = OP_SET_A,
+ [SPECIAL_UNSIGNED_LTE] = OP_SET_BE,
+ [SPECIAL_UNSIGNED_GTE] = OP_SET_AE,
};
pseudo_t src1 = linearize_expression(ep, expr->left);