[llvm-commits] [llvm] r51140 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h

Evan Cheng evan.cheng at apple.com
Thu May 15 23:55:16 PDT 2008


It's a last minute fix (caused a dejagnu test failure). We are  
normalizing zero vector (and probably others) to v4i32. Obviously it  
won't work if SSE2 is not available. I intend to fix it properly soon.

Evan

On May 15, 2008, at 8:10 PM, Chris Lattner wrote:

> Hi Evan,
>
> On May 15, 2008, at 1:39 AM, Evan Cheng wrote:
>
>> /// getZeroVector - Returns a vector of specified type with all zero
>> elements.
>> ///
>> -static SDOperand getZeroVector(MVT::ValueType VT, SelectionDAG
>> &DAG) {
>> +static SDOperand getZeroVector(MVT::ValueType VT, bool HasSSE2,
>> +                               SelectionDAG &DAG) {
>>  assert(MVT::isVector(VT) && "Expected a vector type");
>>
>>  // Always build zero vectors as <4 x i32> or <2 x i32> bitcasted
>> to their dest
>>  // type.  This ensures they get CSE'd.
>> -  SDOperand Cst = DAG.getTargetConstant(0, MVT::i32);
>>  SDOperand Vec;
>> -  if (MVT::getSizeInBits(VT) == 64)  // MMX
>> +  if (MVT::getSizeInBits(VT) == 64) { // MMX
>> +    SDOperand Cst = DAG.getTargetConstant(0, MVT::i32);
>>    Vec = DAG.getNode(ISD::BUILD_VECTOR, MVT::v2i32, Cst, Cst);
>> -  else                                              // SSE
>> +  } else if (HasSSE2) {  // SSE2
>> +    SDOperand Cst = DAG.getTargetConstant(0, MVT::i32);
>>    Vec = DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32, Cst, Cst, Cst,
>> Cst);
>> +  } else { // SSE1
>> +    SDOperand Cst = DAG.getTargetConstantFP(+0.0, MVT::f32);
>> +    Vec = DAG.getNode(ISD::BUILD_VECTOR, MVT::v4f32, Cst, Cst, Cst,
>> Cst);
>> +  }
>>  return DAG.getNode(ISD::BIT_CONVERT, VT, Vec);
>> }
>
> Why does this build a different vector type depending on whether SSE2
> is available or not?  Why not always make the v4f32 version?
>
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list