diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-01 16:51:30 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-05 23:26:04 +0000 |
commit | c7a6df4638de16299d9a621db31c9ee68e4addf6 (patch) | |
tree | c593e4051f6c473d47e963e76def1ed16f91a04e /src/panfrost/bifrost | |
parent | 5f48caf98ba536b9ed753f445ebf5488dc465f46 (diff) |
pan/bi: Fix negation in ADD.v2f16
When we flip the sources we need to flip the negates as well to stay
consistent.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>
Diffstat (limited to 'src/panfrost/bifrost')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 8e83358e546..8f006edebe0 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -553,37 +553,26 @@ bi_pack_fma_addmin_f16(bi_instruction *ins, struct bi_registers *regs) unsigned src_0 = bi_get_src(ins, regs, 0, true); unsigned src_1 = bi_get_src(ins, regs, 1, true); bool l = false; + bool flip = false; if (!abs_0 && !abs_1) { /* Force k = 0 <===> NOT(src1 < src0) <==> src1 >= src0 */ - if (src_0 < src_1) { - unsigned tmp = src_0; - src_0 = src_1; - src_1 = tmp; - } + flip = (src_0 < src_1); } else if (abs_0 && !abs_1) { l = src_1 >= src_0; } else if (abs_1 && !abs_0) { - unsigned tmp = src_0; - src_0 = src_1; - src_0 = tmp; - - l = src_1 >= src_0; + flip = true; + l = src_0 >= src_1; } else { - if (src_0 >= src_1) { - unsigned tmp = src_0; - src_0 = src_1; - src_1 = tmp; - } - + flip = (src_0 >= src_1); l = true; } struct bifrost_fma_add_minmax16 pack = { - .src0 = src_0, - .src1 = src_1, - .src0_neg = ins->src_neg[0], - .src1_neg = ins->src_neg[1], + .src0 = flip ? src_1 : src_0, + .src1 = flip ? src_0 : src_1, + .src0_neg = ins->src_neg[flip ? 1 : 0], + .src1_neg = ins->src_neg[flip ? 0 : 1], .abs1 = l, .outmod = ins->outmod, .mode = (ins->type == BI_ADD) ? ins->roundmode : ins->minmax, |