1 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=-f16c | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LIBCALL
2 ; RUN: llc < %s -march=x86-64 -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+f16c | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-F16C
4 define void @test_load_store(half* %in, half* %out) {
5 ; CHECK-LABEL: test_load_store:
6 ; CHECK: movw (%rdi), [[TMP:%[a-z0-9]+]]
7 ; CHECK: movw [[TMP]], (%rsi)
8 %val = load half, half* %in
9 store half %val, half* %out
13 define i16 @test_bitcast_from_half(half* %addr) {
14 ; CHECK-LABEL: test_bitcast_from_half:
15 ; CHECK: movzwl (%rdi), %eax
16 %val = load half, half* %addr
17 %val_int = bitcast half %val to i16
21 define void @test_bitcast_to_half(half* %addr, i16 %in) {
22 ; CHECK-LABEL: test_bitcast_to_half:
23 ; CHECK: movw %si, (%rdi)
24 %val_fp = bitcast i16 %in to half
25 store half %val_fp, half* %addr
29 define float @test_extend32(half* %addr) {
30 ; CHECK-LABEL: test_extend32:
32 ; CHECK-LIBCALL: jmp __gnu_h2f_ieee
33 ; CHECK-FP16: vcvtph2ps
34 %val16 = load half, half* %addr
35 %val32 = fpext half %val16 to float
39 define double @test_extend64(half* %addr) {
40 ; CHECK-LABEL: test_extend64:
42 ; CHECK-LIBCALL: callq __gnu_h2f_ieee
43 ; CHECK-LIBCALL: cvtss2sd
44 ; CHECK-FP16: vcvtph2ps
45 ; CHECK-FP16: vcvtss2sd
46 %val16 = load half, half* %addr
47 %val32 = fpext half %val16 to double
51 define void @test_trunc32(float %in, half* %addr) {
52 ; CHECK-LABEL: test_trunc32:
54 ; CHECK-LIBCALL: callq __gnu_f2h_ieee
55 ; CHECK-FP16: vcvtps2ph
56 %val16 = fptrunc float %in to half
57 store half %val16, half* %addr
61 define void @test_trunc64(double %in, half* %addr) {
62 ; CHECK-LABEL: test_trunc64:
64 ; CHECK-LIBCALL: callq __truncdfhf2
65 ; CHECK-FP16: callq __truncdfhf2
66 %val16 = fptrunc double %in to half
67 store half %val16, half* %addr