1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/lib/Target/ARM/MCTargetDesc
Sjoerd Meijer 77cd5c40d2 [ARM] Armv8.2-A FP16 code generation (part 1/3)
This is the groundwork for Armv8.2-A FP16 code generation .

Clang passes and returns _Float16 values as floats, together with the required
bitconverts and truncs etc. to implement correct AAPCS behaviour, see D42318.
We will implement half-precision argument passing/returning lowering in the ARM
backend soon, but for now this means that this:

_Float16 sub(_Float16 a, _Float16 b) {
  return a + b;
}

gets lowered to this:

define float @sub(float %a.coerce, float %b.coerce) {
entry:
  %0 = bitcast float %a.coerce to i32
  %tmp.0.extract.trunc = trunc i32 %0 to i16
  %1 = bitcast i16 %tmp.0.extract.trunc to half
  <SNIP>
  %add = fadd half %1, %3
  <SNIP>
}

When FullFP16 is *not* supported, we don't make f16 a legal type, and we get
legalization for "free", i.e. nothing changes and everything works as before.
And also f16 argument passing/returning is handled.

When FullFP16 is supported, we do make f16 a legal type, and have 2 places that
we need to patch up: f16 argument passing and returning, which involves minor
tweaks to avoid unnecessary code generation for some bitcasts.

As a "demonstrator" that this works for the different FP16, FullFP16, softfp
modes, etc., I've added match rules to the VSUB instruction description showing
that we can codegen this instruction from IR, but more importantly, also to
some conversion instructions. These conversions were causing issue before in
the FP16 and FullFP16 cases.

I've also added match rules to the VLDRH and VSTRH desriptions, so that we can
actually compile the entire half-precision sub code example above. This showed
that these loads and stores had the wrong addressing mode specified: AddrMode5
instead of AddrMode5FP16, which turned out not be implemented at all, so that
has also been added.

This is the minimal patch that shows all the different moving parts. In patch
2/3 I will add some efficient lowering of bitcasts, and in 2/3 I will add the
remaining Armv8.2-A FP16 instruction descriptions.


Thanks to Sam Parker and Oliver Stannard for their help and reviews!


Differential Revision: https://reviews.llvm.org/D38315

llvm-svn: 323512
2018-01-26 09:26:40 +00:00
..
ARMAddressingModes.h ARMAddressingModes.h: Don't mark header functions as file local 2017-10-24 21:29:21 +00:00
ARMAsmBackend.cpp [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMAsmBackend.h [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMAsmBackendDarwin.h [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMAsmBackendELF.h [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMAsmBackendWinCOFF.h [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMBaseInfo.h [ARM] Armv8.2-A FP16 code generation (part 1/3) 2018-01-26 09:26:40 +00:00
ARMELFObjectWriter.cpp [MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriter 2017-10-10 16:28:07 +00:00
ARMELFStreamer.cpp [ARM] Fix endianness of Thumb .inst.w directive 2018-01-04 13:56:40 +00:00
ARMFixupKinds.h Don't repeat names and reformat. NFC. 2017-06-28 16:00:16 +00:00
ARMMachObjectWriter.cpp [MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriter 2017-10-10 16:28:07 +00:00
ARMMachORelocationInfo.cpp Remove redundant includes from lib/Target/ARM. 2017-12-13 21:31:17 +00:00
ARMMCAsmInfo.cpp [ARM] Use SEH exceptions on thumbv7-windows 2017-11-21 11:30:20 +00:00
ARMMCAsmInfo.h
ARMMCCodeEmitter.cpp [ARM] Support fixup for Thumb2 modified immediate 2017-06-05 09:37:12 +00:00
ARMMCExpr.cpp Remove redundant includes from lib/Target/ARM. 2017-12-13 21:31:17 +00:00
ARMMCExpr.h
ARMMCTargetDesc.cpp [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr. 2017-10-11 23:34:47 +00:00
ARMMCTargetDesc.h [ARM][NFC] Avoid recreating MCSubtargetInfo in ARMAsmBackend 2018-01-03 13:46:21 +00:00
ARMTargetStreamer.cpp [TargetParser] Use enum classes for various ARM kind enums. 2017-07-27 16:27:56 +00:00
ARMUnwindOpAsm.cpp
ARMUnwindOpAsm.h
ARMWinCOFFObjectWriter.cpp [MC] Thread unique_ptr<MCObjectWriter> through the create.*ObjectWriter 2017-10-10 16:28:07 +00:00
ARMWinCOFFStreamer.cpp [ARM] Use dwarf exception handling on MinGW 2017-11-17 08:04:40 +00:00
CMakeLists.txt
LLVMBuild.txt