1; RUN: llc < %s -mtriple=aarch64-none-eabi -mattr=+fullfp16 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ILLEGAL
2; RUN: llc < %s -mtriple=aarch64-none-eabi -mattr=+fullfp16,+zcz | FileCheck %s --check-prefix=CHECK-ZCZ
3; RUN: llc < %s -mtriple=aarch64-none-eabi -mattr=-fullfp16 | FileCheck %s --check-prefix=CHECK-NOFP16 --check-prefix=CHECK-ILLEGAL
4
5define half @Const0() {
6entry:
7  ret half 0xH0000
8}
9; CHECK-DAG-ILLEGAL-LABEL:  Const0:
10; CHECK-DAG-ILLEGAL-NEXT:   fmov  h0, wzr
11; CHECK-DAG-ILLEGAL-NEXT:   ret
12
13; CHECK-ZCZ-LABEL:  Const0:
14; CHECK-ZCZ:        movi  v0.2d, #0000000000000000
15; CHECK-ZCZ-NEXT:   ret
16
17define half @Const1() {
18entry:
19  ret half 0xH3C00
20}
21; CHECK-DAG-LABEL: Const1:
22; CHECK-DAG-NEXT:   fmov h0, #1.00000000
23; CHECK-DAG-NEXT:   ret
24
25; CHECK-NOFP16:        .[[LBL1:LCPI1_[0-9]]]:
26; CHECK-NOFP16-NEXT:   .hword  15360 // half 1
27; CHECK-NOFP16-LABEL:  Const1:
28; CHECK-NOFP16:        adrp x[[NUM:[0-9]+]], .[[LBL1]]
29; CHECK-NOFP16-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL1]]]
30
31define half @Const2() {
32entry:
33  ret half 0xH3000
34}
35; CHECK-DAG-LABEL: Const2:
36; CHECK-DAG-NEXT:   fmov h0, #0.12500000
37; CHECK-DAG-NEXT:   ret
38
39; CHECK-NOFP16:        .[[LBL2:LCPI2_[0-9]]]:
40; CHECK-NOFP16-NEXT:   .hword  12288 // half 0.125
41; CHECK-NOFP16-LABEL:  Const2:
42; CHECK-NOFP16:        adrp x[[NUM:[0-9]+]], .[[LBL2]]
43; CHECK-NOFP16-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL2]]]
44
45define half @Const3() {
46entry:
47  ret half 0xH4F80
48}
49; CHECK-DAG-LABEL: Const3:
50; CHECK-DAG-NEXT:   fmov h0, #30.00000000
51; CHECK-DAG-NEXT:   ret
52
53; CHECK-NOFP16:        .[[LBL3:LCPI3_[0-9]]]:
54; CHECK-NOFP16-NEXT:   .hword  20352 // half 30
55; CHECK-NOFP16-LABEL:  Const3:
56; CHECK-NOFP16:        adrp x[[NUM:[0-9]+]], .[[LBL3]]
57; CHECK-NOFP16-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL3]]]
58
59
60define half @Const4() {
61entry:
62  ret half 0xH4FC0
63}
64; CHECK-DAG-LABEL: Const4:
65; CHECK-DAG-NEXT:  fmov h0, #31.00000000
66; CHECK-DAG-NEXT:  ret
67
68; CHECK-NOFP16:        .[[LBL4:LCPI4_[0-9]]]:
69; CHECK-NOFP16-NEXT:   .hword  20416                    // half 31
70; CHECK-NOFP16-LABEL:  Const4:
71; CHECK-NOFP16:        adrp x[[NUM:[0-9]+]], .[[LBL4]]
72; CHECK-NOFP16-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL4]]]
73
74define half @Const5() {
75entry:
76  ret half 0xH2FF0
77}
78; CHECK-ILLEGAL:        .[[LBL5:LCPI5_[0-9]]]:
79; CHECK-ILLEGAL-NEXT:   .hword  12272                   // half 0.12402
80; CHECK-ILLEGAL-LABEL:  Const5:
81; CHECK-ILLEGAL:        adrp x[[NUM:[0-9]+]], .[[LBL5]]
82; CHECK-ILLEGAL-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL5]]]
83
84define half @Const6() {
85entry:
86  ret half 0xH4FC1
87}
88; CHECK-ILLEGAL:        .[[LBL6:LCPI6_[0-9]]]:
89; CHECK-ILLEGAL-NEXT:   .hword  20417                   // half 31.016
90; CHECK-ILLEGAL-LABEL:  Const6:
91; CHECK-ILLEGAL:        adrp x[[NUM:[0-9]+]], .[[LBL6]]
92; CHECK-ILLEGAL-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL6]]]
93
94
95define half @Const7() {
96entry:
97  ret half 0xH5000
98}
99; CHECK-ILLEGAL:        .[[LBL7:LCPI7_[0-9]]]:
100; CHECK-ILLEGAL-NEXT:   .hword  20480                   // half 32
101; CHECK-ILLEGAL-LABEL:  Const7:
102; CHECK-ILLEGAL:        adrp x[[NUM:[0-9]+]], .[[LBL7]]
103; CHECK-ILLEGAL-NEXT:   ldr h0, [x[[NUM]], :lo12:.[[LBL7]]]
104
105
106