[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-05-16 Thread Fangrui Song via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7983f8aca82e: MIPS: allow o32 abi with 64bit CPU and 64 abi 
with 32bit triple (authored by wzssyqa, committed by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-abi.c
  clang/test/Driver/mips-cpu64abi32.c
  llvm/lib/Target/Mips/MipsSubtarget.cpp

Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -104,8 +104,7 @@
 report_fatal_error("Code generation for MIPS-V is not implemented", false);
 
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
+  assert(((!isGP64bit() && isABI_O32()) || isGP64bit()) &&
  "Invalid  Arch & ABI pair.");
 
   if (hasMSA() && !isFP64bit())
Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,68 @@
+/// Check handling the CPU is 64bit while ABI is O32.
+/// when build for MIPS platforms.
+
+/// abi-n32
+// RUN: %clang -### -c %s --target=mips-linux-gnu -mabi=n32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: "-target-abi" "n32"
+
+/// abi-64
+// RUN: %clang -### -c %s --target=mips-linux-gnu -mabi=64 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: "-target-abi" "n64"
+
+
+/// -march=mips3
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips3 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: "-target-cpu" "mips3" {{.*}} "-target-abi" "o32"
+
+/// -march=mips4
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips4 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: "-target-cpu" "mips4" {{.*}} "-target-abi" "o32"
+
+/// FIXME: MIPS V is not implemented yet.
+
+/// -march=mips64
+/// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: "-target-cpu" "mips64" {{.*}} "-target-abi" "o32"
+
+/// -march=mips64r2
+/// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64r2 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: "-target-cpu" "mips64r2" {{.*}} "-target-abi" "o32"
+
+/// -march=mips64r6
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64r6 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: "-target-cpu" "mips64r6" {{.*}} "-target-abi" "o32"
+
+
+/// mipsisa3
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips3 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: "-target-cpu" "mips3" {{.*}} "-target-abi" "o32"
+
+/// mipsisa4
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips4 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: "-target-cpu" "mips4" {{.*}} "-target-abi" "o32"
+
+/// FIXME: MIPS V is not implemented yet.
+
+/// mipsisa64
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: "-target-cpu" "mips64" {{.*}} "-target-abi" "o32"
+
+/// mipsisa64r2
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64r2 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: "-target-cpu" "mips64r2" {{.*}} "-target-abi" "o32"
+
+/// mipsisa64r6
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64r6 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: "-target-cpu" "mips64r6" {{.*}} "-target-abi" "o32"
Index: clang/test/Driver/mips-abi.c
===
--- clang/test/Driver/mips-abi.c
+++ clang/test/Driver/mips-abi.c
@@ -9,13 +9,6 @@
 // MIPS32R2-O32: "-target-cpu" "mips32r2"
 // MIPS32R2-O32: "-target-abi" "o32"
 //
-// FIXME: This is a valid combination of options but we reject it at the moment
-//because the backend can't handle it.
-// RUN: not %clang -target mips-linux-gnu -c %s \
-// RUN:-march=mips64r2 -mabi=32 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
-// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
-//
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-05-16 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

In D146269#4347514 , @MaskRay wrote:

> Is this the new GCC behavior?

Marking o32 objects with 64bit CPU is a long history gas behaviour, maybe 
appeared in 1990s, or even in the era of Irix.
I guess the reason is that to achive something like:

  -mabi=32 -march=octeon

`Octeon` is a 64bit CPU.
Since no matter about the -march value, due to all of them are using o32 abi,
they can interlink.
And thus Linux kernel uses this behaviour.

>> `clang -target mipsel-linux-gnu -mabi=64`
>
> Use `--target=`

Done


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-05-16 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Is this the new GCC behavior?

> `clang -target mipsel-linux-gnu -mabi=64`

Use `--target=`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-05-15 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

ping...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-05-03 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

@MaskRay ping?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-28 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa updated this revision to Diff 517903.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-abi.c
  clang/test/Driver/mips-cpu64abi32.c
  llvm/lib/Target/Mips/MipsSubtarget.cpp

Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -104,8 +104,7 @@
 report_fatal_error("Code generation for MIPS-V is not implemented", false);
 
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
+  assert(((!isGP64bit() && isABI_O32()) || isGP64bit()) &&
  "Invalid  Arch & ABI pair.");
 
   if (hasMSA() && !isFP64bit())
Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,68 @@
+/// Check handling the CPU is 64bit while ABI is O32.
+/// when build for MIPS platforms.
+
+/// abi-n32
+// RUN: %clang -### -c %s --target=mips-linux-gnu -mabi=n32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: "-target-abi" "n32"
+
+/// abi-64
+// RUN: %clang -### -c %s --target=mips-linux-gnu -mabi=64 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: "-target-abi" "n64"
+
+
+/// -march=mips3
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips3 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: "-target-cpu" "mips3" {{.*}} "-target-abi" "o32"
+
+/// -march=mips4
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips4 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: "-target-cpu" "mips4" {{.*}} "-target-abi" "o32"
+
+/// FIXME: MIPS V is not implemented yet.
+
+/// -march=mips64
+/// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: "-target-cpu" "mips64" {{.*}} "-target-abi" "o32"
+
+/// -march=mips64r2
+/// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64r2 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: "-target-cpu" "mips64r2" {{.*}} "-target-abi" "o32"
+
+/// -march=mips64r6
+// RUN: %clang -### -c %s --target=mips-linux-gnu -march=mips64r6 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: "-target-cpu" "mips64r6" {{.*}} "-target-abi" "o32"
+
+
+/// mipsisa3
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips3 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: "-target-cpu" "mips3" {{.*}} "-target-abi" "o32"
+
+/// mipsisa4
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips4 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: "-target-cpu" "mips4" {{.*}} "-target-abi" "o32"
+
+/// FIXME: MIPS V is not implemented yet.
+
+/// mipsisa64
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: "-target-cpu" "mips64" {{.*}} "-target-abi" "o32"
+
+/// mipsisa64r2
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64r2 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: "-target-cpu" "mips64r2" {{.*}} "-target-abi" "o32"
+
+/// mipsisa64r6
+// RUN: %clang -### -c %s --target=mips64-linux-gnu -march=mips64r6 -mabi=32 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: "-target-cpu" "mips64r6" {{.*}} "-target-abi" "o32"
Index: clang/test/Driver/mips-abi.c
===
--- clang/test/Driver/mips-abi.c
+++ clang/test/Driver/mips-abi.c
@@ -9,13 +9,6 @@
 // MIPS32R2-O32: "-target-cpu" "mips32r2"
 // MIPS32R2-O32: "-target-abi" "o32"
 //
-// FIXME: This is a valid combination of options but we reject it at the moment
-//because the backend can't handle it.
-// RUN: not %clang -target mips-linux-gnu -c %s \
-// RUN:-march=mips64r2 -mabi=32 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
-// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
-//
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_u

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-27 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.



Comment at: clang/test/Driver/mips-cpu64abi32.c:1
+// Check handling the CPU is 64bit while ABI is O32.
+// when build for MIPS platforms.

Use `///` for non-CHECK non-RUN comments.



Comment at: clang/test/Driver/mips-cpu64abi32.c:5
+// abi-n32
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=n32 -o - \
+// RUN:   | llvm-readelf -h - \

`-target ` is legacy. Use `--target=`.

Driver tests should not test code generation. Just check that `%clang ...` 
passes the right options to cc1.



Comment at: clang/test/Driver/mips-cpu64abi32.c:9
+// CHECK-ABI-N32: abi2
+//
+// abi-64

Don't add `^//$` lines. Just use a blank line.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-25 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

@MaskRay can you help to submit this patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-23 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa updated this revision to Diff 516277.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-abi.c
  clang/test/Driver/mips-cpu64abi32.c
  llvm/lib/Target/Mips/MipsSubtarget.cpp

Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -104,8 +104,7 @@
 report_fatal_error("Code generation for MIPS-V is not implemented", false);
 
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
+  assert(((!isGP64bit() && isABI_O32()) || isGP64bit()) &&
  "Invalid  Arch & ABI pair.");
 
   if (hasMSA() && !isFP64bit())
Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,81 @@
+// Check handling the CPU is 64bit while ABI is O32.
+// when build for MIPS platforms.
+//
+// abi-n32
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=n32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: abi2
+//
+// abi-64
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: ELF64
+//
+//
+// -march=mips3
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips3 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: o32, mips3
+//
+// -march=mips4
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips4 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// -march=mips64
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: o32, mips64
+//
+// -march=mips64r2
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r2 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: o32, mips64r2
+//
+// -march=mips64r6
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r6 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: o32, mips64r6
+//
+//
+// mipsisa3
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips3 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: o32, mips3
+//
+// mipsisa4
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips4 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// mipsisa64
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: o32, mips64
+//
+// mipsisa64r2
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r2 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: o32, mips64r2
+//
+// mipsisa64r6
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r6 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: o32, mips64r6
+//
Index: clang/test/Driver/mips-abi.c
===
--- clang/test/Driver/mips-abi.c
+++ clang/test/Driver/mips-abi.c
@@ -9,13 +9,6 @@
 // MIPS32R2-O32: "-target-cpu" "mips32r2"
 // MIPS32R2-O32: "-target-abi" "o32"
 //
-// FIXME: This is a valid combination of options but we reject it at the moment
-//because the backend can't handle it.
-// RUN: not %clang -target mips-linux-gnu -c %s \
-// RUN:-march=mips64r2 -mabi=32 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
-// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
-//
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
 return false;
   }

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-18 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.



Comment at: llvm/lib/Target/Mips/MipsSubtarget.cpp:107
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
+  assert(((!isGP64bit() && isABI_O32()) || (isGP64bit())) &&
  "Invalid  Arch & ABI pair.");




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-18 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

ping...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

In D146269#4239702 , @wzssyqa wrote:

> ping

@maskray is offline until Tuesday April 11.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

This came up in
https://lore.kernel.org/llvm/ebe3e940-b8ee-4682-a1f6-1ccf98eac...@flygoat.com/
(follow up thread, FWIW: 
https://lore.kernel.org/llvm/20230407102721.14814-1-jiaxun.y...@flygoat.com/)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-04-02 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-03-20 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa updated this revision to Diff 506838.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-abi.c
  clang/test/Driver/mips-cpu64abi32.c
  llvm/lib/Target/Mips/MipsSubtarget.cpp

Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -104,8 +104,7 @@
 report_fatal_error("Code generation for MIPS-V is not implemented", false);
 
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
+  assert(((!isGP64bit() && isABI_O32()) || (isGP64bit())) &&
  "Invalid  Arch & ABI pair.");
 
   if (hasMSA() && !isFP64bit())
Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,81 @@
+// Check handling the CPU is 64bit while ABI is O32.
+// when build for MIPS platforms.
+//
+// abi-n32
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=n32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: abi2
+//
+// abi-64
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: ELF64
+//
+//
+// -march=mips3
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips3 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: o32, mips3
+//
+// -march=mips4
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips4 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// -march=mips64
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: o32, mips64
+//
+// -march=mips64r2
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r2 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: o32, mips64r2
+//
+// -march=mips64r6
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r6 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: o32, mips64r6
+//
+//
+// mipsisa3
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips3 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: o32, mips3
+//
+// mipsisa4
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips4 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// mipsisa64
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: o32, mips64
+//
+// mipsisa64r2
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r2 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: o32, mips64r2
+//
+// mipsisa64r6
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r6 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: o32, mips64r6
+//
Index: clang/test/Driver/mips-abi.c
===
--- clang/test/Driver/mips-abi.c
+++ clang/test/Driver/mips-abi.c
@@ -9,13 +9,6 @@
 // MIPS32R2-O32: "-target-cpu" "mips32r2"
 // MIPS32R2-O32: "-target-abi" "o32"
 //
-// FIXME: This is a valid combination of options but we reject it at the moment
-//because the backend can't handle it.
-// RUN: not %clang -target mips-linux-gnu -c %s \
-// RUN:-march=mips64r2 -mabi=32 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
-// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
-//
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
 return false;
  

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-03-20 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa updated this revision to Diff 506814.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-abi.c
  clang/test/Driver/mips-cpu64abi32.c
  llvm/lib/Target/Mips/MipsSubtarget.cpp

Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -104,9 +104,7 @@
 report_fatal_error("Code generation for MIPS-V is not implemented", false);
 
   // Check if Architecture and ABI are compatible.
-  assert(((!isGP64bit() && isABI_O32()) ||
-  (isGP64bit() && (isABI_N32() || isABI_N64( &&
- "Invalid  Arch & ABI pair.");
+  assert((!isGP64bit() && !isABI_O32()) && "Invalid  Arch & ABI pair.");
 
   if (hasMSA() && !isFP64bit())
 report_fatal_error("MSA requires a 64-bit FPU register file (FR=1 mode). "
Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,81 @@
+// Check handling the CPU is 64bit while ABI is O32.
+// when build for MIPS platforms.
+//
+// abi-n32
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=n32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: abi2
+//
+// abi-64
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: ELF64
+//
+//
+// -march=mips3
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips3 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: o32, mips3
+//
+// -march=mips4
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips4 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// -march=mips64
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: o32, mips64
+//
+// -march=mips64r2
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r2 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: o32, mips64r2
+//
+// -march=mips64r6
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r6 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: o32, mips64r6
+//
+//
+// mipsisa3
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips3 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: o32, mips3
+//
+// mipsisa4
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips4 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// mipsisa64
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: o32, mips64
+//
+// mipsisa64r2
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r2 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: o32, mips64r2
+//
+// mipsisa64r6
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r6 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: o32, mips64r6
+//
Index: clang/test/Driver/mips-abi.c
===
--- clang/test/Driver/mips-abi.c
+++ clang/test/Driver/mips-abi.c
@@ -9,13 +9,6 @@
 // MIPS32R2-O32: "-target-cpu" "mips32r2"
 // MIPS32R2-O32: "-target-abi" "o32"
 //
-// FIXME: This is a valid combination of options but we reject it at the moment
-//because the backend can't handle it.
-// RUN: not %clang -target mips-linux-gnu -c %s \
-// RUN:-march=mips64r2 -mabi=32 2>&1 \
-// RUN:   | FileCheck -check-prefix=MIPS64R2-O32 %s
-// MIPS64R2-O32: error: ABI 'o32' is not supported on CPU 'mips64r2'
-//
 // RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64R2-N64 %s
 // RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Bas

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-03-20 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa added a comment.

In D146269#4201150 , @jrtc27 wrote:

> Tests?

Added.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-03-20 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa updated this revision to Diff 506482.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp
  clang/test/Driver/mips-cpu64abi32.c

Index: clang/test/Driver/mips-cpu64abi32.c
===
--- /dev/null
+++ clang/test/Driver/mips-cpu64abi32.c
@@ -0,0 +1,81 @@
+// Check handling the CPU is 64bit while ABI is O32.
+// when build for MIPS platforms.
+//
+// abi-n32
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=n32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-N32 %s
+// CHECK-ABI-N32: abi2
+//
+// abi-64
+// RUN: %clang -c %s -target mips-linux-gnu -mabi=64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-ABI-64 %s
+// CHECK-ABI-64: ELF64
+//
+//
+// -march=mips3
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips3 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS3 %s
+// CHECK-MIPS-MIPS3: o32, mips3
+//
+// -march=mips4
+// RUN: %clang -c %s -target mips-linux-gnu -march=mips4 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS4 %s
+// CHECK-MIPS-MIPS4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// -march=mips64
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64 %s
+// CHECK-MIPS-MIPS64: o32, mips64
+//
+// -march=mips64r2
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r2 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R2 %s
+// CHECK-MIPS-MIPS64R2: o32, mips64r2
+//
+// -march=mips64r6
+/// RUN: %clang -c %s -target mips-linux-gnu -march=mips64r6 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPS64R6 %s
+// CHECK-MIPS-MIPS64R6: o32, mips64r6
+//
+//
+// mipsisa3
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips3 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA3 %s
+// CHECK-MIPS-MIPSISA3: o32, mips3
+//
+// mipsisa4
+// RUN: %clang -c %s -target mips64-linux-gnu -march=mips4 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA4 %s
+// CHECK-MIPS-MIPSISA4: o32, mips4
+//
+// FIXME: MIPS V is not implemented yet.
+//
+// mipsisa64
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64 %s
+// CHECK-MIPS-MIPSISA64: o32, mips64
+//
+// mipsisa64r2
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r2 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R2 %s
+// CHECK-MIPS-MIPSISA64R2: o32, mips64r2
+//
+// mipsisa64r6
+/// RUN: %clang -c %s -target mips64-linux-gnu -march=mips64r6 -mabi=32 -o - \
+// RUN:   | llvm-readelf -h - \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-MIPSISA64R6 %s
+// CHECK-MIPS-MIPSISA64R6: o32, mips64r6
+//
Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
 return false;
   }
-  // FIXME: It's valid to use O32 on a 64-bit CPU but the backend can't handle
-  //this yet. It's better to fail here than on the backend assertion.
-  if (processorSupportsGPR64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi) << ABI << CPU;
-return false;
-  }
 
   // 64-bit ABI's require 64-bit CPU's.
   if (!processorSupportsGPR64() && (ABI == "n32" || ABI == "n64")) {
@@ -251,24 +245,6 @@
 return false;
   }
 
-  // FIXME: It's valid to use O32 on a mips64/mips64el triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
-  // FIXME: It's valid to use N32/N64 on a mips/mipsel triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS32() && (ABI == "n32" || ABI == "n64")) {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
   // -fpxx is valid only for the o32 ABI
   if (FPMode == FPXX && (ABI == "n32" || ABI == "n64")) {
 Diags.Report(diag::err_unsupported_abi_for_opt) << "-mfpxx" << "o32";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
h

[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU and 64 abi with 32bit triple

2023-03-16 Thread Jessica Clarke via Phabricator via cfe-commits
jrtc27 added a comment.

Tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146269/new/

https://reviews.llvm.org/D146269

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146269: MIPS: allow o32 abi with 64bit CPU

2023-03-16 Thread YunQiang Su via Phabricator via cfe-commits
wzssyqa created this revision.
wzssyqa added a reviewer: MaskRay.
Herald added subscribers: atanasyan, jrtc27, arichardson, sdardis.
Herald added a project: All.
wzssyqa requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In general, MIPS support ELF format like

  ELF 32-bit LSB relocatable, MIPS, MIPS64 rel2 version 1 (SYSV)

and Linux's VDSO uses it.

Currently clang stop CMDs like

  clang -march=mips64r2 -mabi=32

While it is not needed now, since the the backend support the combination now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146269

Files:
  clang/lib/Basic/Targets/Mips.cpp


Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
 return false;
   }
-  // FIXME: It's valid to use O32 on a 64-bit CPU but the backend can't handle
-  //this yet. It's better to fail here than on the backend assertion.
-  if (processorSupportsGPR64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi) << ABI << CPU;
-return false;
-  }
 
   // 64-bit ABI's require 64-bit CPU's.
   if (!processorSupportsGPR64() && (ABI == "n32" || ABI == "n64")) {
@@ -251,24 +245,6 @@
 return false;
   }
 
-  // FIXME: It's valid to use O32 on a mips64/mips64el triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
-  // FIXME: It's valid to use N32/N64 on a mips/mipsel triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS32() && (ABI == "n32" || ABI == "n64")) {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
   // -fpxx is valid only for the o32 ABI
   if (FPMode == FPXX && (ABI == "n32" || ABI == "n64")) {
 Diags.Report(diag::err_unsupported_abi_for_opt) << "-mfpxx" << "o32";


Index: clang/lib/Basic/Targets/Mips.cpp
===
--- clang/lib/Basic/Targets/Mips.cpp
+++ clang/lib/Basic/Targets/Mips.cpp
@@ -238,12 +238,6 @@
 Diags.Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
 return false;
   }
-  // FIXME: It's valid to use O32 on a 64-bit CPU but the backend can't handle
-  //this yet. It's better to fail here than on the backend assertion.
-  if (processorSupportsGPR64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi) << ABI << CPU;
-return false;
-  }
 
   // 64-bit ABI's require 64-bit CPU's.
   if (!processorSupportsGPR64() && (ABI == "n32" || ABI == "n64")) {
@@ -251,24 +245,6 @@
 return false;
   }
 
-  // FIXME: It's valid to use O32 on a mips64/mips64el triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS64() && ABI == "o32") {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
-  // FIXME: It's valid to use N32/N64 on a mips/mipsel triple but the backend
-  //can't handle this yet. It's better to fail here than on the
-  //backend assertion.
-  if (getTriple().isMIPS32() && (ABI == "n32" || ABI == "n64")) {
-Diags.Report(diag::err_target_unsupported_abi_for_triple)
-<< ABI << getTriple().str();
-return false;
-  }
-
   // -fpxx is valid only for the o32 ABI
   if (FPMode == FPXX && (ABI == "n32" || ABI == "n64")) {
 Diags.Report(diag::err_unsupported_abi_for_opt) << "-mfpxx" << "o32";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits