[llvm] [clang] MIPS/clang: Fix asm constraint for softfloat (PR #79116)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 21:13:22 PST 2024


================
@@ -102,3 +102,50 @@
 // CHECK-ABI-SOFT-MIPS16: "-target-feature" "+mips16"
 // CHECK-ABI-SOFT-MIPS16: "-msoft-float"
 // CHECK-ABI-SOFT-MIPS16: "-mfloat-abi" "soft"
+
+/// On MIPS, don't accept constraint "f" for soft-float.
+// RUN: not %clang -S %s -o %t.s 2>&1 \
+// RUN:     -target mips-linux-gnu -msoft-float \
+// RUN:     -DSOFT_FLOAT_NO_CONSTRAINT_F \
+// RUN:   | FileCheck --check-prefix=CHECK-SOFTFLOAT-ASM-NO-F %s
+// CHECK-SOFTFLOAT-ASM-NO-F: error: invalid input constraint 'f' in asm
+
----------------
MaskRay wrote:

test/Driver should only test how the driver passes options to cc1.

For inline assembly, you usually test that clangCodeGen correctly generates LLVM IR and the backend can lower asm. See `#77886` (x86 "Ws") for a good example (I carefully add tests. Many early-day asm patches might not add appropriate tests.)

https://github.com/llvm/llvm-project/pull/79116


More information about the cfe-commits mailing list