From 7b7231c4177d0b74b05e2ffcd5dd5b6e589d61b3 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. (cherry-picked from master branch) 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 d4cd104a6..a2cad1eba 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);