2014-07-18 21:01:19 +08:00
|
|
|
; RUN: llc < %s -mtriple=thumbv7-apple-ios7.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-OLD
|
|
|
|
; RUN: llc < %s -mtriple=thumbv7s-apple-ios7.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-F16
|
|
|
|
; RUN: llc < %s -mtriple=thumbv8-apple-ios7.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V8
|
2018-09-13 00:24:43 +08:00
|
|
|
; RUN: llc < %s -mtriple=armv8r-none-none-eabi | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V8
|
[ARM] Replace fp-only-sp and d16 with fp64 and d32.
Those two subtarget features were awkward because their semantics are
reversed: each one indicates the _lack_ of support for something in
the architecture, rather than the presence. As a consequence, you
don't get the behavior you want if you combine two sets of feature
bits.
Each SubtargetFeature for an FP architecture version now comes in four
versions, one for each combination of those options. So you can still
say (for example) '+vfp2' in a feature string and it will mean what
it's always meant, but there's a new string '+vfp2d16sp' meaning the
version without those extra options.
A lot of this change is just mechanically replacing positive checks
for the old features with negative checks for the new ones. But one
more interesting change is that I've rearranged getFPUFeatures() so
that the main FPU feature is appended to the output list *before*
rather than after the features derived from the Restriction field, so
that -fp64 and -d32 can override defaults added by the main feature.
Reviewers: dmgreen, samparker, SjoerdMeijer
Subscribers: srhines, javed.absar, eraman, kristof.beyls, hiraditya, zzheng, Petar.Avramovic, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D60691
llvm-svn: 361845
2019-05-29 00:13:20 +08:00
|
|
|
; RUN: llc < %s -mtriple=armv8r-none-none-eabi -mattr=-fp64 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V8-SP
|
[ARM] Explicit lowering of half <-> double conversions.
If an FP_EXTEND or FP_ROUND isel dag node converts directly between
f16 and f32 when the target CPU has no instruction to do it in one go,
it has to be done in two steps instead, going via f32.
Previously, this was done implicitly, because all such CPUs had the
storage-only implementation of f16 (i.e. the only thing you can do
with one at all is to convert it to/from f32). So isel would legalize
the f16 into an f32 as soon as it saw it, by inserting an fp16_to_fp
node (or vice versa), and then the fp_extend would already be f32->f64
rather than f16->f64.
But that technique can't support a target CPU which has full f16
support but _not_ f64, such as some variants of Arm v8.1-M. So now we
provide custom lowering for FP_EXTEND and FP_ROUND, which checks
support for f16 and f64 and decides on the best thing to do given the
combination of flags it gets back.
Reviewers: dmgreen, samparker, SjoerdMeijer
Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60692
llvm-svn: 364294
2019-06-25 19:24:50 +08:00
|
|
|
; RUN: llc < %s -mtriple=armv8.1m-none-none-eabi -mattr=+fp-armv8 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V8
|
|
|
|
; RUN: llc < %s -mtriple=armv8.1m-none-none-eabi -mattr=+fp-armv8,-fp64 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V8-SP
|
|
|
|
; RUN: llc < %s -mtriple=armv8.1m-none-none-eabi -mattr=+mve.fp,+fp64 | FileCheck %s --check-prefix=CHECK-V8
|
|
|
|
; RUN: llc < %s -mtriple=armv8.1m-none-none-eabi -mattr=+mve.fp | FileCheck %s --check-prefix=CHECK-V8-SP
|
2014-07-18 20:41:46 +08:00
|
|
|
|
|
|
|
define void @test_load_store(half* %in, half* %out) {
|
|
|
|
; CHECK-LABEL: test_load_store:
|
|
|
|
; CHECK: ldrh [[TMP:r[0-9]+]], [r0]
|
|
|
|
; CHECK: strh [[TMP]], [r1]
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load half, half* %in
|
2014-07-18 20:41:46 +08:00
|
|
|
store half %val, half* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define i16 @test_bitcast_from_half(half* %addr) {
|
|
|
|
; CHECK-LABEL: test_bitcast_from_half:
|
|
|
|
; CHECK: ldrh r0, [r0]
|
2015-02-28 05:17:42 +08:00
|
|
|
%val = load half, half* %addr
|
2014-07-18 20:41:46 +08:00
|
|
|
%val_int = bitcast half %val to i16
|
|
|
|
ret i16 %val_int
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test_bitcast_to_half(half* %addr, i16 %in) {
|
|
|
|
; CHECK-LABEL: test_bitcast_to_half:
|
|
|
|
; CHECK: strh r1, [r0]
|
|
|
|
%val_fp = bitcast i16 %in to half
|
|
|
|
store half %val_fp, half* %addr
|
|
|
|
ret void
|
|
|
|
}
|
2014-07-18 21:01:19 +08:00
|
|
|
|
|
|
|
define float @test_extend32(half* %addr) {
|
|
|
|
; CHECK-LABEL: test_extend32:
|
|
|
|
|
2015-05-14 09:00:51 +08:00
|
|
|
; CHECK-OLD: b.w ___extendhfsf2
|
2014-07-18 21:01:19 +08:00
|
|
|
; CHECK-F16: vcvtb.f32.f16
|
|
|
|
; CHECK-V8: vcvtb.f32.f16
|
2018-09-13 00:24:43 +08:00
|
|
|
; CHECK-V8-SP: vcvtb.f32.f16
|
2015-02-28 05:17:42 +08:00
|
|
|
%val16 = load half, half* %addr
|
2014-07-18 21:01:19 +08:00
|
|
|
%val32 = fpext half %val16 to float
|
|
|
|
ret float %val32
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_extend64(half* %addr) {
|
|
|
|
; CHECK-LABEL: test_extend64:
|
|
|
|
|
2016-05-11 03:17:47 +08:00
|
|
|
; CHECK-OLD: bl ___extendhfsf2
|
2014-07-18 21:01:19 +08:00
|
|
|
; CHECK-OLD: vcvt.f64.f32
|
|
|
|
; CHECK-F16: vcvtb.f32.f16
|
|
|
|
; CHECK-F16: vcvt.f64.f32
|
|
|
|
; CHECK-V8: vcvtb.f64.f16
|
2018-09-13 00:24:43 +08:00
|
|
|
; CHECK-V8-SP: vcvtb.f32.f16
|
|
|
|
; CHECK-V8-SP: bl __aeabi_f2d
|
2015-02-28 05:17:42 +08:00
|
|
|
%val16 = load half, half* %addr
|
2014-07-18 21:01:19 +08:00
|
|
|
%val32 = fpext half %val16 to double
|
|
|
|
ret double %val32
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test_trunc32(float %in, half* %addr) {
|
|
|
|
; CHECK-LABEL: test_trunc32:
|
|
|
|
|
2016-05-11 03:17:47 +08:00
|
|
|
; CHECK-OLD: bl ___truncsfhf2
|
2014-07-18 21:01:19 +08:00
|
|
|
; CHECK-F16: vcvtb.f16.f32
|
|
|
|
; CHECK-V8: vcvtb.f16.f32
|
2018-09-13 00:24:43 +08:00
|
|
|
; CHECK-V8-SP: vcvtb.f16.f32
|
2014-07-18 21:01:19 +08:00
|
|
|
%val16 = fptrunc float %in to half
|
|
|
|
store half %val16, half* %addr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test_trunc64(double %in, half* %addr) {
|
|
|
|
; CHECK-LABEL: test_trunc64:
|
|
|
|
|
2016-05-11 03:17:47 +08:00
|
|
|
; CHECK-OLD: bl ___truncdfhf2
|
|
|
|
; CHECK-F16: bl ___truncdfhf2
|
2014-07-18 21:01:19 +08:00
|
|
|
; CHECK-V8: vcvtb.f16.f64
|
2018-09-13 00:24:43 +08:00
|
|
|
; CHECK-V8-SP: bl __aeabi_d2h
|
2014-07-18 21:01:19 +08:00
|
|
|
%val16 = fptrunc double %in to half
|
|
|
|
store half %val16, half* %addr
|
|
|
|
ret void
|
|
|
|
}
|