diff options
author | Alex Bradbury <asb@lowrisc.org> | 2019-07-18 18:29:59 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2019-07-18 18:29:59 +0000 |
commit | e078967adf4f4f84da52b8d739aea75ed2ce5f16 (patch) | |
tree | 9bb3bc093067c460e63ac4e4260962871ea01699 /clang/test/Preprocessor/riscv-target-features.c | |
parent | f332fe642cc576b7c52c643b7024e6839407d34b (diff) | |
download | bcm5719-llvm-e078967adf4f4f84da52b8d739aea75ed2ce5f16.tar.gz bcm5719-llvm-e078967adf4f4f84da52b8d739aea75ed2ce5f16.zip |
[RISCV] Hard float ABI support
The RISC-V hard float calling convention requires the frontend to:
* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s)
* Track usage of GPRs and FPRs in order to gate the above, and to
determine when signext/zeroext attributes must be added to integer
scalars
This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.
Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.
Re-landed after backing out 366450 due to missed hunks.
Differential Revision: https://reviews.llvm.org/D60456
llvm-svn: 366480
Diffstat (limited to 'clang/test/Preprocessor/riscv-target-features.c')
-rw-r--r-- | clang/test/Preprocessor/riscv-target-features.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 2c63e0fa29d..36e49c36f03 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -47,3 +47,27 @@ // RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ic -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-C-EXT %s // CHECK-C-EXT: __riscv_compressed 1 + +// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SOFT %s +// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SOFT %s +// CHECK-SOFT: __riscv_float_abi_soft 1 +// CHECK-SOFT-NOT: __riscv_float_abi_single +// CHECK-SOFT-NOT: __riscv_float_abi_double + +// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mabi=ilp32f -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SINGLE %s +// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mabi=lp64f -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SINGLE %s +// CHECK-SINGLE: __riscv_float_abi_single 1 +// CHECK-SINGLE-NOT: __riscv_float_abi_soft +// CHECK-SINGLE-NOT: __riscv_float_abi_double + +// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mabi=ilp32d -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-DOUBLE %s +// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mabi=lp64d -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-DOUBLE %s +// CHECK-DOUBLE: __riscv_float_abi_double 1 +// CHECK-DOUBLE-NOT: __riscv_float_abi_soft +// CHECK-DOUBLE-NOT: __riscv_float_abi_single |