benshi001 created this revision. benshi001 added reviewers: asb, luismarques, MaskRay, craig.topper. Herald added subscribers: vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar. benshi001 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
As discussed in https://github.com/riscv/riscv-toolchain-conventions/issues/13, the implicit ARCH for explicitly specified ABI should be ilp32e => rv32e ilp32 => rv32imac ilp32f => rv32imacf ilp32d => rv32imacfd lp64 => rv64imac lp64f => rv64imacf lp64d => rv64imacfd Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D104192 Files: clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/test/Driver/riscv-arch.c Index: clang/test/Driver/riscv-arch.c =================================================================== --- clang/test/Driver/riscv-arch.c +++ clang/test/Driver/riscv-arch.c @@ -44,9 +44,9 @@ // CHECK-ILP32: "-target-feature" "+m" // CHECK-ILP32-SAME: {{^}} "-target-feature" "+a" -// CHECK-ILP32-SAME: {{^}} "-target-feature" "+f" -// CHECK-ILP32-SAME: {{^}} "-target-feature" "+d" // CHECK-ILP32-SAME: {{^}} "-target-feature" "+c" +// CHECK-ILP32-NOT: "-target-feature" "+f" +// CHECK-ILP32-NOT: "-target-feature" "+d" // RUN: %clang -target riscv32-unknown-elf -mabi=ilp32f -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32F %s @@ -54,8 +54,8 @@ // CHECK-ILP32F: "-target-feature" "+m" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+a" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+f" -// CHECK-ILP32F-SAME: {{^}} "-target-feature" "+d" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+c" +// CHECK-ILP32F-NOT: "-target-feature" "+d" // RUN: %clang -target riscv32-unknown-elf -mabi=ilp32d -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32D %s @@ -110,25 +110,25 @@ // RUN: %clang -target riscv64-unknown-elf -mabi=lp64 -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64 %s -// CHECK-LP64: "-target-feature" "+m" +// CHECK-LP64: "-target-feature" "+m" // CHECK-LP64-SAME: {{^}} "-target-feature" "+a" -// CHECK-LP64-SAME: {{^}} "-target-feature" "+f" -// CHECK-LP64-SAME: {{^}} "-target-feature" "+d" // CHECK-LP64-SAME: {{^}} "-target-feature" "+c" +// CHECK-LP64-NOT: "-target-feature" "+f" +// CHECK-LP64-NOT: "-target-feature" "+d" // RUN: %clang -target riscv64-unknown-elf -mabi=lp64f -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64F %s -// CHECK-LP64F: "-target-feature" "+m" +// CHECK-LP64F: "-target-feature" "+m" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+a" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+f" -// CHECK-LP64F-SAME: {{^}} "-target-feature" "+d" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+c" +// CHECK-LP64F-NOT: "-target-feature" "+d" // RUN: %clang -target riscv64-unknown-elf -mabi=lp64d -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64D %s -// CHECK-LP64D: "-target-feature" "+m" +// CHECK-LP64D: "-target-feature" "+m" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+a" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+f" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+d" Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -698,9 +698,17 @@ if (MABI.equals_lower("ilp32e")) return "rv32e"; - else if (MABI.startswith_lower("ilp32")) + else if (MABI.equals_lower("ilp32")) + return "rv32imac"; + else if (MABI.equals_lower("ilp32f")) + return "rv32imafc"; + else if (MABI.equals_lower("ilp32d")) return "rv32imafdc"; - else if (MABI.startswith_lower("lp64")) + else if (MABI.equals_lower("lp64")) + return "rv64imac"; + else if (MABI.equals_lower("lp64f")) + return "rv64imafc"; + else if (MABI.equals_lower("lp64d")) return "rv64imafdc"; }
Index: clang/test/Driver/riscv-arch.c =================================================================== --- clang/test/Driver/riscv-arch.c +++ clang/test/Driver/riscv-arch.c @@ -44,9 +44,9 @@ // CHECK-ILP32: "-target-feature" "+m" // CHECK-ILP32-SAME: {{^}} "-target-feature" "+a" -// CHECK-ILP32-SAME: {{^}} "-target-feature" "+f" -// CHECK-ILP32-SAME: {{^}} "-target-feature" "+d" // CHECK-ILP32-SAME: {{^}} "-target-feature" "+c" +// CHECK-ILP32-NOT: "-target-feature" "+f" +// CHECK-ILP32-NOT: "-target-feature" "+d" // RUN: %clang -target riscv32-unknown-elf -mabi=ilp32f -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32F %s @@ -54,8 +54,8 @@ // CHECK-ILP32F: "-target-feature" "+m" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+a" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+f" -// CHECK-ILP32F-SAME: {{^}} "-target-feature" "+d" // CHECK-ILP32F-SAME: {{^}} "-target-feature" "+c" +// CHECK-ILP32F-NOT: "-target-feature" "+d" // RUN: %clang -target riscv32-unknown-elf -mabi=ilp32d -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-ILP32D %s @@ -110,25 +110,25 @@ // RUN: %clang -target riscv64-unknown-elf -mabi=lp64 -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64 %s -// CHECK-LP64: "-target-feature" "+m" +// CHECK-LP64: "-target-feature" "+m" // CHECK-LP64-SAME: {{^}} "-target-feature" "+a" -// CHECK-LP64-SAME: {{^}} "-target-feature" "+f" -// CHECK-LP64-SAME: {{^}} "-target-feature" "+d" // CHECK-LP64-SAME: {{^}} "-target-feature" "+c" +// CHECK-LP64-NOT: "-target-feature" "+f" +// CHECK-LP64-NOT: "-target-feature" "+d" // RUN: %clang -target riscv64-unknown-elf -mabi=lp64f -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64F %s -// CHECK-LP64F: "-target-feature" "+m" +// CHECK-LP64F: "-target-feature" "+m" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+a" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+f" -// CHECK-LP64F-SAME: {{^}} "-target-feature" "+d" // CHECK-LP64F-SAME: {{^}} "-target-feature" "+c" +// CHECK-LP64F-NOT: "-target-feature" "+d" // RUN: %clang -target riscv64-unknown-elf -mabi=lp64d -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-LP64D %s -// CHECK-LP64D: "-target-feature" "+m" +// CHECK-LP64D: "-target-feature" "+m" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+a" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+f" // CHECK-LP64D-SAME: {{^}} "-target-feature" "+d" Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -698,9 +698,17 @@ if (MABI.equals_lower("ilp32e")) return "rv32e"; - else if (MABI.startswith_lower("ilp32")) + else if (MABI.equals_lower("ilp32")) + return "rv32imac"; + else if (MABI.equals_lower("ilp32f")) + return "rv32imafc"; + else if (MABI.equals_lower("ilp32d")) return "rv32imafdc"; - else if (MABI.startswith_lower("lp64")) + else if (MABI.equals_lower("lp64")) + return "rv64imac"; + else if (MABI.equals_lower("lp64f")) + return "rv64imafc"; + else if (MABI.equals_lower("lp64d")) return "rv64imafdc"; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits