2014-07-18 15:01:19 +02: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
|
2014-07-18 14:41:46 +02: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-27 22:17:42 +01:00
|
|
|
%val = load half, half* %in
|
2014-07-18 14:41:46 +02: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-27 22:17:42 +01:00
|
|
|
%val = load half, half* %addr
|
2014-07-18 14:41:46 +02: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 15:01:19 +02:00
|
|
|
|
|
|
|
define float @test_extend32(half* %addr) {
|
|
|
|
; CHECK-LABEL: test_extend32:
|
|
|
|
|
2015-05-14 03:00:51 +02:00
|
|
|
; CHECK-OLD: b.w ___extendhfsf2
|
2014-07-18 15:01:19 +02:00
|
|
|
; CHECK-F16: vcvtb.f32.f16
|
|
|
|
; CHECK-V8: vcvtb.f32.f16
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16 = load half, half* %addr
|
2014-07-18 15:01:19 +02:00
|
|
|
%val32 = fpext half %val16 to float
|
|
|
|
ret float %val32
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_extend64(half* %addr) {
|
|
|
|
; CHECK-LABEL: test_extend64:
|
|
|
|
|
2016-05-10 21:17:47 +02:00
|
|
|
; CHECK-OLD: bl ___extendhfsf2
|
2014-07-18 15:01:19 +02:00
|
|
|
; CHECK-OLD: vcvt.f64.f32
|
|
|
|
; CHECK-F16: vcvtb.f32.f16
|
|
|
|
; CHECK-F16: vcvt.f64.f32
|
|
|
|
; CHECK-V8: vcvtb.f64.f16
|
2015-02-27 22:17:42 +01:00
|
|
|
%val16 = load half, half* %addr
|
2014-07-18 15:01:19 +02:00
|
|
|
%val32 = fpext half %val16 to double
|
|
|
|
ret double %val32
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @test_trunc32(float %in, half* %addr) {
|
|
|
|
; CHECK-LABEL: test_trunc32:
|
|
|
|
|
2016-05-10 21:17:47 +02:00
|
|
|
; CHECK-OLD: bl ___truncsfhf2
|
2014-07-18 15:01:19 +02:00
|
|
|
; CHECK-F16: vcvtb.f16.f32
|
|
|
|
; CHECK-V8: vcvtb.f16.f32
|
|
|
|
%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-10 21:17:47 +02:00
|
|
|
; CHECK-OLD: bl ___truncdfhf2
|
|
|
|
; CHECK-F16: bl ___truncdfhf2
|
2014-07-18 15:01:19 +02:00
|
|
|
; CHECK-V8: vcvtb.f16.f64
|
|
|
|
%val16 = fptrunc double %in to half
|
|
|
|
store half %val16, half* %addr
|
|
|
|
ret void
|
|
|
|
}
|