From eb2a9be0c9a9762bbb0a59b33453d58aed885275 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 7 Jan 2016 19:11:42 +0000 Subject: [PATCH] Fix for br999 - incorrect result from binary comparison. When a binary (in)equality comparison has a constant left operand, the tgt-vvp code generator swaps the left and right operands to allow the cmpi instruction to be used. The code for swapping the operands was incorrect. --- tgt-vvp/eval_condit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tgt-vvp/eval_condit.c b/tgt-vvp/eval_condit.c index 59c7a88c6..2e46894ef 100644 --- a/tgt-vvp/eval_condit.c +++ b/tgt-vvp/eval_condit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2014-2016 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -76,8 +76,8 @@ static int draw_condition_binary_compare(ivl_expr_t expr) %cmp instruction. */ if (ivl_expr_width(le)==use_wid && test_immediate_vec4_ok(le)) { ivl_expr_t tmp = le; - re = le; - le = tmp; + le = re; + re = tmp; } draw_eval_vec4(le);