1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck %s
2 ; RUN: llc < %s -O0 -fast-isel -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck %s
3 ; RUN: llc < %s -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel* \
4 ; RUN: -mtriple=arm64-eabi -aarch64-neon-syntax=apple \
5 ; RUN: | FileCheck %s --check-prefixes=GISEL,FALLBACK
7 ; FALLBACK-NOT: remark{{.*}}G_FPEXT{{.*}}(in function: test_vcvt_f64_f32)
8 ; FALLBACK-NOT: remark{{.*}}fpext{{.*}}(in function: test_vcvt_f64_f32)
9 define <2 x double> @test_vcvt_f64_f32(<2 x float> %x) nounwind readnone ssp {
10 ; CHECK-LABEL: test_vcvt_f64_f32:
11 ; GISEL-LABEL: test_vcvt_f64_f32:
12 %vcvt1.i = fpext <2 x float> %x to <2 x double>
13 ; CHECK: fcvtl v0.2d, v0.2s
14 ; GISEL: fcvtl v0.2d, v0.2s
15 ret <2 x double> %vcvt1.i
20 ; FALLBACK-NOT: remark{{.*}}G_FPEXT{{.*}}(in function: test_vcvt_high_f64_f32)
21 ; FALLBACK-NOT: remark{{.*}}fpext{{.*}}(in function: test_vcvt_high_f64_f32)
22 define <2 x double> @test_vcvt_high_f64_f32(<4 x float> %x) nounwind readnone ssp {
23 ; CHECK-LABEL: test_vcvt_high_f64_f32:
24 ; GISEL-LABEL: test_vcvt_high_f64_f32:
25 %cvt_in = shufflevector <4 x float> %x, <4 x float> undef, <2 x i32> <i32 2, i32 3>
26 %vcvt1.i = fpext <2 x float> %cvt_in to <2 x double>
27 ; CHECK: fcvtl2 v0.2d, v0.4s
28 ; GISEL: fcvtl2 v0.2d, v0.4s
29 ret <2 x double> %vcvt1.i
34 ; FALLBACK-NOT: remark{{.*}}G_FPEXT{{.*}}(in function: test_vcvt_f32_f64)
35 ; FALLBACK-NOT: remark{{.*}}fpext{{.*}}(in function: test_vcvt_f32_f64)
36 define <2 x float> @test_vcvt_f32_f64(<2 x double> %v) nounwind readnone ssp {
37 ; CHECK-LABEL: test_vcvt_f32_f64:
38 ; GISEL-LABEL: test_vcvt_f32_f64:
39 %vcvt1.i = fptrunc <2 x double> %v to <2 x float>
42 ret <2 x float> %vcvt1.i
47 ; FALLBACK-NOT: remark{{.*}}G_FPEXT{{.*}}(in function: test_vcvt_high_f32_f64)
48 ; FALLBACK-NOT: remark{{.*}}fpext{{.*}}(in function: test_vcvt_high_f32_f64)
49 define <4 x float> @test_vcvt_high_f32_f64(<2 x float> %x, <2 x double> %v) nounwind readnone ssp {
50 ; CHECK-LABEL: test_vcvt_high_f32_f64:
51 ; GISEL-LABEL: test_vcvt_high_f32_f64:
52 %cvt = fptrunc <2 x double> %v to <2 x float>
53 %vcvt2.i = shufflevector <2 x float> %x, <2 x float> %cvt, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
56 ret <4 x float> %vcvt2.i
61 define <2 x float> @test_vcvtx_f32_f64(<2 x double> %v) nounwind readnone ssp {
62 ; CHECK-LABEL: test_vcvtx_f32_f64:
63 %vcvtx1.i = tail call <2 x float> @llvm.aarch64.neon.fcvtxn.v2f32.v2f64(<2 x double> %v) nounwind
65 ret <2 x float> %vcvtx1.i
69 define <4 x float> @test_vcvtx_high_f32_f64(<2 x float> %x, <2 x double> %v) nounwind readnone ssp {
70 ; CHECK-LABEL: test_vcvtx_high_f32_f64:
71 %vcvtx2.i = tail call <2 x float> @llvm.aarch64.neon.fcvtxn.v2f32.v2f64(<2 x double> %v) nounwind
72 %res = shufflevector <2 x float> %x, <2 x float> %vcvtx2.i, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
79 declare <2 x double> @llvm.aarch64.neon.vcvthighfp2df(<4 x float>) nounwind readnone
80 declare <2 x double> @llvm.aarch64.neon.vcvtfp2df(<2 x float>) nounwind readnone
82 declare <2 x float> @llvm.aarch64.neon.vcvtdf2fp(<2 x double>) nounwind readnone
83 declare <4 x float> @llvm.aarch64.neon.vcvthighdf2fp(<2 x float>, <2 x double>) nounwind readnone
85 declare <2 x float> @llvm.aarch64.neon.fcvtxn.v2f32.v2f64(<2 x double>) nounwind readnone
87 define i16 @to_half(float %in) {
88 ; CHECK-LABEL: to_half:
89 ; CHECK: fcvt h[[HALFVAL:[0-9]+]], s0
90 ; CHECK: fmov {{w[0-9]+}}, {{s[0-9]+}}
91 %res = call i16 @llvm.convert.to.fp16.f32(float %in)
95 define float @from_half(i16 %in) {
96 ; CHECK-LABEL: from_half:
97 ; CHECK: fmov {{s[0-9]+}}, {{w[0-9]+}}
98 ; CHECK: fcvt s0, {{h[0-9]+}}
99 %res = call float @llvm.convert.from.fp16.f32(i16 %in)
103 declare float @llvm.convert.from.fp16.f32(i16) #1
104 declare i16 @llvm.convert.to.fp16.f32(float) #1