[llvm-commits] [llvm] r115243 - in /llvm/trunk: include/llvm/ lib/CodeGen/SelectionDAG/ lib/Target/X86/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ test/Assembler/ test/Bitcode/ test/CodeGen/X86/ utils/TableGen/

Nick Lewycky nicholas at mxc.ca
Thu Sep 30 17:14:33 PDT 2010


Dale Johannesen wrote:
> Author: johannes
> Date: Thu Sep 30 18:57:10 2010
> New Revision: 115243
>
> URL: http://llvm.org/viewvc/llvm-project?rev=115243&view=rev
> Log:
> Massive rewrite of MMX:
> The x86_mmx type is used for MMX intrinsics, parameters and
> return values where these use MMX registers, and is also
> supported in load, store, and bitcast.
>
> Only the above operations generate MMX instructions, and optimizations
> do not operate on or produce MMX intrinsics.
>
> MMX-sized vectors<2 x i32>  etc. are lowered to XMM or split into
> smaller pieces.  Optimizations may occur on these forms and the
> result casted back to x86_mmx, provided the result feeds into a
> previous existing x86_mmx operation.
>
> The point of all this is prevent optimizations from introducing
> MMX operations, which is unsafe due to the EMMS problem.

Please update docs/LangRef.html to document the new type!

[more below]

> Modified: llvm/trunk/lib/VMCore/Instructions.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=115243&r1=115242&r2=115243&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
> +++ llvm/trunk/lib/VMCore/Instructions.cpp Thu Sep 30 18:57:10 2010
> @@ -2360,6 +2360,8 @@
>       } else {                                    // Casting from something else
>         return false;
>       }
> +  } else if (DestTy->isX86_MMXTy()) {
> +    return SrcBits == 64;
>     } else {                                      // Casting to something else
>       return false;
>     }
> @@ -2441,6 +2443,10 @@
>         return BitCast;                             // vector ->  vector
>       } else if (DestPTy->getBitWidth() == SrcBits) {
>         return BitCast;                               // float/int ->  vector
> +    } else if (SrcTy->isX86_MMXTy()) {
> +      assert(DestPTy->getBitWidth()==64&&
> +             "Casting X86_MMX to vector of wrong width");
> +      return BitCast;                             // MMX to 64-bit vector
>       } else {
>         assert(!"Illegal cast to vector (wrong type or size)");
>       }
> @@ -2452,6 +2458,14 @@
>       } else {
>         assert(!"Casting pointer to other than pointer or int");
>       }
> +  } else if (DestTy->isX86_MMXTy()) {
> +    if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) {
> +      assert(SrcPTy->getBitWidth()==64&&
> +             "Casting vector of wrong width to X86_MMX");

cc1plus: warnings being treated as errors
lib/VMCore/Instructions.cpp: In static member function 'static 
llvm::Instruction::CastOps llvm::CastInst::getCastOpcode(const 
llvm::Value*, bool, const llvm::Type*, bool)':
lib/VMCore/Instructions.cpp: 2462: error: unused variable 'SrcPTy' 
[-Wunused-variable]

Please fix!

Nick

> +      return BitCast;                               // 64-bit vector to MMX
> +    } else {
> +      assert(!"Illegal cast to X86_MMX");
> +    }
>     } else {
>       assert(!"Casting to type that is not first-class");
>     }
>



More information about the llvm-commits mailing list