[WinEH] Add some test cases I forgot to add to previous commits
[oota-llvm.git] / test / CodeGen / AArch64 / half.ll
1 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
2
3 define void @test_load_store(half* %in, half* %out) {
4 ; CHECK-LABEL: test_load_store:
5 ; CHECK: ldr [[TMP:h[0-9]+]], [x0]
6 ; CHECK: str [[TMP]], [x1]
7   %val = load half, half* %in
8   store half %val, half* %out
9   ret void
10 }
11
12 define i16 @test_bitcast_from_half(half* %addr) {
13 ; CHECK-LABEL: test_bitcast_from_half:
14 ; CHECK: ldrh w0, [x0]
15   %val = load half, half* %addr
16   %val_int = bitcast half %val to i16
17   ret i16 %val_int
18 }
19
20 define i16 @test_reg_bitcast_from_half(half %in) {
21 ; CHECK-LABEL: test_reg_bitcast_from_half:
22 ; CHECK-NOT: str
23 ; CHECK-NOT: ldr
24 ; CHECK-DAG: fmov w0, s0
25 ; CHECK: ret
26   %val = bitcast half %in to i16
27   ret i16 %val
28 }
29
30 define void @test_bitcast_to_half(half* %addr, i16 %in) {
31 ; CHECK-LABEL: test_bitcast_to_half:
32 ; CHECK: strh w1, [x0]
33   %val_fp = bitcast i16 %in to half
34   store half %val_fp, half* %addr
35   ret void
36 }
37
38 define half @test_reg_bitcast_to_half(i16 %in) {
39 ; CHECK-LABEL: test_reg_bitcast_to_half:
40 ; CHECK-NOT: str
41 ; CHECK-NOT: ldr
42 ; CHECK-DAG: fmov s0, w0
43 ; CHECK: ret
44
45   %val = bitcast i16 %in to half
46   ret half %val
47 }
48
49 define float @test_extend32(half* %addr) {
50 ; CHECK-LABEL: test_extend32:
51 ; CHECK: fcvt {{s[0-9]+}}, {{h[0-9]+}}
52
53   %val16 = load half, half* %addr
54   %val32 = fpext half %val16 to float
55   ret float %val32
56 }
57
58 define double @test_extend64(half* %addr) {
59 ; CHECK-LABEL: test_extend64:
60 ; CHECK: fcvt {{d[0-9]+}}, {{h[0-9]+}}
61
62   %val16 = load half, half* %addr
63   %val32 = fpext half %val16 to double
64   ret double %val32
65 }
66
67 define void @test_trunc32(float %in, half* %addr) {
68 ; CHECK-LABEL: test_trunc32:
69 ; CHECK: fcvt {{h[0-9]+}}, {{s[0-9]+}}
70
71   %val16 = fptrunc float %in to half
72   store half %val16, half* %addr
73   ret void
74 }
75
76 define void @test_trunc64(double %in, half* %addr) {
77 ; CHECK-LABEL: test_trunc64:
78 ; CHECK: fcvt {{h[0-9]+}}, {{d[0-9]+}}
79
80   %val16 = fptrunc double %in to half
81   store half %val16, half* %addr
82   ret void
83 }