1 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %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 - -O1 %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 - -O1 %s | FileCheck %s --check-prefix=NATIVE 4 5 __fp16 g; 6 7 void t1(__fp16 a) { g = a; } 8 // SOFT: define void @t1(i32 [[PARAM:%.*]]) 9 // SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16 10 // HARD: define arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]]) 11 // HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32 12 // HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16 13 // CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*) 14 // NATIVE: define void @t1(half [[PARAM:%.*]]) 15 // NATIVE: store half [[PARAM]], half* @g 16 17 __fp16 t2() { return g; } 18 // SOFT: define i32 @t2() 19 // HARD: define arm_aapcs_vfpcc float @t2() 20 // NATIVE: define half @t2() 21 // CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*) 22 // CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32 23 // SOFT: ret i32 [[ZEXT]] 24 // HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float 25 // HARD: ret float [[BITCAST]] 26 // NATIVE: [[LOAD:%.*]] = load half, half* @g 27 // NATIVE: ret half [[LOAD]] 28