diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-01-14 19:45:36 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-01-14 19:45:36 +0000 |
commit | 60b201b662789fb96f63170afe0131d7d0bd08dd (patch) | |
tree | a67ff774e5f3eb0fd35f69f43ae27e5183137085 /llvm/test/CodeGen | |
parent | 3e8d8c7d26684109c115b26da93256a37445cce8 (diff) | |
download | bcm5719-llvm-60b201b662789fb96f63170afe0131d7d0bd08dd.tar.gz bcm5719-llvm-60b201b662789fb96f63170afe0131d7d0bd08dd.zip |
[CodeGen] Don't assume fp_to_fp16 produces i16 when legalizing it.
Since r230276, we support an improved legalization for f64->f16,
which goes through a temporary f32, improving codegen when
f32->f16 is legal but not f64->f16. This requires unsafe-fp-math.
However, that legalization assumed that the second step, producing
a pseudo-softened f16, had type i16. That's not true on targets
with illegal i16, such as ARM.
Use the initial f64->f16 result type instead.
llvm-svn: 257794
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/ARM/fp16.ll | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/ARM/fp16.ll b/llvm/test/CodeGen/ARM/fp16.ll index 73d5c36a9c2..b2454e17042 100644 --- a/llvm/test/CodeGen/ARM/fp16.ll +++ b/llvm/test/CodeGen/ARM/fp16.ll @@ -1,10 +1,16 @@ ; RUN: llc -mtriple=armv7a--none-eabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-HARDFLOAT-EABI %s ; RUN: llc -mtriple=armv7a--none-gnueabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-HARDFLOAT-GNU %s -; RUN: llc -mattr=+vfp3,+fp16 < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FP16 %s ; RUN: llc -mtriple=armv8-eabihf < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-ARMV8 %s ; RUN: llc -mtriple=thumbv7m-eabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-EABI %s ; RUN: llc -mtriple=thumbv7m-gnueabi < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-SOFTFLOAT-GNU %s +;; +fp16 is special: it has f32->f16 (unlike v7), but not f64->f16 (unlike v8). +;; This exposes unsafe-fp-math optimization opportunities; test that. +; RUN: llc -mattr=+vfp3,+fp16 < %s |\ +; RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-FP16 --check-prefix=CHECK-FP16-SAFE %s +; RUN: llc -mattr=+vfp3,+fp16 < %s -enable-unsafe-fp-math |\ +; RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-FP16 --check-prefix=CHECK-FP16-UNSAFE %s + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32" target triple = "armv7---eabihf" @@ -76,7 +82,10 @@ define i16 @test_to_fp16(double %in) { ; CHECK-HARDFLOAT-GNU: bl __aeabi_d2h -; CHECK-FP16: bl __aeabi_d2h +; CHECK-FP16-SAFE: bl __aeabi_d2h + +; CHECK-FP16-UNSAFE: vcvt.f32.f64 s0, d0 +; CHECK-FP16-UNSAFE-NEXT: vcvtb.f16.f32 s0, s0 ; CHECK-ARMV8: vcvtb.f16.f64 [[TMP:s[0-9]+]], d0 ; CHECK-ARMV8: vmov r0, [[TMP]] |