]>
Commit | Line | Data |
---|---|---|
7d3d7cb5 JB |
1 | Description: Fix self-test fail in some conditions |
2 | ||
3 | Reverts upstream 81755054c4c19d821e58456a1a7d601806e60e92 | |
4 | ||
5 | Known triggers are Darktable and the GEGL test suite | |
6 | ||
7 | Note that this does *not* fix the other Darktable issue | |
8 | (https://gitlab.freedesktop.org/beignet/beignet/issues/60): beignet still | |
9 | needs to be blacklisted in Darktable (which it is by default). | |
10 | ||
11 | Author: Rebecca N. Palmer <rebecca_palmer@zoho.com> | |
12 | Bug: https://gitlab.freedesktop.org/beignet/beignet/issues/7 | |
13 | Bug-Debian: https://bugs.debian.org/885423 | |
14 | Forwarded: https://lists.freedesktop.org/archives/beignet/2019-January/009227.html | |
15 | ||
16 | diff --git b/backend/src/backend/gen_insn_selection_optimize.cpp a/backend/src/backend/gen_insn_selection_optimize.cpp | |
17 | index 07547ec4..d2e0fb9b 100644 | |
18 | --- b/backend/src/backend/gen_insn_selection_optimize.cpp | |
19 | +++ a/backend/src/backend/gen_insn_selection_optimize.cpp | |
20 | @@ -74,7 +74,8 @@ namespace gbe | |
21 | const GenRegister& replacement) : | |
22 | insn(insn), intermedia(intermedia), replacement(replacement) | |
23 | { | |
24 | - assert(insn.opcode == SEL_OP_MOV || insn.opcode == SEL_OP_ADD); | |
25 | + assert(insn.opcode == SEL_OP_MOV); | |
26 | + assert(&(insn.src(0)) == &replacement); | |
27 | assert(&(insn.dst(0)) == &intermedia); | |
28 | this->elements = CalculateElements(intermedia, insn.state.execWidth); | |
29 | replacementOverwritten = false; | |
30 | @@ -101,7 +102,6 @@ namespace gbe | |
31 | void doReplacement(ReplaceInfo* info); | |
32 | bool CanBeReplaced(const ReplaceInfo* info, const SelectionInstruction& insn, const GenRegister& var); | |
33 | void cleanReplaceInfoMap(); | |
34 | - void doNegAddOptimization(SelectionInstruction &insn); | |
35 | ||
36 | SelectionBlock &bb; | |
37 | const ir::Liveness::LiveOut& liveout; | |
38 | @@ -159,13 +159,8 @@ namespace gbe | |
39 | ||
40 | void SelBasicBlockOptimizer::addToReplaceInfoMap(SelectionInstruction& insn) | |
41 | { | |
42 | - assert(insn.opcode == SEL_OP_MOV || insn.opcode == SEL_OP_ADD); | |
43 | - GenRegister &src = insn.src(0); | |
44 | - if (insn.opcode == SEL_OP_ADD) { | |
45 | - if (src.file == GEN_IMMEDIATE_VALUE) | |
46 | - src = insn.src(1); | |
47 | - } | |
48 | - | |
49 | + assert(insn.opcode == SEL_OP_MOV); | |
50 | + const GenRegister& src = insn.src(0); | |
51 | const GenRegister& dst = insn.dst(0); | |
52 | if (src.type != dst.type || src.file != dst.file) | |
53 | return; | |
54 | @@ -254,29 +249,10 @@ namespace gbe | |
55 | ||
56 | if (insn.opcode == SEL_OP_MOV) | |
57 | addToReplaceInfoMap(insn); | |
58 | - | |
59 | - doNegAddOptimization(insn); | |
60 | } | |
61 | cleanReplaceInfoMap(); | |
62 | } | |
63 | ||
64 | - /* LLVM transform Mad(a, -b, c) to | |
65 | - Add b, -b, 0 | |
66 | - Mad val, a, b, c | |
67 | - for Gen support negtive modifier, mad(a, -b, c) is native suppoted. | |
68 | - Also it can be used for the same like instruction sequence. | |
69 | - Do it just like a: mov b, -b, so it is a Mov operation like LocalCopyPropagation | |
70 | - */ | |
71 | - void SelBasicBlockOptimizer::doNegAddOptimization(SelectionInstruction &insn) { | |
72 | - if (insn.opcode == SEL_OP_ADD) { | |
73 | - GenRegister src0 = insn.src(0); | |
74 | - GenRegister src1 = insn.src(1); | |
75 | - if ((src0.negation && src1.file == GEN_IMMEDIATE_VALUE && src1.value.f == 0.0f) || | |
76 | - (src1.negation && src0.file == GEN_IMMEDIATE_VALUE && src0.value.f == 0.0f)) | |
77 | - addToReplaceInfoMap(insn); | |
78 | - } | |
79 | - } | |
80 | - | |
81 | void SelBasicBlockOptimizer::run() | |
82 | { | |
83 | for (size_t i = 0; i < MaxTries; ++i) { |