2019-11-27 12:28:52 +08:00
|
|
|
// 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
|
|
|
|
// 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
|
|
|
|
// 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=NATIVE
|
2015-09-03 20:40:58 +08:00
|
|
|
|
|
|
|
__fp16 g;
|
|
|
|
|
|
|
|
void t1(__fp16 a) { g = a; }
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// SOFT: define dso_local void @t1(i32 [[PARAM:%.*]])
|
2015-09-03 20:40:58 +08:00
|
|
|
// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// HARD: define dso_local arm_aapcs_vfpcc void @t1(float [[PARAM:%.*]])
|
2015-09-03 20:40:58 +08:00
|
|
|
// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
|
|
|
|
// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
|
|
|
|
// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// NATIVE: define dso_local void @t1(half [[PARAM:%.*]])
|
2016-03-19 00:58:36 +08:00
|
|
|
// NATIVE: store half [[PARAM]], half* @g
|
2015-09-03 20:40:58 +08:00
|
|
|
|
|
|
|
__fp16 t2() { return g; }
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// SOFT: define dso_local i32 @t2()
|
|
|
|
// HARD: define dso_local arm_aapcs_vfpcc float @t2()
|
|
|
|
// NATIVE: define dso_local half @t2()
|
2015-09-03 20:40:58 +08:00
|
|
|
// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
|
|
|
|
// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
|
|
|
|
// SOFT: ret i32 [[ZEXT]]
|
|
|
|
// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
|
|
|
|
// HARD: ret float [[BITCAST]]
|
2016-03-19 00:58:36 +08:00
|
|
|
// NATIVE: [[LOAD:%.*]] = load half, half* @g
|
|
|
|
// NATIVE: ret half [[LOAD]]
|
2018-01-23 18:13:49 +08:00
|
|
|
|
|
|
|
_Float16 h;
|
|
|
|
|
|
|
|
void t3(_Float16 a) { h = a; }
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// SOFT: define dso_local void @t3(i32 [[PARAM:%.*]])
|
2018-01-23 18:13:49 +08:00
|
|
|
// SOFT: [[TRUNC:%.*]] = trunc i32 [[PARAM]] to i16
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// HARD: define dso_local arm_aapcs_vfpcc void @t3(float [[PARAM:%.*]])
|
2018-01-23 18:13:49 +08:00
|
|
|
// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
|
|
|
|
// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
|
|
|
|
// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @h to i16*)
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// NATIVE: define dso_local void @t3(half [[PARAM:%.*]])
|
2018-01-23 18:13:49 +08:00
|
|
|
// NATIVE: store half [[PARAM]], half* @h
|
|
|
|
|
|
|
|
_Float16 t4() { return h; }
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// SOFT: define dso_local i32 @t4()
|
|
|
|
// HARD: define dso_local arm_aapcs_vfpcc float @t4()
|
|
|
|
// NATIVE: define dso_local half @t4()
|
2018-01-23 18:13:49 +08:00
|
|
|
// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @h to i16*)
|
|
|
|
// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
|
|
|
|
// SOFT: ret i32 [[ZEXT]]
|
|
|
|
// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
|
|
|
|
// HARD: ret float [[BITCAST]]
|
|
|
|
// NATIVE: [[LOAD:%.*]] = load half, half* @h
|
|
|
|
// NATIVE: ret half [[LOAD]]
|