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(bfloat* %p) nounwind {
7 ; CHECK-LABEL: test_load:
8 ; CHECK-NEXT: ldr h0, [x0]
10 %tmp1 = load bfloat, bfloat* %p, align 16
14 define <4 x bfloat> @test_vec_load(<4 x bfloat>* %p) nounwind {
15 ; CHECK-LABEL: test_vec_load:
16 ; CHECK-NEXT: ldr d0, [x0]
18 %tmp1 = load <4 x bfloat>, <4 x bfloat>* %p, align 16
19 ret <4 x bfloat> %tmp1
22 define void @test_store(bfloat* %a, bfloat %b) nounwind {
23 ; CHECK-LABEL: test_store:
24 ; CHECK-NEXT: str h0, [x0]
26 store bfloat %b, bfloat* %a, align 16
30 ; Simple store of v4bf16
31 define void @test_vec_store(<4 x bfloat>* %a, <4 x bfloat> %b) nounwind {
32 ; CHECK-LABEL: test_vec_store:
33 ; CHECK-NEXT: str d0, [x0]
36 store <4 x bfloat> %b, <4 x bfloat>* %a, align 16
40 define <8 x bfloat> @test_build_vector_const() {
41 ; CHECK-LABEL: test_build_vector_const:
42 ; CHECK: mov [[TMP:w[0-9]+]], #16256
43 ; CHECK: dup v0.8h, [[TMP]]
44 ret <8 x bfloat> <bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80, bfloat 0xR3F80>
47 define { bfloat, bfloat* } @test_store_post(bfloat %val, bfloat* %ptr) {
48 ; CHECK-LABEL: test_store_post:
49 ; CHECK: str h0, [x0], #2
51 store bfloat %val, bfloat* %ptr
52 %res.tmp = insertvalue { bfloat, bfloat* } undef, bfloat %val, 0
54 %next = getelementptr bfloat, bfloat* %ptr, i32 1
55 %res = insertvalue { bfloat, bfloat* } %res.tmp, bfloat* %next, 1
57 ret { bfloat, bfloat* } %res
60 define { <4 x bfloat>, <4 x bfloat>* } @test_store_post_v4bf16(<4 x bfloat> %val, <4 x bfloat>* %ptr) {
61 ; CHECK-LABEL: test_store_post_v4bf16:
62 ; CHECK: str d0, [x0], #8
64 store <4 x bfloat> %val, <4 x bfloat>* %ptr
65 %res.tmp = insertvalue { <4 x bfloat>, <4 x bfloat>* } undef, <4 x bfloat> %val, 0
67 %next = getelementptr <4 x bfloat>, <4 x bfloat>* %ptr, i32 1
68 %res = insertvalue { <4 x bfloat>, <4 x bfloat>* } %res.tmp, <4 x bfloat>* %next, 1
70 ret { <4 x bfloat>, <4 x bfloat>* } %res
73 define { <8 x bfloat>, <8 x bfloat>* } @test_store_post_v8bf16(<8 x bfloat> %val, <8 x bfloat>* %ptr) {
74 ; CHECK-LABEL: test_store_post_v8bf16:
75 ; CHECK: str q0, [x0], #16
77 store <8 x bfloat> %val, <8 x bfloat>* %ptr
78 %res.tmp = insertvalue { <8 x bfloat>, <8 x bfloat>* } undef, <8 x bfloat> %val, 0
80 %next = getelementptr <8 x bfloat>, <8 x bfloat>* %ptr, i32 1
81 %res = insertvalue { <8 x bfloat>, <8 x bfloat>* } %res.tmp, <8 x bfloat>* %next, 1
83 ret { <8 x bfloat>, <8 x bfloat>* } %res