| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
| (...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 FirstVal = hiOperand(Val); | 3082 FirstVal = hiOperand(Val); |
| 3083 SecondVal = loOperand(Val); | 3083 SecondVal = loOperand(Val); |
| 3084 } else { | 3084 } else { |
| 3085 FirstVal = Val; | 3085 FirstVal = Val; |
| 3086 } | 3086 } |
| 3087 const bool IsCttz = true; | 3087 const bool IsCttz = true; |
| 3088 lowerCountZeros(IsCttz, Val->getType(), Instr->getDest(), FirstVal, | 3088 lowerCountZeros(IsCttz, Val->getType(), Instr->getDest(), FirstVal, |
| 3089 SecondVal); | 3089 SecondVal); |
| 3090 return; | 3090 return; |
| 3091 } | 3091 } |
| 3092 case Intrinsics::Fabs: { |
| 3093 Operand *Src = legalize(Instr->getArg(0)); |
| 3094 Type Ty = Src->getType(); |
| 3095 Variable *Dest = Instr->getDest(); |
| 3096 Variable *T = makeVectorOfFabsMask(Ty); |
| 3097 _pand(T, Src); |
| 3098 if (isVectorType(Ty)) |
| 3099 _movp(Dest, T); |
| 3100 else |
| 3101 _mov(Dest, T); |
| 3102 return; |
| 3103 } |
| 3092 case Intrinsics::Longjmp: { | 3104 case Intrinsics::Longjmp: { |
| 3093 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2); | 3105 InstCall *Call = makeHelperCall(H_call_longjmp, nullptr, 2); |
| 3094 Call->addArg(Instr->getArg(0)); | 3106 Call->addArg(Instr->getArg(0)); |
| 3095 Call->addArg(Instr->getArg(1)); | 3107 Call->addArg(Instr->getArg(1)); |
| 3096 lowerCall(Call); | 3108 lowerCall(Call); |
| 3097 return; | 3109 return; |
| 3098 } | 3110 } |
| 3099 case Intrinsics::Memcpy: { | 3111 case Intrinsics::Memcpy: { |
| 3100 // In the future, we could potentially emit an inline memcpy/memset, etc. | 3112 // In the future, we could potentially emit an inline memcpy/memset, etc. |
| 3101 // for intrinsic calls w/ a known length. | 3113 // for intrinsic calls w/ a known length. |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4355 // SSE has no left shift operation for vectors of 8 bit integers. | 4367 // SSE has no left shift operation for vectors of 8 bit integers. |
| 4356 const uint32_t HIGH_ORDER_BITS_MASK = 0x80808080; | 4368 const uint32_t HIGH_ORDER_BITS_MASK = 0x80808080; |
| 4357 Constant *ConstantMask = Ctx->getConstantInt32(HIGH_ORDER_BITS_MASK); | 4369 Constant *ConstantMask = Ctx->getConstantInt32(HIGH_ORDER_BITS_MASK); |
| 4358 Variable *Reg = makeReg(Ty, RegNum); | 4370 Variable *Reg = makeReg(Ty, RegNum); |
| 4359 _movd(Reg, legalize(ConstantMask, Legal_Reg | Legal_Mem)); | 4371 _movd(Reg, legalize(ConstantMask, Legal_Reg | Legal_Mem)); |
| 4360 _pshufd(Reg, Reg, Ctx->getConstantZero(IceType_i8)); | 4372 _pshufd(Reg, Reg, Ctx->getConstantZero(IceType_i8)); |
| 4361 return Reg; | 4373 return Reg; |
| 4362 } | 4374 } |
| 4363 } | 4375 } |
| 4364 | 4376 |
| 4377 // Construct a mask in a register that can be and'ed with a |
| 4378 // floating-point value to mask off its sign bit. The value will be |
| 4379 // <4 x 0x7fffffff> for f32 and v4f32, and <2 x 0x7fffffffffffffff> |
| 4380 // for f64. Construct it as vector of ones logically right shifted |
| 4381 // one bit. TODO(stichnot): Fix the wala TODO above, to represent |
| 4382 // vector constants in memory. |
| 4383 Variable *TargetX8632::makeVectorOfFabsMask(Type Ty, int32_t RegNum) { |
| 4384 Variable *Reg = makeVectorOfMinusOnes(Ty, RegNum); |
| 4385 _psrl(Reg, Ctx->getConstantInt8(1)); |
| 4386 return Reg; |
| 4387 } |
| 4388 |
| 4365 OperandX8632Mem *TargetX8632::getMemoryOperandForStackSlot(Type Ty, | 4389 OperandX8632Mem *TargetX8632::getMemoryOperandForStackSlot(Type Ty, |
| 4366 Variable *Slot, | 4390 Variable *Slot, |
| 4367 uint32_t Offset) { | 4391 uint32_t Offset) { |
| 4368 // Ensure that Loc is a stack slot. | 4392 // Ensure that Loc is a stack slot. |
| 4369 assert(Slot->getWeight().isZero()); | 4393 assert(Slot->getWeight().isZero()); |
| 4370 assert(Slot->getRegNum() == Variable::NoRegister); | 4394 assert(Slot->getRegNum() == Variable::NoRegister); |
| 4371 // Compute the location of Loc in memory. | 4395 // Compute the location of Loc in memory. |
| 4372 // TODO(wala,stichnot): lea should not be required. The address of | 4396 // TODO(wala,stichnot): lea should not be required. The address of |
| 4373 // the stack slot is known at compile time (although not until after | 4397 // the stack slot is known at compile time (although not until after |
| 4374 // addProlog()). | 4398 // addProlog()). |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4798 case FT_Asm: | 4822 case FT_Asm: |
| 4799 case FT_Iasm: { | 4823 case FT_Iasm: { |
| 4800 OstreamLocker L(Ctx); | 4824 OstreamLocker L(Ctx); |
| 4801 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 4825 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
| 4802 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 4826 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
| 4803 } break; | 4827 } break; |
| 4804 } | 4828 } |
| 4805 } | 4829 } |
| 4806 | 4830 |
| 4807 } // end of namespace Ice | 4831 } // end of namespace Ice |
| OLD | NEW |