llvm.org GIT mirror llvm / 1a8bcdb
AArch64: support f16 extend/trunc operations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213375 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 6 years ago
2 changed file(s) with 37 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
304304
305305 // AArch64 does not have floating-point extending loads, i1 sign-extending
306306 // load, floating-point truncating stores, or v2i32->v2i16 truncating store.
307 setLoadExtAction(ISD::EXTLOAD, MVT::f16, Expand);
307308 setLoadExtAction(ISD::EXTLOAD, MVT::f32, Expand);
308309 setLoadExtAction(ISD::EXTLOAD, MVT::f64, Expand);
309310 setLoadExtAction(ISD::EXTLOAD, MVT::f80, Expand);
2323 store half %val_fp, half* %addr
2424 ret void
2525 }
26
27 define float @test_extend32(half* %addr) {
28 ; CHECK-LABEL: test_extend32:
29 ; CHECK: fcvt {{s[0-9]+}}, {{h[0-9]+}}
30
31 %val16 = load half* %addr
32 %val32 = fpext half %val16 to float
33 ret float %val32
34 }
35
36 define double @test_extend64(half* %addr) {
37 ; CHECK-LABEL: test_extend64:
38 ; CHECK: fcvt {{d[0-9]+}}, {{h[0-9]+}}
39
40 %val16 = load half* %addr
41 %val32 = fpext half %val16 to double
42 ret double %val32
43 }
44
45 define void @test_trunc32(float %in, half* %addr) {
46 ; CHECK-LABEL: test_trunc32:
47 ; CHECK: fcvt {{h[0-9]+}}, {{s[0-9]+}}
48
49 %val16 = fptrunc float %in to half
50 store half %val16, half* %addr
51 ret void
52 }
53
54 define void @test_trunc64(double %in, half* %addr) {
55 ; CHECK-LABEL: test_trunc64:
56 ; CHECK: fcvt {{h[0-9]+}}, {{d[0-9]+}}
57
58 %val16 = fptrunc double %in to half
59 store half %val16, half* %addr
60 ret void
61 }