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(ptr %in, ptr %out) {
5 ; CHECK-LABEL: test_load_store:
7 ; CHECK-NEXT: ldr h0, [x0]
8 ; CHECK-NEXT: str h0, [x1]
10 %val = load half, ptr %in
11 store half %val, ptr %out
15 define i16 @test_bitcast_from_half(ptr %addr) {
16 ; CHECK-LABEL: test_bitcast_from_half:
18 ; CHECK-NEXT: ldrh w0, [x0]
20 %val = load half, ptr %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(ptr %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, ptr %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(ptr %addr) {
56 ; CHECK-LABEL: test_extend32:
58 ; CHECK-NEXT: ldr h0, [x0]
59 ; CHECK-NEXT: fcvt s0, h0
61 %val16 = load half, ptr %addr
62 %val32 = fpext half %val16 to float
66 define double @test_extend64(ptr %addr) {
67 ; CHECK-LABEL: test_extend64:
69 ; CHECK-NEXT: ldr h0, [x0]
70 ; CHECK-NEXT: fcvt d0, h0
72 %val16 = load half, ptr %addr
73 %val32 = fpext half %val16 to double
77 define void @test_trunc32(float %in, ptr %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, ptr %addr
88 define void @test_trunc64(double %in, ptr %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, ptr %addr
99 define i16 @test_fccmp(i1 %a, i16 %in) {
100 ; CHECK-LABEL: test_fccmp:
102 ; CHECK-NEXT: fmov s0, w1
103 ; CHECK-NEXT: mov w8, #24576 // =0x6000
104 ; CHECK-NEXT: movk w8, #15974, lsl #16
105 ; CHECK-NEXT: fmov s1, w8
106 ; CHECK-NEXT: mov w8, #16384 // =0x4000
107 ; CHECK-NEXT: fcvt s0, h0
108 ; CHECK-NEXT: movk w8, #15428, lsl #16
109 ; CHECK-NEXT: fmov s2, w8
110 ; CHECK-NEXT: mov w8, #4 // =0x4
111 ; CHECK-NEXT: fcmp s0, s1
112 ; CHECK-NEXT: fccmp s0, s2, #8, pl
113 ; CHECK-NEXT: csinc w8, w8, wzr, mi
114 ; CHECK-NEXT: fcmp s0, s1
115 ; CHECK-NEXT: cinc w0, w8, pl
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