Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: src/IceInstX86Base.h

Issue 1531623007: Add option to force filetype=asm for testing (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Formatting Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceInstX86Base.h
diff --git a/src/IceInstX86Base.h b/src/IceInstX86Base.h
index 347447ab450f734d5f7e3794db0bd561ebce47e6..b60040a2ab46203b80e372b874bc045ee7dc9c2b 100644
--- a/src/IceInstX86Base.h
+++ b/src/IceInstX86Base.h
@@ -764,29 +764,28 @@ public:
if (!BuildDefs::dump())
return;
this->validateVectorAddrMode();
+ Type DestTy = this->getDest()->getType();
+ const char *SuffixString = "";
+ if (ArithmeticTypeOverride != IceType_void)
+ DestTy = ArithmeticTypeOverride;
+
switch (Suffix) {
case InstX86Base<Machine>::SseSuffix::None:
- this->emitTwoAddress(Func, Opcode);
break;
- case InstX86Base<Machine>::SseSuffix::Packed: {
- const Type DestTy = this->getDest()->getType();
- this->emitTwoAddress(
- Func, this->Opcode,
- InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PdPsString);
- } break;
- case InstX86Base<Machine>::SseSuffix::Scalar: {
- const Type DestTy = this->getDest()->getType();
- this->emitTwoAddress(
- Func, this->Opcode,
- InstX86Base<Machine>::Traits::TypeAttributes[DestTy].SdSsString);
- } break;
- case InstX86Base<Machine>::SseSuffix::Integral: {
- const Type DestTy = this->getDest()->getType();
- this->emitTwoAddress(
- Func, this->Opcode,
- InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PackString);
- } break;
+ case InstX86Base<Machine>::SseSuffix::Packed:
+ SuffixString =
+ InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PdPsString;
+ break;
+ case InstX86Base<Machine>::SseSuffix::Scalar:
+ SuffixString =
+ InstX86Base<Machine>::Traits::TypeAttributes[DestTy].SdSsString;
+ break;
+ case InstX86Base<Machine>::SseSuffix::Integral:
+ SuffixString =
+ InstX86Base<Machine>::Traits::TypeAttributes[DestTy].PackString;
+ break;
}
+ this->emitTwoAddress(Func, Opcode, SuffixString);
}
void emitIAS(const Cfg *Func) const override {
this->validateVectorAddrMode();
@@ -810,12 +809,15 @@ public:
}
protected:
- InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source)
+ InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source,
+ Type ArithmeticType = IceType_void)
: InstX86Base<Machine>(Func, K, 2, Dest) {
this->addSource(Dest);
this->addSource(Source);
+ ArithmeticTypeOverride = ArithmeticType;
Jim Stichnoth 2015/12/20 18:42:23 Can this assignment be moved into the ctor member
sehr 2016/01/07 18:53:11 Done.
}
+ Type ArithmeticTypeOverride;
static const char *Opcode;
static const typename InstX86Base<Machine>::Traits::Assembler::XmmEmitterRegOp
Emitter;
@@ -2010,16 +2012,25 @@ class InstX86Pcmpeq
: public InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true,
InstX86Base<Machine>::SseSuffix::Integral> {
public:
- static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source) {
+ static InstX86Pcmpeq *create(Cfg *Func, Variable *Dest, Operand *Source,
+ Type ArithmeticTypeOverride = IceType_void) {
+ Type Ty = Dest->getType();
+ if (ArithmeticTypeOverride != IceType_void)
+ Ty = ArithmeticTypeOverride;
+ (void)Ty;
+ assert((Ty != IceType_f64 && Ty != IceType_i64) ||
+ InstX86Base<Machine>::getTarget(Func)->getInstructionSet() >=
+ InstX86Base<Machine>::Traits::SSE4_1);
return new (Func->allocate<InstX86Pcmpeq>())
- InstX86Pcmpeq(Func, Dest, Source);
+ InstX86Pcmpeq(Func, Dest, Source, ArithmeticTypeOverride);
}
private:
- InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source)
+ InstX86Pcmpeq(Cfg *Func, Variable *Dest, Operand *Source,
+ Type ArithmeticTypeOverride)
: InstX86BaseBinopXmm<Machine, InstX86Base<Machine>::Pcmpeq, true,
InstX86Base<Machine>::SseSuffix::Integral>(
- Func, Dest, Source) {}
+ Func, Dest, Source, ArithmeticTypeOverride) {}
};
template <class Machine>
@@ -2028,6 +2039,9 @@ class InstX86Pcmpgt
InstX86Base<Machine>::SseSuffix::Integral> {
public:
static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) {
+ assert(Dest->getType() != IceType_f64 ||
+ InstX86Base<Machine>::getTarget(Func)->getInstructionSet() >=
+ InstX86Base<Machine>::Traits::SSE4_1);
return new (Func->allocate<InstX86Pcmpgt>())
InstX86Pcmpgt(Func, Dest, Source);
}

Powered by Google App Engine
This is Rietveld 408576698