comparison clang/test/Sema/ext_vector_comparisons.c @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900 (2022-11-09)
parents 79ff65ed7e25
children
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s 1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unreachable-code %s
2 2
3 typedef __attribute__(( ext_vector_type(4) )) int int4; 3 typedef __attribute__(( ext_vector_type(4) )) int int4;
4 4
5 static int4 test1() { 5 static int4 test1(void) {
6 int4 vec, rv; 6 int4 vec, rv;
7 7
8 // comparisons to self... 8 // comparisons to self...
9 return vec == vec; // expected-warning{{self-comparison always evaluates to true}} 9 return vec == vec; // expected-warning{{self-comparison always evaluates to true}}
10 return vec != vec; // expected-warning{{self-comparison always evaluates to false}} 10 return vec != vec; // expected-warning{{self-comparison always evaluates to false}}
15 } 15 }
16 16
17 17
18 typedef __attribute__(( ext_vector_type(4) )) float float4; 18 typedef __attribute__(( ext_vector_type(4) )) float float4;
19 19
20 static int4 test2() { 20 static int4 test2(void) {
21 float4 vec, rv; 21 float4 vec, rv;
22 22
23 // comparisons to self. no warning, they're floats 23 // comparisons to self. no warning, they're floats
24 return vec == vec; // no-warning 24 return vec == vec; // no-warning
25 return vec != vec; // no-warning 25 return vec != vec; // no-warning
27 return vec <= vec; // no-warning 27 return vec <= vec; // no-warning
28 return vec > vec; // no-warning 28 return vec > vec; // no-warning
29 return vec >= vec; // no-warning 29 return vec >= vec; // no-warning
30 } 30 }
31 31
32 static int4 test3() { 32 static int4 test3(void) {
33 int4 i0, i1; 33 int4 i0, i1;
34 34
35 return i0 > i1 ? i0 : i1; // no-error 35 return i0 > i1 ? i0 : i1; // no-error
36 return i0 ? i0 : i1; // no-error 36 return i0 ? i0 : i1; // no-error
37 } 37 }
38 38
39 static float4 test4() { 39 static float4 test4(void) {
40 float4 f0, f1; 40 float4 f0, f1;
41 41
42 // This would actually generate implicit casting warning 42 // This would actually generate implicit casting warning
43 // under Weverything flag but we don't really care here 43 // under Weverything flag but we don't really care here
44 return f0 > f1 ? f0 : f1; // no-error 44 return f0 > f1 ? f0 : f1; // no-error