Add DAG optimisation for FP16_TO_FP
authorOliver Stannard <oliver.stannard@arm.com>
Mon, 24 Aug 2015 09:47:45 +0000 (09:47 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Mon, 24 Aug 2015 09:47:45 +0000 (09:47 +0000)
commit67a54d2081bb40c5e2ba14295b1c6bfd4a66e8c2
tree7222ecb2c39c18de76387686fe81c5a54a37086b
parent3ad50284cbccee22c827d2b21ac2a4704ee4f90c
Add DAG optimisation for FP16_TO_FP

The FP16_TO_FP node only uses the bottom 16 bits of its input, so the
following pattern can be optimised by removing the AND:

  (FP16_TO_FP (AND op, 0xffff)) -> (FP16_TO_FP op)

This is a common pattern for ARM targets when functions have __fp16
arguments, as they are passed as floats (so that they get passed in the
correct registers), but then bitcast and truncated to ignore the top 16
bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245832 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/ARM/fp16-args.ll [new file with mode: 0644]