• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O2 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
2 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O2 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
3 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fnative-half-arguments-and-returns -emit-llvm -o - -O2 %s | FileCheck %s --check-prefix=CHECK --check-prefix=NATIVE
4 
5 __fp16 g;
6 
t1(__fp16 a)7 void t1(__fp16 a) { g = a; }
8 // SOFT: define void @t1(half [[PARAM:%.*]])
9 // HARD: define arm_aapcs_vfpcc void @t1(half [[PARAM:%.*]])
10 // NATIVE: define void @t1(half [[PARAM:%.*]])
11 // CHECK: store half [[PARAM]], half* @g
12 
t2()13 __fp16 t2() { return g; }
14 // SOFT: define half @t2()
15 // HARD: define arm_aapcs_vfpcc half @t2()
16 // NATIVE: define half @t2()
17 // CHECK: [[LOAD:%.*]] = load half, half* @g
18 // CHECK: ret half [[LOAD]]
19 
20 _Float16 h;
21 
t3(_Float16 a)22 void t3(_Float16 a) { h = a; }
23 // SOFT: define void @t3(half [[PARAM:%.*]])
24 // HARD: define arm_aapcs_vfpcc void @t3(half [[PARAM:%.*]])
25 // NATIVE: define void @t3(half [[PARAM:%.*]])
26 // CHECK: store half [[PARAM]], half* @h
27 
t4()28 _Float16 t4() { return h; }
29 // SOFT: define half @t4()
30 // HARD: define arm_aapcs_vfpcc half @t4()
31 // NATIVE: define half @t4()
32 // CHECK: [[LOAD:%.*]] = load half, half* @h
33 // CHECK: ret half [[LOAD]]
34