Skip to content

Conversation

@knightXun
Copy link
Contributor

to align with GCC asm: "+f" is not allowed to be used on output register.

fix issue: #75019

to align with GCC asm: "+f" is not allowed to be used on output register. fix issue: llvm#75019
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 12, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 12, 2023

@llvm/pr-subscribers-clang

Author: flyingcat (knightXun)

Changes

to align with GCC asm: "+f" is not allowed to be used on output register.

fix issue: #75019


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

1 Files Affected:

  • (modified) clang/lib/Basic/TargetInfo.cpp (+8-1)
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index 6cd5d618a4aca..57a81e03bc484 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -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; + } + } Name++; while (*Name) { 
@knightXun
Copy link
Contributor Author

Comment on lines +720 to +728
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;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

3 participants