[cfe-dev] problems with vector code

Chris Lattner clattner at apple.com
Tue Mar 23 08:42:20 PDT 2010


Sounds bad, please add self contained testcases with info to reproduce  
to a bugzilla, thanks!

-Chris

On Mar 23, 2010, at 4:37 AM, Jochen Wilhelmy <j.wilhelmy at arcor.de>  
wrote:

> Hi!
>
> when playing with the builtin vectors (ext_vector_type) I have some
> problems.
> My codeGenOptions bypass all optimizations:
>
> clang::CodeGenOptions codeGenOptions;
> codeGenOptions.DisableLLVMOpts = 1;
> codeGenOptions.OptimizationLevel = 0;
> codeGenOptions.Inlining = clang::CodeGenOptions::NormalInlining;
>
>
> I have a function with this prototype: float4 foo(float4 y)
>
>
> **Test case 1 (works):
>
> return (float4)(y);
>
> yiels:
>
>  ret <4 x float> %y
>
>
> **Test case 2 (fails):
>
> return (float4)(y.x, y.y, y.z, y.w);
>
> yields:
>
> %tmp1 = extractelement <4 x float> %y, i32 0    ; <float> [#uses=0]
>   %tmp3 = extractelement <4 x float> %y, i32 1    ; <float> [#uses=0]
>   %tmp5 = extractelement <4 x float> %y, i32 2    ; <float> [#uses=0]
>   %tmp7 = extractelement <4 x float> %y, i32 3    ; <float> [#uses=1]
>   %tmp8 = insertelement <4 x float> undef, float %tmp7, i32 0 ; <<4 x
> float>> [#uses=2]
>   %splat = shufflevector <4 x float> %tmp8, <4 x float> %tmp8, <4 x
> i32> zeroinitializer ; <<4 x float>> [#uses=1]
>   ret <4 x float> %splat
>
>
> **Test case 3 (fails):
>
> return (float4)(y.xyz, y.w);
>
> yields:
>
>  %tmp1 = shufflevector <4 x float> %y, <4 x float> undef, <3 x i32>
> <i32 0, i32 1, i32 2> ; <<3 x float>> [#uses=0]
>   %tmp3 = extractelement <4 x float> %y, i32 3    ; <float> [#uses=1]
>   %tmp4 = insertelement <4 x float> undef, float %tmp3, i32 0 ; <<4 x
> float>> [#uses=2]
>   %splat = shufflevector <4 x float> %tmp4, <4 x float> %tmp4, <4 x
> i32> zeroinitializer ; <<4 x float>> [#uses=1]
>   ret <4 x float> %splat
>
>
> **Test case 4 (does not compile):
>
> return (float4)(y.x, y.yzw);
>
> Assertion failed: castIsValid(getOpcode(), S, Ty) && "Illegal  
> BitCast",
> file ..\
> ..\..\lib\VMCore\Instructions.cpp, line 2719
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list