Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
      2 
      3 // Check initialization
      4 
      5 vector int test0 = (vector int)(1);       // CHECK: @test0 = global <4 x i32> <i32 1, i32 1, i32 1, i32 1>
      6 vector float test1 = (vector float)(1.0); // CHECK: @test1 = global <4 x float> <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
      7 
      8 void test2()
      9 {
     10   vector int vi;
     11   vector float vf;
     12   vi = (vector int)(1);             // CHECK: <i32 1, i32 1, i32 1, i32 1>
     13   vf = (vector float)(1.0);         // CHECK: <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
     14   vi = (vector int)(1, 2, 3, 4);    // CHECK: <i32 1, i32 2, i32 3, i32 4>
     15   vi = (vector int)(1, 2, 3, 4, 5); // CHECK: <i32 1, i32 2, i32 3, i32 4>
     16 
     17   vi = (vector int){1};             // CHECK: <i32 1, i32 0, i32 0, i32 0>
     18   vi = (vector int){1, 2};          // CHECK: <i32 1, i32 2, i32 0, i32 0>
     19   vi = (vector int){1, 2, 3, 4};    // CHECK: <i32 1, i32 2, i32 3, i32 4>
     20 
     21 }
     22 
     23 // Check pre/post increment/decrement
     24 void test3() {
     25   vector int vi;
     26   vi++;                                    // CHECK: add <4 x i32> {{.*}} <i32 1, i32 1, i32 1, i32 1>
     27   vector unsigned int vui;
     28   --vui;                                   // CHECK: add <4 x i32> {{.*}} <i32 -1, i32 -1, i32 -1, i32 -1>
     29   vector float vf;
     30   vf++;                                    // CHECK: fadd <4 x float> {{.*}} <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
     31 }
     32