1; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s 2 3define 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 12define 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 20define 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 30define 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 38define 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 49define 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 58define 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 67define 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 76define 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} 84 85define 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 95} 96