diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-10 17:55:23 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-02-10 17:55:23 +0000 |
commit | 99af1e11b28103388a1ae9f9e811706bd52c6f0e (patch) | |
tree | 27ef533c598a5e6b2062a658b32532ebd19a29bc /clang/test | |
parent | 3a7e447cd66cd2b5f49f5938b1938d0842727f98 (diff) | |
download | bcm5719-llvm-99af1e11b28103388a1ae9f9e811706bd52c6f0e.tar.gz bcm5719-llvm-99af1e11b28103388a1ae9f9e811706bd52c6f0e.zip |
Add vector add/sub/mul/div by scalar tests (PR27085)
Ensure the scalar is correctly splatted to all lanes
llvm-svn: 324818
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/vector-scalar.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/CodeGen/vector-scalar.c b/clang/test/CodeGen/vector-scalar.c new file mode 100644 index 00000000000..0c973cd41ee --- /dev/null +++ b/clang/test/CodeGen/vector-scalar.c @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// PR27085 + +typedef unsigned char uchar4 __attribute__ ((vector_size (4))); + +// CHECK: @add2 +// CHECK: add <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2> +uchar4 add2(uchar4 v) +{ + return v + 2; +} + +// CHECK: @sub2 +// CHECK: sub <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2> +uchar4 sub2(uchar4 v) +{ + return v - 2; +} + +// CHECK: @mul2 +// CHECK: mul <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2> +uchar4 mul2(uchar4 v) +{ + return v * 2; +} + +// CHECK: @div2 +// CHECK: udiv <4 x i8> {{.*}}, <i8 2, i8 2, i8 2, i8 2> +uchar4 div2(uchar4 v) +{ + return v / 2; +} + +typedef __attribute__(( ext_vector_type(4) )) unsigned char uchar4_ext; + +// CHECK: @div3_ext +// CHECK: udiv <4 x i8> %{{.*}}, <i8 3, i8 3, i8 3, i8 3> +uchar4_ext div3_ext(uchar4_ext v) +{ + return v / 3; +} |