Index: src/IceInstX86Base.h |
diff --git a/src/IceInstX86Base.h b/src/IceInstX86Base.h |
index c4a9fe4cbcae6e40bceae7581010677c08c03d41..767dae75ac68f48d60bbf3aff1d3d0696e02ddb4 100644 |
--- a/src/IceInstX86Base.h |
+++ b/src/IceInstX86Base.h |
@@ -823,26 +823,25 @@ template <typename TraitsType> struct InstImpl { |
if (!BuildDefs::dump()) |
return; |
this->validateVectorAddrMode(); |
+ Type DestTy = this->getDest()->getType(); |
Jim Stichnoth
2016/01/10 03:08:55
How about this:
const Type DestTy = ArithmeticT
sehr
2016/01/11 21:49:47
Done.
|
+ const char *SuffixString = ""; |
+ if (ArithmeticTypeOverride != IceType_void) |
+ DestTy = ArithmeticTypeOverride; |
+ |
switch (Suffix) { |
case InstX86Base::SseSuffix::None: |
- this->emitTwoAddress(Func, Opcode); |
break; |
- case InstX86Base::SseSuffix::Packed: { |
- const Type DestTy = this->getDest()->getType(); |
- this->emitTwoAddress(Func, this->Opcode, |
- Traits::TypeAttributes[DestTy].PdPsString); |
- } break; |
- case InstX86Base::SseSuffix::Scalar: { |
- const Type DestTy = this->getDest()->getType(); |
- this->emitTwoAddress(Func, this->Opcode, |
- Traits::TypeAttributes[DestTy].SdSsString); |
- } break; |
- case InstX86Base::SseSuffix::Integral: { |
- const Type DestTy = this->getDest()->getType(); |
- this->emitTwoAddress(Func, this->Opcode, |
- Traits::TypeAttributes[DestTy].PackString); |
- } break; |
+ case InstX86Base::SseSuffix::Packed: |
+ SuffixString = Traits::TypeAttributes[DestTy].PdPsString; |
+ break; |
+ case InstX86Base::SseSuffix::Scalar: |
+ SuffixString = Traits::TypeAttributes[DestTy].SdSsString; |
+ break; |
+ case InstX86Base::SseSuffix::Integral: |
+ SuffixString = Traits::TypeAttributes[DestTy].PackString; |
+ break; |
} |
+ this->emitTwoAddress(Func, Opcode, SuffixString); |
} |
void emitIAS(const Cfg *Func) const override { |
this->validateVectorAddrMode(); |
@@ -865,12 +864,15 @@ template <typename TraitsType> struct InstImpl { |
} |
protected: |
- InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source) |
- : InstX86Base(Func, K, 2, Dest) { |
+ InstX86BaseBinopXmm(Cfg *Func, Variable *Dest, Operand *Source, |
+ Type ArithmeticTypeOverride = IceType_void) |
+ : InstX86Base(Func, K, 2, Dest), |
+ ArithmeticTypeOverride(ArithmeticTypeOverride) { |
this->addSource(Dest); |
this->addSource(Source); |
} |
+ const Type ArithmeticTypeOverride; |
static const char *Opcode; |
static const XmmEmitterRegOp Emitter; |
}; |
@@ -1914,16 +1916,25 @@ template <typename TraitsType> struct InstImpl { |
: public InstX86BaseBinopXmm<InstX86Base::Pcmpeq, true, |
InstX86Base::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(); |
Jim Stichnoth
2016/01/10 03:08:55
Same "const Type Ty = ..." comment as above.
sehr
2016/01/11 21:49:47
Done.
|
+ if (ArithmeticTypeOverride != IceType_void) |
+ Ty = ArithmeticTypeOverride; |
+ (void)Ty; |
+ assert((Ty != IceType_f64 && Ty != IceType_i64) || |
+ InstX86Base::getTarget(Func)->getInstructionSet() >= |
+ 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<InstX86Base::Pcmpeq, true, |
- InstX86Base::SseSuffix::Integral>(Func, Dest, |
- Source) {} |
+ InstX86Base::SseSuffix::Integral>( |
+ Func, Dest, Source, ArithmeticTypeOverride) {} |
}; |
class InstX86Pcmpgt |
@@ -1931,6 +1942,9 @@ template <typename TraitsType> struct InstImpl { |
InstX86Base::SseSuffix::Integral> { |
public: |
static InstX86Pcmpgt *create(Cfg *Func, Variable *Dest, Operand *Source) { |
+ assert(Dest->getType() != IceType_f64 || |
+ InstX86Base::getTarget(Func)->getInstructionSet() >= |
+ Traits::SSE4_1); |
return new (Func->allocate<InstX86Pcmpgt>()) |
InstX86Pcmpgt(Func, Dest, Source); |
} |