[clang] [clang][sema] forbid '+f' on output register (PR #75208)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 21:59:22 PST 2023


================
@@ -717,8 +717,15 @@ bool TargetInfo::validateOutputConstraint(ConstraintInfo &Info) const {
   if (*Name != '=' && *Name != '+')
     return false;
 
-  if (*Name == '+')
+  if (*Name == '+') {
     Info.setIsReadWrite();
+    // To align with GCC asm: "=f" is not allowed, the
+    // operand constraints must select a class with a single reg.
+    auto Flag = Name + 1;
+    if (Flag && *Flag == 'f') {
+      return false;
+    }
+  }
----------------
phoebewang wrote:

Need to change from here: https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/X86.cpp#L1436

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


More information about the cfe-commits mailing list