-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SPARC][IAS] Add definitions for OSA 2011 instructions #138403
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
Changes from 2 commits
8e75442
71fe8f9
71dc57d
ba17bd2
462bf59
dc502e7
3d5592c
74402e2
5b59eb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,9 @@ class SparcMCCodeEmitter : public MCCodeEmitter { | |
| unsigned getBranchTargetOpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const; | ||
| unsigned getSImm5OpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const; | ||
| unsigned getSImm13OpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const; | ||
|
|
@@ -80,6 +83,9 @@ class SparcMCCodeEmitter : public MCCodeEmitter { | |
| unsigned getBranchOnRegTargetOpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const; | ||
| unsigned getCompareAndBranchTargetOpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const; | ||
| }; | ||
|
|
||
| } // end anonymous namespace | ||
|
|
@@ -141,6 +147,26 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO, | |
| return 0; | ||
| } | ||
|
|
||
| unsigned SparcMCCodeEmitter::getSImm5OpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const { | ||
| const MCOperand &MO = MI.getOperand(OpNo); | ||
|
|
||
| if (MO.isImm()) | ||
| return MO.getImm(); | ||
|
|
||
| assert(MO.isExpr() && | ||
| "getSImm5OpValue expects only expressions or an immediate"); | ||
|
|
||
| const MCExpr *Expr = MO.getExpr(); | ||
|
|
||
| // Constant value, no fixup is needed | ||
| if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr)) | ||
| return CE->getValue(); | ||
|
|
||
| llvm_unreachable("simm5 operands can only be used with constants!"); | ||
|
||
| } | ||
|
|
||
| unsigned | ||
| SparcMCCodeEmitter::getSImm13OpValue(const MCInst &MI, unsigned OpNo, | ||
| SmallVectorImpl<MCFixup> &Fixups, | ||
|
|
@@ -239,6 +265,19 @@ getBranchOnRegTargetOpValue(const MCInst &MI, unsigned OpNo, | |
| return 0; | ||
| } | ||
|
|
||
| unsigned SparcMCCodeEmitter::getCompareAndBranchTargetOpValue( | ||
| const MCInst &MI, unsigned OpNo, SmallVectorImpl<MCFixup> &Fixups, | ||
| const MCSubtargetInfo &STI) const { | ||
| const MCOperand &MO = MI.getOperand(OpNo); | ||
| if (MO.isReg() || MO.isImm()) | ||
|
||
| return getMachineOpValue(MI, MO, Fixups, STI); | ||
|
|
||
| Fixups.push_back( | ||
| MCFixup::create(0, MO.getExpr(), (MCFixupKind)Sparc::fixup_sparc_br10)); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| #include "SparcGenMCCodeEmitter.inc" | ||
|
|
||
| MCCodeEmitter *llvm::createSparcMCCodeEmitter(const MCInstrInfo &MCII, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -286,11 +286,11 @@ multiclass cp_cond_alias<string cond, int condVal> { | |||||||||
|
|
||||||||||
| // cb<cond> $imm | ||||||||||
| def : InstAlias<!strconcat(!strconcat("cb", cond), " $imm"), | ||||||||||
| (CBCOND brtarget:$imm, condVal), 0>; | ||||||||||
| (CPBCOND brtarget:$imm, condVal), 0>; | ||||||||||
|
|
||||||||||
| // cb<cond>,a $imm | ||||||||||
| def : InstAlias<!strconcat(!strconcat("cb", cond), ",a $imm"), | ||||||||||
| (CBCONDA brtarget:$imm, condVal), 0>; | ||||||||||
| (CPBCONDA brtarget:$imm, condVal), 0>; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // Instruction aliases for register conditional branches and moves. | ||||||||||
|
|
@@ -331,6 +331,25 @@ multiclass reg_cond_alias<string rcond, int condVal> { | |||||||||
| Requires<[Is64Bit]>; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // Instruction aliases for compare-and-branch. | ||||||||||
| multiclass cwb_cond_alias<string cond, int condVal> { | ||||||||||
| def : InstAlias<!strconcat(!strconcat("cwb", cond), " $rs1, $rs2, $imm"), | ||||||||||
|
||||||||||
| def : InstAlias<!strconcat(!strconcat("cwb", cond), " $rs1, $rs2, $imm"), | |
| def : InstAlias<"cwb" # cond # " $rs1, $rs2, $imm", |
Outdated
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.
| let EmitPriority = 0 in | |
| { | |
| let EmitPriority = 0 in { |
Outdated
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.
Indentation
| def : InstAlias<"pause $rs2", (WRASRrr ASR27, G0, IntRegs:$rs2), 1>; | |
| def : InstAlias<"pause $simm13", (WRASRri ASR27, G0, simm13Op:$simm13), 1>; | |
| def : InstAlias<"pause $rs2", (WRASRrr ASR27, G0, IntRegs:$rs2)>; | |
| def : InstAlias<"pause $simm13", (WRASRri ASR27, G0, simm13Op:$simm13)>; |
Uh oh!
There was an error while loading. Please reload this page.