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.
This commit is contained in:
Martin Whitaker 2016-01-07 19:11:42 +00:00
parent d7b919f6d0
commit 7b7231c417
1 changed files with 3 additions and 3 deletions

View File

@ -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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * 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. */ %cmp instruction. */
if (ivl_expr_width(le)==use_wid && test_immediate_vec4_ok(le)) { if (ivl_expr_width(le)==use_wid && test_immediate_vec4_ok(le)) {
ivl_expr_t tmp = le; ivl_expr_t tmp = le;
re = le; le = re;
le = tmp; re = tmp;
} }
draw_eval_vec4(le); draw_eval_vec4(le);