From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CodeGen/altivec.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 clang/test/CodeGen/altivec.c (limited to 'clang/test/CodeGen/altivec.c') diff --git a/clang/test/CodeGen/altivec.c b/clang/test/CodeGen/altivec.c new file mode 100644 index 0000000..2982303 --- /dev/null +++ b/clang/test/CodeGen/altivec.c @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s + +// Check initialization + +vector int test0 = (vector int)(1); // CHECK: @test0 = global <4 x i32> +vector float test1 = (vector float)(1.0); // CHECK: @test1 = global <4 x float> + +// CHECK: @v1 = global <16 x i8> +vector char v1 = (vector char)((vector int)(1, 2, 3, 4)); +// CHECK: @v2 = global <16 x i8> +vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f)); +// CHECK: @v3 = global <16 x i8> +vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd')); +// CHECK: @v4 = global <4 x i32> +vector int v4 = (vector char){1, 2, 3, 4}; + +void test2() +{ + vector int vi; + vector float vf; + vi = (vector int)(1); // CHECK: + vf = (vector float)(1.0); // CHECK: + vi = (vector int)(1, 2, 3, 4); // CHECK: + vi = (vector int)(1, 2, 3, 4, 5); // CHECK: + + vi = (vector int){1}; // CHECK: + vi = (vector int){1, 2}; // CHECK: + vi = (vector int){1, 2, 3, 4}; // CHECK: + +} + +// Check pre/post increment/decrement +void test3() { + vector int vi; + vi++; // CHECK: add <4 x i32> {{.*}} + vector unsigned int vui; + --vui; // CHECK: add <4 x i32> {{.*}} + vector float vf; + vf++; // CHECK: fadd <4 x float> {{.*}} +} -- cgit v1.2.3