-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[X86][MC][AsmParser] Reject H-byte regs with VEX/EVEX-encoded 8-bit RR (NDD) #160039
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e1d2d25
[X86][MC][AsmParser] Reject H-byte regs with VEX/EVEX-encoded 8-bit R…
woruyu c6821f1
fix: details
woruyu 6ce586e
fix: review
woruyu 189ccb4
fix: review
woruyu 59d2ffa
fix: review
woruyu a39aae5
fix: review
woruyu 130d292
fix: combine all check
woruyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
// RUN: not llvm-mc -triple x86_64-unknown-unknown --show-encoding %s 2>&1 | FileCheck %s | ||
// RUN: not llvm-mc -triple x86_64-unknown-unknown --show-encoding -x86-asm-syntax=intel %s 2>&1 | FileCheck %s --check-prefix=CHECK-INTEL | ||
|
||
// CHECK: error: can't encode 'dh' in an instruction requiring REX prefix | ||
// CHECK: error: can't encode 'dh' in an instruction requiring EVEX/REX2/REX prefix | ||
movzx %dh, %rsi | ||
|
||
// CHECK: error: can't encode 'ah' in an instruction requiring REX prefix | ||
// CHECK: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
movzx %ah, %r8d | ||
|
||
// CHECK: error: can't encode 'bh' in an instruction requiring REX prefix | ||
// CHECK: error: can't encode 'bh' in an instruction requiring EVEX/REX2/REX prefix | ||
add %bh, %sil | ||
|
||
// CHECK: error: can't encode 'ch' in an instruction requiring REX prefix | ||
// CHECK: error: can't encode 'ch' in an instruction requiring EVEX/REX2/REX prefix | ||
mov %ch, (%r8) | ||
|
||
// CHECK: error: can't encode 'dh' in an instruction requiring REX prefix | ||
// CHECK: error: can't encode 'dh' in an instruction requiring EVEX/REX2/REX prefix | ||
mov %dh, (%rax,%r8) | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
add ah, ah, ah | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
and ah, byte ptr [-13426159], ah | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
ccmpa {dfv=of,cf} byte ptr [r8 + 4*rax + 291], ah | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
ccmpae {dfv=of,cf} byte ptr [r8 + 4*rax + 291], ah | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
sar ah, byte ptr [-13426159] | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
{rex2} add ah, al | ||
|
||
// CHECK-INTEL: error: can't encode 'ah' in an instruction requiring EVEX/REX2/REX prefix | ||
{rex} add ah, al |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This seems an incomplete fix. In addition to
REX_W
, we may use REX prefix when other bit is set, e.g. REX_R/X/B.Uh oh!
There was an error while loading. Please reload this page.
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.
https://godbolt.org/z/98xdvEbn3
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.
I can't understand this. Because I think REX_R/X/B means you use r8..r15 in opreand, so in current codes for
add ah, byte ptr [r8]
, you will get UsesRex = true,HReg is noZero, so you will get error msg in the second if branch.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.
Yes, I mean we don't need extra change here.
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.
Okay. I missed the line 4041