-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][sema] forbid '+f' on output register #75208
base: main
Are you sure you want to change the base?
Conversation
to align with GCC asm: "+f" is not allowed to be used on output register. fix issue: llvm#75019
|
@llvm/pr-subscribers-clang Author: flyingcat (knightXun) Changesto 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:
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) {
|
| 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; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change from here: https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/X86.cpp#L1436
to align with GCC asm: "+f" is not allowed to be used on output register.
fix issue: #75019