summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2011-10-17 21:00:38 +0000
committerTanya Lattner <tonic@nondot.org>2011-10-17 21:00:38 +0000
commit49b38413985c5e74790d9f6ff9459c82773e932f (patch)
tree5f7a2fbddaf0d4dbe3f7550d0c1e1aca53362558 /clang/test
parent502d2eee0993186a6eb4a9c8647a0e44d9a76e6a (diff)
downloadbcm5719-llvm-49b38413985c5e74790d9f6ff9459c82773e932f.tar.gz
bcm5719-llvm-49b38413985c5e74790d9f6ff9459c82773e932f.zip
The comparison of two vectors should return a signed result. hasIntegerRepresentation() used to always return false for vectors, but since it was changed, it also
changed the return type of a compare of two unsigned vectors to be unsigned. This patch removes the check for hasIntegerRepresentation since its not needed and returns the appropriate signed type. I added a new test case and updated exisiting test cases that assumed an unsigned result. llvm-svn: 142250
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/ext-vector.c15
-rw-r--r--clang/test/Sema/vector-ops.c5
-rw-r--r--clang/test/SemaOpenCL/vec_compare.cl11
3 files changed, 22 insertions, 9 deletions
diff --git a/clang/test/CodeGen/ext-vector.c b/clang/test/CodeGen/ext-vector.c
index a222f9445e0..896814bc24a 100644
--- a/clang/test/CodeGen/ext-vector.c
+++ b/clang/test/CodeGen/ext-vector.c
@@ -252,7 +252,8 @@ int4 test13(int4 *V) {
void test14(uint4 *ap, uint4 *bp, unsigned c) {
uint4 a = *ap;
uint4 b = *bp;
-
+ int4 d;
+
// CHECK: udiv <4 x i32>
// CHECK: urem <4 x i32>
a = a / b;
@@ -269,10 +270,10 @@ void test14(uint4 *ap, uint4 *bp, unsigned c) {
// CHECK: icmp uge
// CHECK: icmp eq
// CHECK: icmp ne
- a = a < b;
- a = a <= b;
- a = a > b;
- a = a >= b;
- a = a == b;
- a = a != b;
+ d = a < b;
+ d = a <= b;
+ d = a > b;
+ d = a >= b;
+ d = a == b;
+ d = a != b;
}
diff --git a/clang/test/Sema/vector-ops.c b/clang/test/Sema/vector-ops.c
index ca397375d73..c3f84aae40a 100644
--- a/clang/test/Sema/vector-ops.c
+++ b/clang/test/Sema/vector-ops.c
@@ -13,8 +13,9 @@ void test1(v2u v2ua, v2s v2sa, v2f v2fa) {
(void)(~v2fa); // expected-error{{invalid argument type 'v2f' to unary}}
// Comparison operators
- v2ua = (v2ua==v2sa);
-
+ v2ua = (v2ua==v2sa); // expected-warning{{incompatible vector types assigning to 'v2u' from 'int __attribute__((ext_vector_type(2)))'}}
+ v2sa = (v2ua==v2sa);
+
// Arrays
int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u'}}
int array2[17];
diff --git a/clang/test/SemaOpenCL/vec_compare.cl b/clang/test/SemaOpenCL/vec_compare.cl
new file mode 100644
index 00000000000..dd91aa592ab
--- /dev/null
+++ b/clang/test/SemaOpenCL/vec_compare.cl
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+typedef __attribute__((ext_vector_type(2))) unsigned int uint2;
+typedef __attribute__((ext_vector_type(2))) int int2;
+
+void unsignedCompareOps()
+{
+ uint2 A, B;
+ int2 result = A != B;
+}
+
OpenPOWER on IntegriCloud