1 ; RUN: llc < %s -asm-verbose=0 -mtriple=arm64-eabi -mattr=+bf16 | FileCheck %s
2 ; RUN: llc < %s -asm-verbose=0 -mtriple=aarch64-eabi -mattr=+bf16 | FileCheck %s
4 ; test argument passing and simple load/store
6 define bfloat @test_load(ptr %p) nounwind {
7 ; CHECK-LABEL: test_load:
8 ; CHECK-NEXT: ldr h0, [x0]
10 %tmp1 = load bfloat, ptr %p, align 16
14 define bfloat @test_load_offset1(ptr %p) nounwind {
15 ; CHECK-LABEL: test_load_offset1:
16 ; CHECK-NEXT: ldur h0, [x0, #1]
18 %g = getelementptr inbounds i8, ptr %p, i64 1
19 %tmp1 = load bfloat, ptr %g, align 2
23 define bfloat @test_load_offset2(ptr %p) nounwind {
24 ; CHECK-LABEL: test_load_offset2:
25 ; CHECK-NEXT: ldr h0, [x0, #2]
27 %g = getelementptr inbounds i8, ptr %p, i64 2
28 %tmp1 = load bfloat, ptr %g, align 2
32 define <4 x bfloat> @test_vec_load(ptr %p) nounwind {
33 ; CHECK-LABEL: test_vec_load:
34 ; CHECK-NEXT: ldr d0, [x0]
36 %tmp1 = load <4 x bfloat>, ptr %p, align 16
37 ret <4 x bfloat> %tmp1
40 define void @test_store(ptr %a, bfloat %b) nounwind {
41 ; CHECK-LABEL: test_store:
42 ; CHECK-NEXT: str h0, [x0]
44 store bfloat %b, ptr %a, align 16
48 ; Simple store of v4bf16
49 define void @test_vec_store(ptr %a, <4 x bfloat> %b) nounwind {
50 ; CHECK-LABEL: test_vec_store:
51 ; CHECK-NEXT: str d0, [x0]
54 store <4 x bfloat> %b, ptr %a, align 16
58 define <8 x bfloat> @test_build_vector_const() {
59 ; CHECK-LABEL: test_build_vector_const:
60 ; CHECK: mov [[TMP:w[0-9]+]], #16256
61 ; CHECK: dup v0.8h, [[TMP]]
62 ret <8 x bfloat> <bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80>
65 define { bfloat, ptr } @test_store_post(bfloat %val, ptr %ptr) {
66 ; CHECK-LABEL: test_store_post:
67 ; CHECK: str h0, [x0], #2
69 store bfloat %val, ptr %ptr
70 %res.tmp = insertvalue { bfloat, ptr } undef, bfloat %val, 0
72 %next = getelementptr bfloat, ptr %ptr, i32 1
73 %res = insertvalue { bfloat, ptr } %res.tmp, ptr %next, 1
75 ret { bfloat, ptr } %res
78 define { <4 x bfloat>, ptr } @test_store_post_v4bf16(<4 x bfloat> %val, ptr %ptr) {
79 ; CHECK-LABEL: test_store_post_v4bf16:
80 ; CHECK: str d0, [x0], #8
82 store <4 x bfloat> %val, ptr %ptr
83 %res.tmp = insertvalue { <4 x bfloat>, ptr } undef, <4 x bfloat> %val, 0
85 %next = getelementptr <4 x bfloat>, ptr %ptr, i32 1
86 %res = insertvalue { <4 x bfloat>, ptr } %res.tmp, ptr %next, 1
88 ret { <4 x bfloat>, ptr } %res
91 define { <8 x bfloat>, ptr } @test_store_post_v8bf16(<8 x bfloat> %val, ptr %ptr) {
92 ; CHECK-LABEL: test_store_post_v8bf16:
93 ; CHECK: str q0, [x0], #16
95 store <8 x bfloat> %val, ptr %ptr
96 %res.tmp = insertvalue { <8 x bfloat>, ptr } undef, <8 x bfloat> %val, 0
98 %next = getelementptr <8 x bfloat>, ptr %ptr, i32 1
99 %res = insertvalue { <8 x bfloat>, ptr } %res.tmp, ptr %next, 1
101 ret { <8 x bfloat>, ptr } %res
104 define bfloat @test_bitcast_halftobfloat(half %a) nounwind {
105 ; CHECK-LABEL: test_bitcast_halftobfloat:
107 %r = bitcast half %a to bfloat
111 define half @test_bitcast_bfloattohalf(bfloat %a) nounwind {
112 ; CHECK-LABEL: test_bitcast_bfloattohalf:
114 %r = bitcast bfloat %a to half