xref: /llvm-project/clang/test/CodeGen/arm-bf16-params-returns.c (revision 1228becf7df28c68579f2b9b390b74aa41149a0a)
1 // RUN: %clang_cc1 -triple armv8.6a-arm-none-eabi -target-abi aapcs -mfloat-abi hard -target-feature +bf16 -target-feature +neon -emit-llvm -O2 -o - %s | opt -S -passes=mem2reg,sroa | FileCheck %s --check-prefix=CHECK32-HARD
2 // RUN: %clang_cc1 -triple armv8.6a-arm-none-eabi -target-abi aapcs -mfloat-abi softfp -target-feature +bf16 -target-feature +neon -emit-llvm -O2 -o - %s | opt -S -passes=mem2reg,sroa | FileCheck %s --check-prefix=CHECK32-SOFTFP
3 // RUN: %clang_cc1 -triple aarch64 -target-abi aapcs -target-feature +bf16 -target-feature +neon -emit-llvm -O2 -o - %s | opt -S -passes=mem2reg,sroa | FileCheck %s --check-prefixes=CHECK64,CHECK64NEON
4 // RUN: %clang_cc1 -triple aarch64 -target-abi aapcs -target-feature -bf16 -target-feature +neon -DNONEON -emit-llvm -O2 -o - %s | opt -S -passes=mem2reg,sroa | FileCheck %s --check-prefix=CHECK64
5 
6 // REQUIRES: aarch64-registered-target || arm-registered-target
7 
8 #include <arm_neon.h>
9 
10 // function return types
test_ret_bf16(__bf16 v)11 __bf16 test_ret_bf16(__bf16 v) {
12   return v;
13 }
14 // CHECK32-HARD: define{{.*}} arm_aapcs_vfpcc noundef bfloat @test_ret_bf16(bfloat noundef returned %v) {{.*}} {
15 // CHECK32-HARD: ret bfloat %v
16 // CHECK32-SOFTFP: define{{.*}} bfloat @test_ret_bf16(bfloat noundef returned %v) {{.*}} {
17 // CHECK32-SOFTFP: ret bfloat %v
18 // CHECK64: define{{.*}} bfloat @test_ret_bf16(bfloat noundef returned %v) {{.*}} {
19 // CHECK64: ret bfloat %v
20 
21 #ifndef NONEON
22 
test_ret_bf16x4_t(bfloat16x4_t v)23 bfloat16x4_t test_ret_bf16x4_t(bfloat16x4_t v) {
24   return v;
25 }
26 // CHECK32-HARD: define{{.*}} arm_aapcs_vfpcc noundef <4 x bfloat> @test_ret_bf16x4_t(<4 x bfloat> noundef returned %v) {{.*}} {
27 // CHECK32-HARD: ret <4 x bfloat> %v
28 // CHECK32-SOFTFP: define{{.*}} noundef <2 x i32> @test_ret_bf16x4_t(<2 x i32> [[V0:.*]]) {{.*}} {
29 // CHECK32-SOFTFP: ret <2 x i32> %v
30 // CHECK64NEON: define{{.*}} noundef <4 x bfloat> @test_ret_bf16x4_t(<4 x bfloat> noundef returned %v) {{.*}} {
31 // CHECK64NEON: ret <4 x bfloat> %v
32 
33 #endif