diff options
author | Sebastian Pop <spop@amazon.com> | 2019-10-08 13:23:57 +0000 |
---|---|---|
committer | Sebastian Pop <spop@amazon.com> | 2019-10-08 13:23:57 +0000 |
commit | d0d52edae92f5705450862561cecfc949d762481 (patch) | |
tree | c9714b6c46a72cc776a2f69f251fd242c8095d2f /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | aa53d6eb01a623254513c7f6ed61e0b3dc083ef4 (diff) | |
download | llvm-d0d52edae92f5705450862561cecfc949d762481.zip llvm-d0d52edae92f5705450862561cecfc949d762481.tar.gz llvm-d0d52edae92f5705450862561cecfc949d762481.tar.bz2 |
fix fmls fp16
Tim Northover remarked that the added patterns for fmls fp16
produce wrong code in case the fsub instruction has a
multiplication as its first operand, i.e., all the patterns FMLSv*_OP1:
> define <8 x half> @test_FMLSv8f16_OP1(<8 x half> %a, <8 x half> %b, <8 x half> %c) {
> ; CHECK-LABEL: test_FMLSv8f16_OP1:
> ; CHECK: fmls {{v[0-9]+}}.8h, {{v[0-9]+}}.8h, {{v[0-9]+}}.8h
> entry:
>
> %mul = fmul fast <8 x half> %c, %b
> %sub = fsub fast <8 x half> %mul, %a
> ret <8 x half> %sub
> }
>
> This doesn't look right to me. The exact instruction produced is "fmls
> v0.8h, v2.8h, v1.8h", which I think calculates "v0 - v2*v1", but the
> IR is calculating "v2*v1-v0". The equivalent <4 x float> code also
> doesn't emit an fmls.
This patch generates an fmla and negates the value of the operand2 of the fsub.
Inspecting the pattern match, I found that there was another mistake in the
opcode to be selected: matching FMULv4*16 should generate FMLSv4*16
and not FMLSv2*32.
Tested on aarch64-linux with make check-all.
Differential Revision: https://reviews.llvm.org/D67990
llvm-svn: 374044
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions