From e6a5a50a41ad84093d66a81994a8b0d276baa113 Mon Sep 17 00:00:00 2001 From: Sebastian Buchwald Date: Fri, 19 Aug 2011 14:07:11 +0200 Subject: [PATCH] Bugfix: Added special case for x mod 1. --- ir/ir/irarch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ir/ir/irarch.c b/ir/ir/irarch.c index ad1841c72..7b30379d4 100644 --- a/ir/ir/irarch.c +++ b/ir/ir/irarch.c @@ -1051,7 +1051,13 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) k = tv_ld2(tv, n); } - if (k >= 0) { + /* k == 0 i.e. modulo by 1 */ + if (k == 0) { + ir_graph *irg = get_irn_irg(irn); + + res = new_r_Const(irg, get_mode_null(mode)); + } + else if (k > 0) { ir_graph *irg = get_irn_irg(irn); /* division by 2^k or -2^k: * we use "modulus" here, so x % y == x % -y that's why is no difference between the case 2^k and -2^k -- 2.20.1