[PowerPC] Generate Power9 extswsli extend sign and shift immediate instruction
[llvm-core.git] / test / CodeGen / AArch64 / half.ll
blob154d85c9bb610757e9524e598d6effb50716b337
1 ; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
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
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
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
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
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
45   %val = bitcast i16 %in to half
46   ret half %val
49 define float @test_extend32(half* %addr) {
50 ; CHECK-LABEL: test_extend32:
51 ; CHECK: fcvt {{s[0-9]+}}, {{h[0-9]+}}
53   %val16 = load half, half* %addr
54   %val32 = fpext half %val16 to float
55   ret float %val32
58 define double @test_extend64(half* %addr) {
59 ; CHECK-LABEL: test_extend64:
60 ; CHECK: fcvt {{d[0-9]+}}, {{h[0-9]+}}
62   %val16 = load half, half* %addr
63   %val32 = fpext half %val16 to double
64   ret double %val32
67 define void @test_trunc32(float %in, half* %addr) {
68 ; CHECK-LABEL: test_trunc32:
69 ; CHECK: fcvt {{h[0-9]+}}, {{s[0-9]+}}
71   %val16 = fptrunc float %in to half
72   store half %val16, half* %addr
73   ret void
76 define void @test_trunc64(double %in, half* %addr) {
77 ; CHECK-LABEL: test_trunc64:
78 ; CHECK: fcvt {{h[0-9]+}}, {{d[0-9]+}}
80   %val16 = fptrunc double %in to half
81   store half %val16, half* %addr
82   ret void
85 define i16 @test_fccmp(i1 %a) {
86 ;CHECK-LABEL: test_fccmp:
87 ;CHECK: fcmp
88   %cmp0 = fcmp ogt half 0xH3333, undef
89   %cmp1 = fcmp ogt half 0xH2222, undef
90   %x = select i1 %cmp0, i16 0, i16 undef
91   %or = or i1 %cmp1, %cmp0
92   %y = select i1 %or, i16 4, i16 undef
93   %r = add i16 %x, %y
94   ret i16 %r