aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/fp16.ll
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2016-01-14 19:45:36 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2016-01-14 19:45:36 +0000
commit51eefd689ed3d8d1996be80381301a6c5bc19c77 (patch)
tree2449cb37176ce8ab6423ca3c1a7e38dfcd3e8225 /test/CodeGen/ARM/fp16.ll
parent5100764a56b76ea3c54aa752a98b66734750c6d2 (diff)
downloadllvm-51eefd689ed3d8d1996be80381301a6c5bc19c77.tar.gz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257794 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/fp16.ll')
-rw-r--r--test/CodeGen/ARM/fp16.ll13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/CodeGen/ARM/fp16.ll b/test/CodeGen/ARM/fp16.ll
index 73d5c36a9c2..b2454e17042 100644
--- a/test/CodeGen/ARM/fp16.ll
+++ b/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]]