Skip to content

Commit 9aa6792

Browse files
kaz7Simon Moll
authored andcommitted
[VE] Update floating-point arithmetic instructions
Summary: Changing all mnemonic to match assembly instructions to simplify mnemonic naming rules. This time update all floating-point arithmetic instructions. Reviewed By: simoll Differential Revision: https://reviews.llvm.org/D78768
1 parent 500d378 commit 9aa6792

File tree

4 files changed

+176
-94
lines changed

4 files changed

+176
-94
lines changed

llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,9 @@ void VEInstPrinter::printCCOperand(const MCInst *MI, int OpNum,
182182
int CC = (int)MI->getOperand(OpNum).getImm();
183183
O << VECondCodeToString((VECC::CondCode)CC);
184184
}
185+
186+
void VEInstPrinter::printRDOperand(const MCInst *MI, int OpNum,
187+
const MCSubtargetInfo &STI, raw_ostream &O) {
188+
int RD = (int)MI->getOperand(OpNum).getImm();
189+
O << VERDToString((VERD::RoundingMode)RD);
190+
}

llvm/lib/Target/VE/MCTargetDesc/VEInstPrinter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class VEInstPrinter : public MCInstPrinter {
5151
raw_ostream &OS);
5252
void printCCOperand(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI,
5353
raw_ostream &OS);
54+
void printRDOperand(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI,
55+
raw_ostream &OS);
5456
};
5557
} // namespace llvm
5658

llvm/lib/Target/VE/VE.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ enum CondCode {
6565
CC_AT = 15 + 6, // Always
6666
};
6767
}
68+
// Enums corresponding to VE Rounding Mode. These values must be kept in
69+
// sync with the ones in the .td file.
70+
namespace VERD {
71+
enum RoundingMode {
72+
RD_NONE = 0, // According to PSW
73+
RD_RZ = 8, // Round toward Zero
74+
RD_RP = 9, // Round toward Plus infinity
75+
RD_RM = 10, // Round toward Minus infinity
76+
RD_RN = 11, // Round to Nearest (ties to Even)
77+
RD_RA = 12, // Round to Nearest (ties to Away)
78+
UNKNOWN
79+
};
80+
}
6881

6982
inline static const char *VECondCodeToString(VECC::CondCode CC) {
7083
switch (CC) {
@@ -94,6 +107,25 @@ inline static const char *VECondCodeToString(VECC::CondCode CC) {
94107
llvm_unreachable("Invalid cond code");
95108
}
96109

110+
inline static const char *VERDToString(VERD::RoundingMode R) {
111+
switch (R) {
112+
case VERD::RD_NONE:
113+
return "";
114+
case VERD::RD_RZ:
115+
return ".rz";
116+
case VERD::RD_RP:
117+
return ".rp";
118+
case VERD::RD_RM:
119+
return ".rm";
120+
case VERD::RD_RN:
121+
return ".rn";
122+
case VERD::RD_RA:
123+
return ".ra";
124+
default:
125+
llvm_unreachable("Invalid branch predicate");
126+
}
127+
}
128+
97129
inline unsigned M0(unsigned Val) { return Val + 64; }
98130
inline unsigned M1(unsigned Val) { return Val; }
99131

0 commit comments

Comments
 (0)