1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
4 define void @test_load_store(half* %in, half* %out) {
5 ; CHECK-LABEL: test_load_store:
7 ; CHECK-NEXT: ldr h0, [x0]
8 ; CHECK-NEXT: str h0, [x1]
10 %val = load half, half* %in
11 store half %val, half* %out
15 define i16 @test_bitcast_from_half(half* %addr) {
16 ; CHECK-LABEL: test_bitcast_from_half:
18 ; CHECK-NEXT: ldrh w0, [x0]
20 %val = load half, half* %addr
21 %val_int = bitcast half %val to i16
25 define i16 @test_reg_bitcast_from_half(half %in) {
26 ; CHECK-LABEL: test_reg_bitcast_from_half:
28 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $s0
29 ; CHECK-NEXT: fmov w0, s0
31 %val = bitcast half %in to i16
35 define void @test_bitcast_to_half(half* %addr, i16 %in) {
36 ; CHECK-LABEL: test_bitcast_to_half:
38 ; CHECK-NEXT: strh w1, [x0]
40 %val_fp = bitcast i16 %in to half
41 store half %val_fp, half* %addr
45 define half @test_reg_bitcast_to_half(i16 %in) {
46 ; CHECK-LABEL: test_reg_bitcast_to_half:
48 ; CHECK-NEXT: fmov s0, w0
49 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
51 %val = bitcast i16 %in to half
55 define float @test_extend32(half* %addr) {
56 ; CHECK-LABEL: test_extend32:
58 ; CHECK-NEXT: ldr h0, [x0]
59 ; CHECK-NEXT: fcvt s0, h0
61 %val16 = load half, half* %addr
62 %val32 = fpext half %val16 to float
66 define double @test_extend64(half* %addr) {
67 ; CHECK-LABEL: test_extend64:
69 ; CHECK-NEXT: ldr h0, [x0]
70 ; CHECK-NEXT: fcvt d0, h0
72 %val16 = load half, half* %addr
73 %val32 = fpext half %val16 to double
77 define void @test_trunc32(float %in, half* %addr) {
78 ; CHECK-LABEL: test_trunc32:
80 ; CHECK-NEXT: fcvt h0, s0
81 ; CHECK-NEXT: str h0, [x0]
83 %val16 = fptrunc float %in to half
84 store half %val16, half* %addr
88 define void @test_trunc64(double %in, half* %addr) {
89 ; CHECK-LABEL: test_trunc64:
91 ; CHECK-NEXT: fcvt h0, d0
92 ; CHECK-NEXT: str h0, [x0]
94 %val16 = fptrunc double %in to half
95 store half %val16, half* %addr
99 define i16 @test_fccmp(i1 %a, i16 %in) {
100 ; CHECK-LABEL: test_fccmp:
102 ; CHECK-NEXT: mov w8, #24576
103 ; CHECK-NEXT: fmov s0, w1
104 ; CHECK-NEXT: movk w8, #15974, lsl #16
105 ; CHECK-NEXT: mov w9, #16384
106 ; CHECK-NEXT: fcvt s0, h0
107 ; CHECK-NEXT: movk w9, #15428, lsl #16
108 ; CHECK-NEXT: fmov s1, w8
109 ; CHECK-NEXT: fcmp s0, s1
110 ; CHECK-NEXT: fmov s1, w9
111 ; CHECK-NEXT: cset w8, pl
112 ; CHECK-NEXT: fccmp s0, s1, #8, pl
113 ; CHECK-NEXT: mov w9, #4
114 ; CHECK-NEXT: csinc w9, w9, wzr, mi
115 ; CHECK-NEXT: add w0, w8, w9
117 %f16 = bitcast i16 %in to half
118 %cmp0 = fcmp ogt half 0xH3333, %f16
119 %cmp1 = fcmp ogt half 0xH2222, %f16
120 %x = select i1 %cmp0, i16 0, i16 1
121 %or = or i1 %cmp1, %cmp0
122 %y = select i1 %or, i16 4, i16 1