[PATCH] D65634: [RISCV] Default to ilp32d/lp64d in RISC-V Linux
Roger Ferrer Ibanez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 10 01:01:59 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371494: [RISCV] Default to ilp32d/lp64d in RISC-V Linux (authored by rogfer01, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D65634?vs=213812&id=219487#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65634/new/
https://reviews.llvm.org/D65634
Files:
cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp
cfe/trunk/test/Driver/riscv32-toolchain.c
cfe/trunk/test/Driver/riscv64-toolchain.c
cfe/trunk/test/Preprocessor/riscv-target-features.c
Index: cfe/trunk/test/Driver/riscv32-toolchain.c
===================================================================
--- cfe/trunk/test/Driver/riscv32-toolchain.c
+++ cfe/trunk/test/Driver/riscv32-toolchain.c
@@ -68,7 +68,7 @@
// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o"
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \
-// RUN: -target riscv32-unknown-linux-gnu \
+// RUN: -target riscv32-unknown-linux-gnu -mabi=ilp32 \
// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32 %s
@@ -84,7 +84,7 @@
// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \
-// RUN: -target riscv32-unknown-linux-gnu -march=rv32imafd -mabi=ilp32d \
+// RUN: -target riscv32-unknown-linux-gnu -march=rv32imafd \
// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32D %s
Index: cfe/trunk/test/Driver/riscv64-toolchain.c
===================================================================
--- cfe/trunk/test/Driver/riscv64-toolchain.c
+++ cfe/trunk/test/Driver/riscv64-toolchain.c
@@ -68,7 +68,7 @@
// CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o"
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \
-// RUN: -target riscv64-unknown-linux-gnu \
+// RUN: -target riscv64-unknown-linux-gnu -mabi=lp64 \
// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV64-LINUX-MULTI-LP64 %s
@@ -84,7 +84,7 @@
// C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \
-// RUN: -target riscv64-unknown-linux-gnu -march=rv64imafd -mabi=lp64d \
+// RUN: -target riscv64-unknown-linux-gnu -march=rv64imafd \
// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \
// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV64-LINUX-MULTI-LP64D %s
Index: cfe/trunk/test/Preprocessor/riscv-target-features.c
===================================================================
--- cfe/trunk/test/Preprocessor/riscv-target-features.c
+++ cfe/trunk/test/Preprocessor/riscv-target-features.c
@@ -48,9 +48,9 @@
// 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: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mabi=ilp32 -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: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mabi=lp64 -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
@@ -64,9 +64,9 @@
// 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: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -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: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -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
Index: cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -389,7 +389,9 @@
if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
return A->getValue();
- // FIXME: currently defaults to the soft-float ABIs. Will need to be
- // expanded to select ilp32f, ilp32d, lp64f, lp64d when appropriate.
- return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64";
+ // RISC-V Linux defaults to ilp32d/lp64d
+ if (Triple.getOS() == llvm::Triple::Linux)
+ return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32d" : "lp64d";
+ else
+ return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65634.219487.patch
Type: text/x-patch
Size: 4849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190910/5b4637cb/attachment-0001.bin>
More information about the cfe-commits
mailing list