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"