diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-10-13 20:45:49 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-10-13 20:45:49 +0000 |
| commit | 550c66d10f42e28325ccc738760f91fc51630d94 (patch) | |
| tree | 60c9cf34c9fdb795f9ebac41609af8faf765ad06 /llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | |
| parent | 649c585710df40c22765fcc1822cc2d0f0ebb4c2 (diff) | |
| download | bcm5719-llvm-550c66d10f42e28325ccc738760f91fc51630d94.tar.gz bcm5719-llvm-550c66d10f42e28325ccc738760f91fc51630d94.zip | |
AMDGPU: Look for src mods before fp_extend
When selecting modifiers for mad_mix instructions,
look at fneg/fabs that occur before the conversion.
llvm-svn: 315748
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp index b74b2c216b5..0d410c29ed4 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp @@ -1982,15 +1982,31 @@ bool AMDGPUDAGToDAGISel::SelectVOP3PMadMixModsImpl(SDValue In, SDValue &Src, assert(Src.getValueType() == MVT::f16); Src = stripBitcast(Src); + // Be careful about folding modifiers if we already have an abs. fneg is + // applied last, so we don't want to apply an earlier fneg. + if ((Mods & SISrcMods::ABS) == 0) { + unsigned ModsTmp; + SelectVOP3ModsImpl(Src, Src, ModsTmp); + + if ((ModsTmp & SISrcMods::NEG) != 0) + Mods ^= SISrcMods::NEG; + + if ((ModsTmp & SISrcMods::ABS) != 0) + Mods |= SISrcMods::ABS; + } + // op_sel/op_sel_hi decide the source type and source. // If the source's op_sel_hi is set, it indicates to do a conversion from fp16. // If the sources's op_sel is set, it picks the high half of the source // register. Mods |= SISrcMods::OP_SEL_1; - if (isExtractHiElt(Src, Src)) + if (isExtractHiElt(Src, Src)) { Mods |= SISrcMods::OP_SEL_0; + // TODO: Should we try to look for neg/abs here? + } + return true; } |

