diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 |
commit | 798321d8eb5630cd4a8f490a4f25e32ef195fb07 (patch) | |
tree | a59f5569ef36d00388c0428426abef26aa9105b6 /test | |
parent | 5e20cdd81c44a443562a09007668ffdf76c455af (diff) |
Notes
Diffstat (limited to 'test')
74 files changed, 1494 insertions, 145 deletions
diff --git a/test/ASTMerge/codegen-body.c b/test/ASTMerge/codegen-body.c index a5c260cd91bb1..7232bf4164b58 100644 --- a/test/ASTMerge/codegen-body.c +++ b/test/ASTMerge/codegen-body.c @@ -1,4 +1,3 @@ -// XFAIL: hexagon // RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/body1.c // RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/body2.c // RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s diff --git a/test/CodeGen/atomic-ops.c b/test/CodeGen/atomic-ops.c index 733c60eb859c4..13ab5f117f93f 100644 --- a/test/CodeGen/atomic-ops.c +++ b/test/CodeGen/atomic-ops.c @@ -105,6 +105,14 @@ int fi3e(atomic_int *i) { return atomic_fetch_or(i, 1); } +int fi3f(int *i) { + // CHECK-LABEL: @fi3f + // CHECK-NOT: store volatile + // CHECK: atomicrmw or + // CHECK-NOT: {{ or }} + return __atomic_fetch_or(i, (short)1, memory_order_seq_cst); +} + _Bool fi4(_Atomic(int) *i) { // CHECK-LABEL: @fi4( // CHECK: [[PAIR:%[.0-9A-Z_a-z]+]] = cmpxchg i32* [[PTR:%[.0-9A-Z_a-z]+]], i32 [[EXPECTED:%[.0-9A-Z_a-z]+]], i32 [[DESIRED:%[.0-9A-Z_a-z]+]] diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index 2f19f99e4f257..a49a1982bf47c 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -8,14 +8,14 @@ __m512d test_mm512_sqrt_pd(__m512d a) { // CHECK-LABEL: @test_mm512_sqrt_pd - // CHECK: @llvm.x86.avx512.sqrt.pd.512 + // CHECK: @llvm.x86.avx512.mask.sqrt.pd.512 return _mm512_sqrt_pd(a); } __m512 test_mm512_sqrt_ps(__m512 a) { // CHECK-LABEL: @test_mm512_sqrt_ps - // CHECK: @llvm.x86.avx512.sqrt.ps.512 + // CHECK: @llvm.x86.avx512.mask.sqrt.ps.512 return _mm512_sqrt_ps(a); } @@ -898,4 +898,4 @@ __m512i test_mm512_mullo_epi32(__m512i __A, __m512i __B) { //CHECK-LABEL: @test_mm512_mullo_epi32 //CHECK: mul <16 x i32> return _mm512_mullo_epi32(__A,__B); -}
\ No newline at end of file +} diff --git a/test/CodeGen/builtins-ppc-p8vector.c b/test/CodeGen/builtins-ppc-p8vector.c index c91686c0ea7cf..f74bbad9daf00 100644 --- a/test/CodeGen/builtins-ppc-p8vector.c +++ b/test/CodeGen/builtins-ppc-p8vector.c @@ -7,22 +7,22 @@ vector int vi = { -1, 2, -3, 4 }; vector unsigned int vui = { 1, 2, 3, 4 }; vector bool int vbi = {0, -1, -1, 0}; vector bool long long vbll = { 1, 0 }; -vector long long vll = { 1, 2 }; +vector signed long long vsll = { 1, 2 }; vector unsigned long long vull = { 1, 2 }; int res_i; vector int res_vi; vector unsigned int res_vui; vector bool int res_vbi; -vector long long res_vll; -vector unsigned long long res_vull; vector bool long long res_vbll; +vector signed long long res_vsll; +vector unsigned long long res_vull; // CHECK-LABEL: define void @test1 void test1() { /* vec_cmpeq */ - res_vbll = vec_cmpeq(vll, vll); + res_vbll = vec_cmpeq(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd // CHECK-LE: @llvm.ppc.altivec.vcmpequd // CHECK-PPC: error: call to 'vec_cmpeq' is ambiguous @@ -33,7 +33,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_cmpeq' is ambiguous /* vec_cmpgt */ - res_vbll = vec_cmpgt(vll, vll); + res_vbll = vec_cmpgt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd // CHECK-PPC: error: call to 'vec_cmpgt' is ambiguous @@ -45,12 +45,12 @@ void test1() { /* ----------------------- predicates --------------------------- */ /* vec_all_eq */ - res_i = vec_all_eq(vll, vll); + res_i = vec_all_eq(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_eq' is ambiguous - res_i = vec_all_eq(vll, vbll); + res_i = vec_all_eq(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_eq' is ambiguous @@ -65,7 +65,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_eq' is ambiguous - res_i = vec_all_eq(vbll, vll); + res_i = vec_all_eq(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_eq' is ambiguous @@ -81,12 +81,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_eq' is ambiguous /* vec_all_ne */ - res_i = vec_all_ne(vll, vll); + res_i = vec_all_ne(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_ne' is ambiguous - res_i = vec_all_ne(vll, vbll); + res_i = vec_all_ne(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_ne' is ambiguous @@ -101,7 +101,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_ne' is ambiguous - res_i = vec_all_ne(vbll, vll); + res_i = vec_all_ne(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_all_ne' is ambiguous @@ -117,12 +117,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_ne' is ambiguous /* vec_any_eq */ - res_i = vec_any_eq(vll, vll); + res_i = vec_any_eq(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_eq' is ambiguous - res_i = vec_any_eq(vll, vbll); + res_i = vec_any_eq(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_eq' is ambiguous @@ -137,7 +137,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_eq' is ambiguous - res_i = vec_any_eq(vbll, vll); + res_i = vec_any_eq(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_eq' is ambiguous @@ -153,12 +153,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_eq' is ambiguous /* vec_any_ne */ - res_i = vec_any_ne(vll, vll); + res_i = vec_any_ne(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_ne' is ambiguous - res_i = vec_any_ne(vll, vbll); + res_i = vec_any_ne(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_ne' is ambiguous @@ -173,7 +173,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_ne' is ambiguous - res_i = vec_any_ne(vbll, vll); + res_i = vec_any_ne(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd.p // CHECK-LE: @llvm.ppc.altivec.vcmpequd.p // CHECK-PPC: error: call to 'vec_any_ne' is ambiguous @@ -189,12 +189,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_ne' is ambiguous /* vec_all_ge */ - res_i = vec_all_ge(vll, vll); + res_i = vec_all_ge(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_ge' is ambiguous - res_i = vec_all_ge(vll, vbll); + res_i = vec_all_ge(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_ge' is ambiguous @@ -209,7 +209,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_ge' is ambiguous - res_i = vec_all_ge(vbll, vll); + res_i = vec_all_ge(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_ge' is ambiguous @@ -225,12 +225,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_ge' is ambiguous /* vec_all_gt */ - res_i = vec_all_gt(vll, vll); + res_i = vec_all_gt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_gt' is ambiguous - res_i = vec_all_gt(vll, vbll); + res_i = vec_all_gt(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_gt' is ambiguous @@ -245,7 +245,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_gt' is ambiguous - res_i = vec_all_gt(vbll, vll); + res_i = vec_all_gt(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_gt' is ambiguous @@ -261,12 +261,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_gt' is ambiguous /* vec_all_le */ - res_i = vec_all_le(vll, vll); + res_i = vec_all_le(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_le' is ambiguous - res_i = vec_all_le(vll, vbll); + res_i = vec_all_le(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_le' is ambiguous @@ -281,7 +281,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_le' is ambiguous - res_i = vec_all_le(vbll, vll); + res_i = vec_all_le(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_le' is ambiguous @@ -297,12 +297,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_le' is ambiguous /* vec_all_lt */ - res_i = vec_all_lt(vll, vll); + res_i = vec_all_lt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_lt' is ambiguous - res_i = vec_all_lt(vll, vbll); + res_i = vec_all_lt(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_all_lt' is ambiguous @@ -317,7 +317,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_lt' is ambiguous - res_i = vec_all_lt(vbll, vll); + res_i = vec_all_lt(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_all_lt' is ambiguous @@ -333,12 +333,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_all_lt' is ambiguous /* vec_any_ge */ - res_i = vec_any_ge(vll, vll); + res_i = vec_any_ge(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_ge' is ambiguous - res_i = vec_any_ge(vll, vbll); + res_i = vec_any_ge(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_ge' is ambiguous @@ -353,7 +353,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_ge' is ambiguous - res_i = vec_any_ge(vbll, vll); + res_i = vec_any_ge(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_ge' is ambiguous @@ -369,12 +369,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_ge' is ambiguous /* vec_any_gt */ - res_i = vec_any_gt(vll, vll); + res_i = vec_any_gt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_gt' is ambiguous - res_i = vec_any_gt(vll, vbll); + res_i = vec_any_gt(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_gt' is ambiguous @@ -389,7 +389,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_gt' is ambiguous - res_i = vec_any_gt(vbll, vll); + res_i = vec_any_gt(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_gt' is ambiguous @@ -405,12 +405,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_gt' is ambiguous /* vec_any_le */ - res_i = vec_any_le(vll, vll); + res_i = vec_any_le(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_le' is ambiguous - res_i = vec_any_le(vll, vbll); + res_i = vec_any_le(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_le' is ambiguous @@ -425,7 +425,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_le' is ambiguous - res_i = vec_any_le(vbll, vll); + res_i = vec_any_le(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_le' is ambiguous @@ -441,12 +441,12 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_le' is ambiguous /* vec_any_lt */ - res_i = vec_any_lt(vll, vll); + res_i = vec_any_lt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_lt' is ambiguous - res_i = vec_any_lt(vll, vbll); + res_i = vec_any_lt(vsll, vbll); // CHECK: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtsd.p // CHECK-PPC: error: call to 'vec_any_lt' is ambiguous @@ -461,7 +461,7 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_lt' is ambiguous - res_i = vec_any_lt(vbll, vll); + res_i = vec_any_lt(vbll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtud.p // CHECK-LE: @llvm.ppc.altivec.vcmpgtud.p // CHECK-PPC: error: call to 'vec_any_lt' is ambiguous @@ -477,17 +477,17 @@ void test1() { // CHECK-PPC: error: call to 'vec_any_lt' is ambiguous /* vec_max */ - res_vll = vec_max(vll, vll); + res_vsll = vec_max(vsll, vsll); // CHECK: @llvm.ppc.altivec.vmaxsd // CHECK-LE: @llvm.ppc.altivec.vmaxsd // CHECK-PPC: error: call to 'vec_max' is ambiguous - res_vll = vec_max(vbll, vll); + res_vsll = vec_max(vbll, vsll); // CHECK: @llvm.ppc.altivec.vmaxsd // CHECK-LE: @llvm.ppc.altivec.vmaxsd // CHECK-PPC: error: call to 'vec_max' is ambiguous - res_vll = vec_max(vll, vbll); + res_vsll = vec_max(vsll, vbll); // CHECK: @llvm.ppc.altivec.vmaxsd // CHECK-LE: @llvm.ppc.altivec.vmaxsd // CHECK-PPC: error: call to 'vec_max' is ambiguous @@ -508,17 +508,17 @@ void test1() { // CHECK-PPC: error: call to 'vec_max' is ambiguous /* vec_min */ - res_vll = vec_min(vll, vll); + res_vsll = vec_min(vsll, vsll); // CHECK: @llvm.ppc.altivec.vminsd // CHECK-LE: @llvm.ppc.altivec.vminsd // CHECK-PPC: error: call to 'vec_min' is ambiguous - res_vll = vec_min(vbll, vll); + res_vsll = vec_min(vbll, vsll); // CHECK: @llvm.ppc.altivec.vminsd // CHECK-LE: @llvm.ppc.altivec.vminsd // CHECK-PPC: error: call to 'vec_min' is ambiguous - res_vll = vec_min(vll, vbll); + res_vsll = vec_min(vsll, vbll); // CHECK: @llvm.ppc.altivec.vminsd // CHECK-LE: @llvm.ppc.altivec.vminsd // CHECK-PPC: error: call to 'vec_min' is ambiguous @@ -539,7 +539,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_min' is ambiguous /* vec_mule */ - res_vll = vec_mule(vi, vi); + res_vsll = vec_mule(vi, vi); // CHECK: @llvm.ppc.altivec.vmulesw // CHECK-LE: @llvm.ppc.altivec.vmulosw // CHECK-PPC: error: call to 'vec_mule' is ambiguous @@ -550,7 +550,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_mule' is ambiguous /* vec_mulo */ - res_vll = vec_mulo(vi, vi); + res_vsll = vec_mulo(vi, vi); // CHECK: @llvm.ppc.altivec.vmulosw // CHECK-LE: @llvm.ppc.altivec.vmulesw // CHECK-PPC: error: call to 'vec_mulo' is ambiguous @@ -561,7 +561,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_mulo' is ambiguous /* vec_packs */ - res_vi = vec_packs(vll, vll); + res_vi = vec_packs(vsll, vsll); // CHECK: @llvm.ppc.altivec.vpksdss // CHECK-LE: @llvm.ppc.altivec.vpksdss // CHECK-PPC: error: call to 'vec_packs' is ambiguous @@ -572,7 +572,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_packs' is ambiguous /* vec_packsu */ - res_vui = vec_packsu(vll, vll); + res_vui = vec_packsu(vsll, vsll); // CHECK: @llvm.ppc.altivec.vpksdus // CHECK-LE: @llvm.ppc.altivec.vpksdus // CHECK-PPC: error: call to 'vec_packsu' is ambiguous @@ -583,7 +583,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_packsu' is ambiguous /* vec_rl */ - res_vll = vec_rl(vll, vull); + res_vsll = vec_rl(vsll, vull); // CHECK: @llvm.ppc.altivec.vrld // CHECK-LE: @llvm.ppc.altivec.vrld // CHECK-PPC: error: call to 'vec_rl' is ambiguous @@ -594,7 +594,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_rl' is ambiguous /* vec_sl */ - res_vll = vec_sl(vll, vull); + res_vsll = vec_sl(vsll, vull); // CHECK: shl <2 x i64> // CHECK-LE: shl <2 x i64> // CHECK-PPC: error: call to 'vec_sl' is ambiguous @@ -605,7 +605,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_sl' is ambiguous /* vec_sr */ - res_vll = vec_sr(vll, vull); + res_vsll = vec_sr(vsll, vull); // CHECK: ashr <2 x i64> // CHECK-LE: ashr <2 x i64> // CHECK-PPC: error: call to 'vec_sr' is ambiguous @@ -616,7 +616,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_sr' is ambiguous /* vec_sra */ - res_vll = vec_sra(vll, vull); + res_vsll = vec_sra(vsll, vull); // CHECK: ashr <2 x i64> // CHECK-LE: ashr <2 x i64> // CHECK-PPC: error: call to 'vec_sra' is ambiguous @@ -627,7 +627,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_sra' is ambiguous /* vec_unpackh */ - res_vll = vec_unpackh(vi); + res_vsll = vec_unpackh(vi); // CHECK: llvm.ppc.altivec.vupkhsw // CHECK-LE: llvm.ppc.altivec.vupklsw // CHECK-PPC: error: call to 'vec_unpackh' is ambiguous @@ -638,7 +638,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_unpackh' is ambiguous /* vec_unpackl */ - res_vll = vec_unpackl(vi); + res_vsll = vec_unpackl(vi); // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw // CHECK-PPC: error: call to 'vec_unpackl' is ambiguous @@ -649,19 +649,19 @@ void test1() { // CHECK-PPC: error: call to 'vec_unpackl' is ambiguous /* vec_vpksdss */ - res_vi = vec_vpksdss(vll, vll); + res_vi = vec_vpksdss(vsll, vsll); // CHECK: llvm.ppc.altivec.vpksdss // CHECK-LE: llvm.ppc.altivec.vpksdss // CHECK-PPC: warning: implicit declaration of function 'vec_vpksdss' /* vec_vpksdus */ - res_vui = vec_vpksdus(vll, vll); + res_vui = vec_vpksdus(vsll, vsll); // CHECK: llvm.ppc.altivec.vpksdus // CHECK-LE: llvm.ppc.altivec.vpksdus // CHECK-PPC: warning: implicit declaration of function 'vec_vpksdus' /* vec_vpkudum */ - res_vi = vec_vpkudum(vll, vll); + res_vi = vec_vpkudum(vsll, vsll); // CHECK: vperm // CHECK-LE: vperm // CHECK-PPC: warning: implicit declaration of function 'vec_vpkudum' @@ -676,7 +676,7 @@ void test1() { // CHECK-PPC: warning: implicit declaration of function 'vec_vpkudus' /* vec_vupkhsw */ - res_vll = vec_vupkhsw(vi); + res_vsll = vec_vupkhsw(vi); // CHECK: llvm.ppc.altivec.vupkhsw // CHECK-LE: llvm.ppc.altivec.vupklsw // CHECK-PPC: warning: implicit declaration of function 'vec_vupkhsw' @@ -686,7 +686,7 @@ void test1() { // CHECK-LE: llvm.ppc.altivec.vupklsw /* vec_vupklsw */ - res_vll = vec_vupklsw(vi); + res_vsll = vec_vupklsw(vi); // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw // CHECK-PPC: warning: implicit declaration of function 'vec_vupklsw' @@ -695,4 +695,46 @@ void test1() { // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw + /* vec_max */ + res_vsll = vec_max(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vmaxsd +// CHECK-LE: @llvm.ppc.altivec.vmaxsd + + res_vsll = vec_max(vbll, vsll); +// CHECK: @llvm.ppc.altivec.vmaxsd +// CHECK-LE: @llvm.ppc.altivec.vmaxsd + + res_vsll = vec_max(vsll, vbll); +// CHECK: @llvm.ppc.altivec.vmaxsd +// CHECK-LE: @llvm.ppc.altivec.vmaxsd + + res_vull = vec_max(vull, vull); +// CHECK: @llvm.ppc.altivec.vmaxud +// CHECK-LE: @llvm.ppc.altivec.vmaxud + + res_vull = vec_max(vbll, vull); +// CHECK: @llvm.ppc.altivec.vmaxud +// CHECK-LE: @llvm.ppc.altivec.vmaxud + + /* vec_min */ + res_vsll = vec_min(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vminsd +// CHECK-LE: @llvm.ppc.altivec.vminsd + + res_vsll = vec_min(vbll, vsll); +// CHECK: @llvm.ppc.altivec.vminsd +// CHECK-LE: @llvm.ppc.altivec.vminsd + + res_vsll = vec_min(vsll, vbll); +// CHECK: @llvm.ppc.altivec.vminsd +// CHECK-LE: @llvm.ppc.altivec.vminsd + + res_vull = vec_min(vull, vull); +// CHECK: @llvm.ppc.altivec.vminud +// CHECK-LE: @llvm.ppc.altivec.vminud + + res_vull = vec_min(vbll, vull); +// CHECK: @llvm.ppc.altivec.vminud +// CHECK-LE: @llvm.ppc.altivec.vminud + } diff --git a/test/CodeGen/builtins-ppc-vsx.c b/test/CodeGen/builtins-ppc-vsx.c index 58a8cc32dce30..631cb6ccafbed 100644 --- a/test/CodeGen/builtins-ppc-vsx.c +++ b/test/CodeGen/builtins-ppc-vsx.c @@ -7,6 +7,7 @@ vector float vf = { -1.5, 2.5, -3.5, 4.5 }; vector double vd = { 3.5, -7.5 }; vector signed int vsi = { -1, 2, -3, 4 }; vector unsigned int vui = { 0, 1, 2, 3 }; +vector bool long long vbll = { 1, 0 }; vector signed long long vsll = { 255LL, -937LL }; vector unsigned long long vull = { 1447LL, 2894LL }; double d = 23.4; @@ -15,6 +16,7 @@ vector float res_vf; vector double res_vd; vector signed int res_vsi; vector unsigned int res_vui; +vector bool long long res_vbll; vector signed long long res_vsll; vector unsigned long long res_vull; double res_d; @@ -113,4 +115,179 @@ void test1() { vec_vsx_st(vd, 0, &res_vd); // CHECK: @llvm.ppc.vsx.stxvd2x + + /* vec_and */ + res_vsll = vec_and(vsll, vsll); +// CHECK: and <2 x i64> + + res_vsll = vec_and(vbll, vsll); +// CHECK: and <2 x i64> + + res_vsll = vec_and(vsll, vbll); +// CHECK: and <2 x i64> + + res_vull = vec_and(vull, vull); +// CHECK: and <2 x i64> + + res_vull = vec_and(vbll, vull); +// CHECK: and <2 x i64> + + res_vull = vec_and(vull, vbll); +// CHECK: and <2 x i64> + + res_vbll = vec_and(vbll, vbll); +// CHECK: and <2 x i64> + + /* vec_vand */ + res_vsll = vec_vand(vsll, vsll); +// CHECK: and <2 x i64> + + res_vsll = vec_vand(vbll, vsll); +// CHECK: and <2 x i64> + + res_vsll = vec_vand(vsll, vbll); +// CHECK: and <2 x i64> + + res_vull = vec_vand(vull, vull); +// CHECK: and <2 x i64> + + res_vull = vec_vand(vbll, vull); +// CHECK: and <2 x i64> + + res_vull = vec_vand(vull, vbll); +// CHECK: and <2 x i64> + + res_vbll = vec_vand(vbll, vbll); +// CHECK: and <2 x i64> + + /* vec_andc */ + res_vsll = vec_andc(vsll, vsll); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vsll = vec_andc(vbll, vsll); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vsll = vec_andc(vsll, vbll); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vull = vec_andc(vull, vull); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vull = vec_andc(vbll, vull); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vull = vec_andc(vull, vbll); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + res_vbll = vec_andc(vbll, vbll); +// CHECK: xor <2 x i64> +// CHECK: and <2 x i64> + + /* vec_nor */ + res_vsll = vec_nor(vsll, vsll); +// CHECK: or <2 x i64> +// CHECK: xor <2 x i64> + + res_vull = vec_nor(vull, vull); +// CHECK: or <2 x i64> +// CHECK: xor <2 x i64> + + res_vull = vec_nor(vbll, vbll); +// CHECK: or <2 x i64> +// CHECK: xor <2 x i64> + + /* vec_or */ + res_vsll = vec_or(vsll, vsll); +// CHECK: or <2 x i64> + + res_vsll = vec_or(vbll, vsll); +// CHECK: or <2 x i64> + + res_vsll = vec_or(vsll, vbll); +// CHECK: or <2 x i64> + + res_vull = vec_or(vull, vull); +// CHECK: or <2 x i64> + + res_vull = vec_or(vbll, vull); +// CHECK: or <2 x i64> + + res_vull = vec_or(vull, vbll); +// CHECK: or <2 x i64> + + res_vbll = vec_or(vbll, vbll); +// CHECK: or <2 x i64> + + /* vec_vor */ + res_vsll = vec_vor(vsll, vsll); +// CHECK: or <2 x i64> + + res_vsll = vec_vor(vbll, vsll); +// CHECK: or <2 x i64> + + res_vsll = vec_vor(vsll, vbll); +// CHECK: or <2 x i64> + + res_vull = vec_vor(vull, vull); +// CHECK: or <2 x i64> + + res_vull = vec_vor(vbll, vull); +// CHECK: or <2 x i64> + + res_vull = vec_vor(vull, vbll); +// CHECK: or <2 x i64> + + res_vbll = vec_vor(vbll, vbll); +// CHECK: or <2 x i64> + + /* vec_xor */ + res_vsll = vec_xor(vsll, vsll); +// CHECK: xor <2 x i64> + + res_vsll = vec_xor(vbll, vsll); +// CHECK: xor <2 x i64> + + res_vsll = vec_xor(vsll, vbll); +// CHECK: xor <2 x i64> + + res_vull = vec_xor(vull, vull); +// CHECK: xor <2 x i64> + + res_vull = vec_xor(vbll, vull); +// CHECK: xor <2 x i64> + + res_vull = vec_xor(vull, vbll); +// CHECK: xor <2 x i64> + + res_vbll = vec_xor(vbll, vbll); +// CHECK: xor <2 x i64> + + /* vec_vxor */ + res_vsll = vec_vxor(vsll, vsll); +// CHECK: xor <2 x i64> + + res_vsll = vec_vxor(vbll, vsll); +// CHECK: xor <2 x i64> + + res_vsll = vec_vxor(vsll, vbll); +// CHECK: xor <2 x i64> + + res_vull = vec_vxor(vull, vull); +// CHECK: xor <2 x i64> + + res_vull = vec_vxor(vbll, vull); +// CHECK: xor <2 x i64> + + res_vull = vec_vxor(vull, vbll); +// CHECK: xor <2 x i64> + + res_vbll = vec_vxor(vbll, vbll); +// CHECK: xor <2 x i64> + } diff --git a/test/CodeGen/catch-undef-behavior.c b/test/CodeGen/catch-undef-behavior.c index a4386588757d1..66954190aff7a 100644 --- a/test/CodeGen/catch-undef-behavior.c +++ b/test/CodeGen/catch-undef-behavior.c @@ -371,6 +371,34 @@ void call_decl_nonnull(int *a) { decl_nonnull(a); } +extern void *memcpy (void *, const void *, unsigned) __attribute__((nonnull(1, 2))); + +// CHECK-COMMON-LABEL: @call_memcpy_nonnull +void call_memcpy_nonnull(void *p, void *q, int sz) { + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + memcpy(p, q, sz); +} + +extern void *memmove (void *, const void *, unsigned) __attribute__((nonnull(1, 2))); + +// CHECK-COMMON-LABEL: @call_memmove_nonnull +void call_memmove_nonnull(void *p, void *q, int sz) { + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + memmove(p, q, sz); +} + // CHECK-COMMON-LABEL: @call_nonnull_variadic __attribute__((nonnull)) void nonnull_variadic(int a, ...); void call_nonnull_variadic(int a, int *b) { diff --git a/test/CodeGen/fp16-ops.c b/test/CodeGen/fp16-ops.c index fe0fa2c2667ed..7cd08a03d6420 100644 --- a/test/CodeGen/fp16-ops.c +++ b/test/CodeGen/fp16-ops.c @@ -10,6 +10,7 @@ typedef unsigned cond_t; volatile cond_t test; +volatile int i0; volatile __fp16 h0 = 0.0, h1 = 1.0, h2; volatile float f0, f1, f2; volatile double d0; @@ -91,6 +92,11 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fmul float h1 = f0 * h2; + // CHECK: [[F16TOF32]] + // CHECK: fmul float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: fmul half + h1 = h0 * i0; // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -116,6 +122,11 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fdiv float h1 = (f0 / h2); + // CHECK: [[F16TOF32]] + // CHECK: fdiv float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: fdiv half + h1 = (h0 / i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -141,6 +152,11 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fadd float h1 = (f2 + h0); + // CHECK: [[F16TOF32]] + // CHECK: fadd float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: fadd half + h1 = (h0 + i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -166,6 +182,11 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fsub float h1 = (f2 - h0); + // CHECK: [[F16TOF32]] + // CHECK: fsub float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: fsub half + h1 = (h0 - i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -187,6 +208,14 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp olt float test = (f2 < h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp olt float + // NATIVE-HALF: fcmp olt half + test = (i0 < h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp olt float + // NATIVE-HALF: fcmp olt half + test = (h0 < i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -208,6 +237,14 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp ogt float test = (f0 > h2); + // CHECK: [[F16TOF32]] + // CHECK: fcmp ogt float + // NATIVE-HALF: fcmp ogt half + test = (i0 > h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp ogt float + // NATIVE-HALF: fcmp ogt half + test = (h0 > i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -229,6 +266,15 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp ole float test = (f2 <= h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp ole float + // NATIVE-HALF: fcmp ole half + test = (i0 <= h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp ole float + // NATIVE-HALF: fcmp ole half + test = (h0 <= i0); + // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -250,6 +296,14 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp oge float test = (f0 >= h2); + // CHECK: [[F16TOF32]] + // CHECK: fcmp oge float + // NATIVE-HALF: fcmp oge half + test = (i0 >= h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp oge float + // NATIVE-HALF: fcmp oge half + test = (h0 >= i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -271,6 +325,14 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp oeq float test = (f1 == h1); + // CHECK: [[F16TOF32]] + // CHECK: fcmp oeq float + // NATIVE-HALF: fcmp oeq half + test = (i0 == h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp oeq float + // NATIVE-HALF: fcmp oeq half + test = (h0 == i0); // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -292,6 +354,14 @@ void foo(void) { // NATIVE-HALF: fpext half // NATIVE-HALF: fcmp une float test = (f1 != h1); + // CHECK: [[F16TOF32]] + // CHECK: fcmp une float + // NATIVE-HALF: fcmp une half + test = (i0 != h0); + // CHECK: [[F16TOF32]] + // CHECK: fcmp une float + // NATIVE-HALF: fcmp une half + test = (h0 != i0); // CHECK: [[F16TOF32]] // CHECK: fcmp une float @@ -310,6 +380,15 @@ void foo(void) { // NATIVE-HALF: fptrunc float h0 = f0; + // CHECK: sitofp i32 {{.*}} to float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: sitofp i32 {{.*}} to half + h0 = i0; + // CHECK: [[F16TOF32]] + // CHECK: fptosi float {{.*}} to i32 + // NATIVE-HALF: fptosi half {{.*}} to i32 + i0 = h0; + // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] // CHECK: fadd float @@ -329,6 +408,21 @@ void foo(void) { // NATIVE-HALF: fadd float // NATIVE-HALF: fptrunc float h0 += f2; + // CHECK: [[F16TOF32]] + // CHECK: sitofp i32 {{.*}} to float + // CHECK: fadd float + // CHECK: fptosi float {{.*}} to i32 + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fadd half + // NATIVE-HALF: fptosi half {{.*}} to i32 + i0 += h0; + // CHECK: sitofp i32 {{.*}} to float + // CHECK: [[F16TOF32]] + // CHECK: fadd float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fadd half + h0 += i0; // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -349,6 +443,21 @@ void foo(void) { // NATIVE-HALF: fsub float // NATIVE-HALF: fptrunc float h0 -= f2; + // CHECK: [[F16TOF32]] + // CHECK: sitofp i32 {{.*}} to float + // CHECK: fsub float + // CHECK: fptosi float {{.*}} to i32 + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fsub half + // NATIVE-HALF: fptosi half {{.*}} to i32 + i0 -= h0; + // CHECK: sitofp i32 {{.*}} to float + // CHECK: [[F16TOF32]] + // CHECK: fsub float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fsub half + h0 -= i0; // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -369,6 +478,21 @@ void foo(void) { // NATIVE-HALF: fmul float // NATIVE-HALF: fptrunc float h0 *= f2; + // CHECK: [[F16TOF32]] + // CHECK: sitofp i32 {{.*}} to float + // CHECK: fmul float + // CHECK: fptosi float {{.*}} to i32 + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fmul half + // NATIVE-HALF: fptosi half {{.*}} to i32 + i0 *= h0; + // CHECK: sitofp i32 {{.*}} to float + // CHECK: [[F16TOF32]] + // CHECK: fmul float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fmul half + h0 *= i0; // CHECK: [[F16TOF32]] // CHECK: [[F16TOF32]] @@ -389,6 +513,21 @@ void foo(void) { // NATIVE-HALF: fdiv float // NATIVE-HALF: fptrunc float h0 /= f2; + // CHECK: [[F16TOF32]] + // CHECK: sitofp i32 {{.*}} to float + // CHECK: fdiv float + // CHECK: fptosi float {{.*}} to i32 + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fdiv half + // NATIVE-HALF: fptosi half {{.*}} to i32 + i0 /= h0; + // CHECK: sitofp i32 {{.*}} to float + // CHECK: [[F16TOF32]] + // CHECK: fdiv float + // CHECK: [[F32TOF16]] + // NATIVE-HALF: sitofp i32 {{.*}} to half + // NATIVE-HALF: fdiv half + h0 /= i0; // Check conversions to/from double // NOHALF: call i16 @llvm.convert.to.fp16.f64( diff --git a/test/CodeGen/mips-varargs.c b/test/CodeGen/mips-varargs.c index 8fd1df60b728a..891769c711ddc 100644 --- a/test/CodeGen/mips-varargs.c +++ b/test/CodeGen/mips-varargs.c @@ -111,14 +111,14 @@ long long test_i64(char *fmt, ...) { // ALL: [[VA1:%.+]] = bitcast i8** %va to i8* // ALL: call void @llvm.va_start(i8* [[VA1]]) // -// O32: [[AP_CUR:%.+]] = load i8*, i8** %va, align [[PTRALIGN]] +// O32: [[TMP0:%.+]] = bitcast i8** %va to i32* +// O32: [[AP_CUR:%.+]] = load [[INTPTR_T:i32]], i32* [[TMP0]], align [[PTRALIGN]] // NEW: [[TMP0:%.+]] = bitcast i8** %va to i64** // NEW: [[AP_CUR:%.+]] = load i64*, i64** [[TMP0]], align [[PTRALIGN]] // // i64 is 8-byte aligned, while this is within O32's stack alignment there's no // guarantee that the offset is still 8-byte aligned after earlier reads. -// O32: [[PTR0:%.+]] = ptrtoint i8* [[AP_CUR]] to [[INTPTR_T:i32]] -// O32: [[PTR1:%.+]] = add i32 [[PTR0]], 7 +// O32: [[PTR1:%.+]] = add i32 [[AP_CUR]], 7 // O32: [[PTR2:%.+]] = and i32 [[PTR1]], -8 // O32: [[PTR3:%.+]] = inttoptr [[INTPTR_T]] [[PTR2]] to i64* // O32: [[PTR4:%.+]] = inttoptr [[INTPTR_T]] [[PTR2]] to i8* @@ -200,11 +200,14 @@ int test_v4i32(char *fmt, ...) { // ALL: %va = alloca i8*, align [[PTRALIGN]] // ALL: [[VA1:%.+]] = bitcast i8** %va to i8* // ALL: call void @llvm.va_start(i8* [[VA1]]) -// ALL: [[AP_CUR:%.+]] = load i8*, i8** %va, align [[PTRALIGN]] // -// O32: [[PTR0:%.+]] = ptrtoint i8* [[AP_CUR]] to [[INTPTR_T:i32]] -// N32: [[PTR0:%.+]] = ptrtoint i8* [[AP_CUR]] to [[INTPTR_T:i32]] -// N64: [[PTR0:%.+]] = ptrtoint i8* [[AP_CUR]] to [[INTPTR_T:i64]] +// O32: [[TMP0:%.+]] = bitcast i8** %va to i32* +// N32: [[TMP0:%.+]] = bitcast i8** %va to i32* +// N64: [[TMP0:%.+]] = bitcast i8** %va to i64* +// +// O32: [[PTR0:%.+]] = load [[INTPTR_T:i32]], i32* [[TMP0]], align [[PTRALIGN]] +// N32: [[PTR0:%.+]] = load [[INTPTR_T:i32]], i32* [[TMP0]], align [[PTRALIGN]] +// N64: [[PTR0:%.+]] = load [[INTPTR_T:i64]], i64* [[TMP0]], align [[PTRALIGN]] // // Vectors are 16-byte aligned, however the O32 ABI has a maximum alignment of // 8-bytes since the base of the stack is 8-byte aligned. diff --git a/test/CodeGen/neon-immediate-ubsan.c b/test/CodeGen/neon-immediate-ubsan.c new file mode 100644 index 0000000000000..3fe4b003972b5 --- /dev/null +++ b/test/CodeGen/neon-immediate-ubsan.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -triple armv7s-linux-gnu -emit-llvm -O1 -o - %s \ +// RUN: -target-feature +neon -target-cpu cortex-a8 \ +// RUN: -fsanitize=signed-integer-overflow \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=ARMV7 + +// RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm -O1 -o - %s \ +// RUN: -target-feature +neon -target-cpu cortex-a53 \ +// RUN: -fsanitize=signed-integer-overflow \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=AARCH64 + +// Verify we emit constants for "immediate" builtin arguments. +// Emitting a scalar expression can make the immediate be generated as +// overflow intrinsics, if the overflow sanitizer is enabled. + +// PR23517 + +#include <arm_neon.h> + +int32x2_t test_vqrshrn_n_s64(int64x2_t a) { + // CHECK-LABEL: @test_vqrshrn_n_s64 + // CHECK-AARCH64: call <2 x i32> @llvm.aarch64.neon.sqrshrn.v2i32(<2 x i64> {{.*}}, i32 1) + // CHECK-ARMV7: call <2 x i32> @llvm.arm.neon.vqrshiftns.v2i32(<2 x i64> {{.*}}, <2 x i64> <i64 -1, i64 -1>) + return vqrshrn_n_s64(a, 0 + 1); +} diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 3a1a3ffd871ec..477e7dcf0b53e 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -691,10 +691,13 @@ extern template struct ExplicitInstantiationDeclExportedTemplate<int>; USEMEMFUNC(ExplicitInstantiationDeclExportedTemplate<int>, f); // M32-DAG: {{declare|define available_externally}} x86_thiscallcc void @"\01?f@?$ExplicitInstantiationDeclExportedTemplate@H@@QAEXXZ" -template <typename T> struct ExplicitInstantiationDeclExportedDefTemplate { void f() {} }; +template <typename T> struct ExplicitInstantiationDeclExportedDefTemplate { void f() {} ExplicitInstantiationDeclExportedDefTemplate() {} }; extern template struct ExplicitInstantiationDeclExportedDefTemplate<int>; template struct __declspec(dllexport) ExplicitInstantiationDeclExportedDefTemplate<int>; +USEMEMFUNC(ExplicitInstantiationDeclExportedDefTemplate<int>, f); // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$ExplicitInstantiationDeclExportedDefTemplate@H@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc %struct.ExplicitInstantiationDeclExportedDefTemplate* @"\01??0?$ExplicitInstantiationDeclExportedDefTemplate@H@@QAE@XZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN44ExplicitInstantiationDeclExportedDefTemplateIiE1fEv namespace { struct InternalLinkageType {}; } struct __declspec(dllexport) PR23308 { @@ -704,6 +707,11 @@ void PR23308::f(InternalLinkageType*) {} long use(PR23308* p) { p->f(nullptr); } // M32-DAG: define internal x86_thiscallcc void @"\01?f@PR23308@@QAEXPAUInternalLinkageType@?A@@@Z" +template <typename T> struct PR23770BaseTemplate { void f() {} }; +template <typename T> struct PR23770DerivedTemplate : PR23770BaseTemplate<int> {}; +extern template struct PR23770DerivedTemplate<int>; +template struct __declspec(dllexport) PR23770DerivedTemplate<int>; +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$PR23770BaseTemplate@H@@QAEXXZ" //===----------------------------------------------------------------------===// @@ -754,11 +762,11 @@ USEMEMFUNC(DerivedFromImportedTemplate, func) // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ImportedClassTemplate@H@@QAEXXZ" // G32-DAG: declare dllimport x86_thiscallcc void @_ZN21ImportedClassTemplateIiE4funcEv -// Base class already instantiated without dll attribute. +// Base class already implicitly instantiated without dll attribute. struct DerivedFromTemplateD : public ClassTemplate<double> {}; struct __declspec(dllexport) DerivedFromTemplateD2 : public ClassTemplate<double> {}; USEMEMFUNC(DerivedFromTemplateD2, func) -// M32-DAG: define linkonce_odr x86_thiscallcc void @"\01?func@?$ClassTemplate@N@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ClassTemplate@N@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv // MS: Base class already instantiated with different dll attribute. @@ -811,3 +819,18 @@ struct __declspec(dllexport) BottomClass : public MiddleClass<int> { }; USEMEMFUNC(BottomClass, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$TopClass@H@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN8TopClassIiE4funcEv + +template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase<int>; +struct __declspec(dllexport) DerivedFromExplicitInstantiationDeclTemplateBase : public ExplicitInstantiationDeclTemplateBase<int> {}; +template struct ExplicitInstantiationDeclTemplateBase<int>; +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExplicitInstantiationDeclTemplateBase@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv + +template <typename T> struct ExplicitInstantiationDeclTemplateBase2 { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase2<int>; +struct __declspec(dllexport) DerivedFromExplicitInstantiationDeclTemplateBase2 : public ExplicitInstantiationDeclTemplateBase2<int> {}; +template struct __declspec(dllimport) ExplicitInstantiationDeclTemplateBase2<int>; +USEMEMFUNC(ExplicitInstantiationDeclTemplateBase2<int>, func) +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv diff --git a/test/CodeGenCXX/dllimport.cpp b/test/CodeGenCXX/dllimport.cpp index 6de856017b549..0f15ff0291b90 100644 --- a/test/CodeGenCXX/dllimport.cpp +++ b/test/CodeGenCXX/dllimport.cpp @@ -724,18 +724,29 @@ template struct __declspec(dllimport) ExplicitlyInstantiatedWithDifferentAttr<in USEMEMFUNC(ExplicitlyInstantiatedWithDifferentAttr<int>, f); // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?f@?$ExplicitlyInstantiatedWithDifferentAttr@H@@QAEXXZ" -template <typename T> struct ExplicitInstantiationDeclImportedDefTemplate { void f() {} }; +template <typename T> struct ExplicitInstantiationDeclImportedDefTemplate { void f() {} ExplicitInstantiationDeclImportedDefTemplate() {}}; extern template struct ExplicitInstantiationDeclImportedDefTemplate<int>; template struct __declspec(dllimport) ExplicitInstantiationDeclImportedDefTemplate<int>; +USECLASS(ExplicitInstantiationDeclImportedDefTemplate<int>); USEMEMFUNC(ExplicitInstantiationDeclImportedDefTemplate<int>, f); // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?f@?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAEXXZ" +// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc %struct.ExplicitInstantiationDeclImportedDefTemplate* @"\01??0?$ExplicitInstantiationDeclImportedDefTemplate@H@@QAE@XZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN44ExplicitInstantiationDeclImportedDefTemplateIiE1fEv -template <typename T> struct __declspec(dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate { void f() {} }; +template <typename T> struct __declspec(dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate { void f() {} ExplicitInstantiationDeclExportedDefImportedTemplate() {} }; extern template struct __declspec(dllimport) ExplicitInstantiationDeclExportedDefImportedTemplate <int>; template struct __declspec(dllexport) ExplicitInstantiationDeclExportedDefImportedTemplate<int>; +USECLASS(ExplicitInstantiationDeclExportedDefImportedTemplate<int>); USEMEMFUNC(ExplicitInstantiationDeclExportedDefImportedTemplate<int>, f); // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?f@?$ExplicitInstantiationDeclExportedDefImportedTemplate@H@@QAEXXZ" +// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc %struct.ExplicitInstantiationDeclExportedDefImportedTemplate* @"\01??0?$ExplicitInstantiationDeclExportedDefImportedTemplate@H@@QAE@XZ" +template <typename T> struct PR23770BaseTemplate { void f() {} }; +template <typename T> struct PR23770DerivedTemplate : PR23770BaseTemplate<int> {}; +extern template struct PR23770DerivedTemplate<int>; +template struct __declspec(dllimport) PR23770DerivedTemplate<int>; +USEMEMFUNC(PR23770BaseTemplate<int>, f); +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?f@?$PR23770BaseTemplate@H@@QAEXXZ" //===----------------------------------------------------------------------===// // Classes with template base classes @@ -781,11 +792,11 @@ USEMEMFUNC(ExportedClassTemplate<int>, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExportedClassTemplate@H@@QAEXXZ" // G32-DAG: define weak_odr dllexport x86_thiscallcc void @_ZN21ExportedClassTemplateIiE4funcEv -// Base class already instantiated without attribute. +// Base class already implicitly instantiated without attribute. struct DerivedFromTemplateD : public ClassTemplate<double> {}; struct __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double> {}; USEMEMFUNC(ClassTemplate<double>, func) -// M32-DAG: define linkonce_odr x86_thiscallcc void @"\01?func@?$ClassTemplate@N@@QAEXXZ" +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ClassTemplate@N@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv // MS: Base class already instantiated with dfferent attribute. @@ -838,3 +849,19 @@ struct __declspec(dllimport) BottomClass : public MiddleClass<int> { }; USEMEMFUNC(TopClass<int>, func) // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$TopClass@H@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN8TopClassIiE4funcEv + +template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase<int>; +struct __declspec(dllimport) DerivedFromExplicitInstantiationDeclTemplateBase : public ExplicitInstantiationDeclTemplateBase<int> {}; +template struct ExplicitInstantiationDeclTemplateBase<int>; +USEMEMFUNC(ExplicitInstantiationDeclTemplateBase<int>, func) +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitInstantiationDeclTemplateBase@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN37ExplicitInstantiationDeclTemplateBaseIiE4funcEv + +template <typename T> struct ExplicitInstantiationDeclTemplateBase2 { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase2<int>; +struct __declspec(dllimport) DerivedFromExplicitInstantiationDeclTemplateBase2 : public ExplicitInstantiationDeclTemplateBase2<int> {}; +template struct __declspec(dllexport) ExplicitInstantiationDeclTemplateBase2<int>; +USEMEMFUNC(ExplicitInstantiationDeclTemplateBase2<int>, func) +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitInstantiationDeclTemplateBase2@H@@QAEXXZ" +// G32-DAG: define weak_odr x86_thiscallcc void @_ZN38ExplicitInstantiationDeclTemplateBase2IiE4funcEv diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp index 0f2ddaac23b17..94337d98a1956 100644 --- a/test/CodeGenCXX/pointers-to-data-members.cpp +++ b/test/CodeGenCXX/pointers-to-data-members.cpp @@ -285,4 +285,14 @@ S s; // CHECK-GLOBAL: @_ZN19FlexibleArrayMember1sE = global %"struct.FlexibleArrayMember::S" zeroinitializer, align 8 } +namespace IndirectPDM { +union U { + union { + int U::*m; + }; +}; +U u; +// CHECK-GLOBAL: @_ZN11IndirectPDM1uE = global %"union.IndirectPDM::U" { %union.anon { i64 -1 } }, align 8 +} + // CHECK-O3: attributes [[NUW]] = { nounwind readnone{{.*}} } diff --git a/test/CodeGen/pragma-loop.cpp b/test/CodeGenCXX/pragma-loop.cpp index dd40c1d72600e..dd40c1d72600e 100644 --- a/test/CodeGen/pragma-loop.cpp +++ b/test/CodeGenCXX/pragma-loop.cpp diff --git a/test/CodeGen/pragma-unroll.cpp b/test/CodeGenCXX/pragma-unroll.cpp index 8b73fa6c8aab4..8b73fa6c8aab4 100644 --- a/test/CodeGen/pragma-unroll.cpp +++ b/test/CodeGenCXX/pragma-unroll.cpp diff --git a/test/CodeGenCXX/stack-reuse-miscompile.cpp b/test/CodeGenCXX/stack-reuse-miscompile.cpp new file mode 100644 index 0000000000000..63d15fd1e8c93 --- /dev/null +++ b/test/CodeGenCXX/stack-reuse-miscompile.cpp @@ -0,0 +1,36 @@ +// RUN: %clang -S -target armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -mllvm -disable-llvm-optzns -S %s -o - | FileCheck %s + +// This test should not to generate llvm.lifetime.start/llvm.lifetime.end for +// f function because all temporary objects in this function are used for the +// final result + +class S { + char *ptr; + unsigned int len; +}; + +class T { + S left; + S right; + +public: + T(const char s[]); + T(S); + + T concat(const T &Suffix) const; + const char * str() const; +}; + +const char * f(S s) +{ +// CHECK: [[T1:%.*]] = alloca %class.T, align 4 +// CHECK: [[T2:%.*]] = alloca %class.T, align 4 +// CHECK: [[T3:%.*]] = alloca %class.T, align 4 +// CHECK: [[T4:%.*]] = call %class.T* @_ZN1TC1EPKc(%class.T* [[T1]], i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0)) +// CHECK: [[T5:%.*]] = call %class.T* @_ZN1TC1E1S(%class.T* [[T2]], [2 x i32] %{{.*}}) +// CHECK: call void @_ZNK1T6concatERKS_(%class.T* sret [[T3]], %class.T* [[T1]], %class.T* dereferenceable(16) [[T2]]) +// CHECK: [[T6:%.*]] = call i8* @_ZNK1T3strEv(%class.T* [[T3]]) +// CHECK: ret i8* [[T6]] + + return T("[").concat(T(s)).str(); +} diff --git a/test/CodeGenCXX/stack-reuse.cpp b/test/CodeGenCXX/stack-reuse.cpp new file mode 100644 index 0000000000000..a975f30a048a9 --- /dev/null +++ b/test/CodeGenCXX/stack-reuse.cpp @@ -0,0 +1,146 @@ +// RUN: %clang -target armv7l-unknown-linux-gnueabihf -S %s -o - -emit-llvm -O1 -disable-llvm-optzns | FileCheck %s + +// Stack should be reused when possible, no need to allocate two separate slots +// if they have disjoint lifetime. + +// Sizes of objects are related to previously existed threshold of 32. In case +// of S_large stack size is rounded to 40 bytes. + +// 32B +struct S_small { + int a[8]; +}; + +// 36B +struct S_large { + int a[9]; +}; + +// Helper class for lifetime scope absence testing +struct Combiner { + S_large a, b; + + Combiner(S_large); + Combiner f(); +}; + +extern S_small foo_small(); +extern S_large foo_large(); +extern void bar_small(S_small*); +extern void bar_large(S_large*); + +// Prevent mangling of function names. +extern "C" { + +void small_rvoed_unnamed_temporary_object() { +// CHECK-LABEL: define void @small_rvoed_unnamed_temporary_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_smallv +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_smallv +// CHECK: call void @llvm.lifetime.end + + foo_small(); + foo_small(); +} + +void large_rvoed_unnamed_temporary_object() { +// CHECK-LABEL: define void @large_rvoed_unnamed_temporary_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_largev +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_largev +// CHECK: call void @llvm.lifetime.end + + foo_large(); + foo_large(); +} + +void small_rvoed_named_temporary_object() { +// CHECK-LABEL: define void @small_rvoed_named_temporary_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_smallv +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_smallv +// CHECK: call void @llvm.lifetime.end + + { + S_small s = foo_small(); + } + { + S_small s = foo_small(); + } +} + +void large_rvoed_named_temporary_object() { +// CHECK-LABEL: define void @large_rvoed_named_temporary_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_largev +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9foo_largev +// CHECK: call void @llvm.lifetime.end + + { + S_large s = foo_large(); + } + { + S_large s = foo_large(); + } +} + +void small_auto_object() { +// CHECK-LABEL: define void @small_auto_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9bar_smallP7S_small +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9bar_smallP7S_small +// CHECK: call void @llvm.lifetime.end + + { + S_small s; + bar_small(&s); + } + { + S_small s; + bar_small(&s); + } +} + +void large_auto_object() { +// CHECK-LABEL: define void @large_auto_object +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9bar_largeP7S_large +// CHECK: call void @llvm.lifetime.end +// CHECK: call void @llvm.lifetime.start +// CHECK: call void @_Z9bar_largeP7S_large +// CHECK: call void @llvm.lifetime.end + + { + S_large s; + bar_large(&s); + } + { + S_large s; + bar_large(&s); + } +} + +int large_combiner_test(S_large s) { +// CHECK-LABEL: define i32 @large_combiner_test +// CHECK: [[T1:%.*]] = alloca %struct.Combiner +// CHECK: [[T2:%.*]] = alloca %struct.Combiner +// CHECK: [[T3:%.*]] = call %struct.Combiner* @_ZN8CombinerC1E7S_large(%struct.Combiner* [[T1]], [9 x i32] %s.coerce) +// CHECK: call void @_ZN8Combiner1fEv(%struct.Combiner* sret [[T2]], %struct.Combiner* [[T1]]) +// CHECK: [[T4:%.*]] = getelementptr inbounds %struct.Combiner, %struct.Combiner* [[T2]], i32 0, i32 0, i32 0, i32 0 +// CHECK: [[T5:%.*]] = load i32, i32* [[T4]] +// CHECK: ret i32 [[T5]] + + return Combiner(s).f().a.a[0]; +} + +} diff --git a/test/CodeGenCXX/x86_64-arguments-avx.cpp b/test/CodeGenCXX/x86_64-arguments-avx.cpp index 1b1c6420636e0..29e693451d128 100644 --- a/test/CodeGenCXX/x86_64-arguments-avx.cpp +++ b/test/CodeGenCXX/x86_64-arguments-avx.cpp @@ -13,3 +13,40 @@ PR22753 test(PR22753 x) { return x; } } + +namespace test2 { +typedef double __m128d __attribute__((__vector_size__(16))); +typedef float __m128 __attribute__((__vector_size__(16))); +typedef double __m256d __attribute__((__vector_size__(32))); +typedef float __m256 __attribute__((__vector_size__(32))); + +union U1 { + __m128 v1; + __m128d v2; +}; + +union UU1 { + union U1; + __m128d v3; +}; + +// CHECK: define <2 x double> @_ZN5test27PR23082ENS_3UU1E(<2 x double> +UU1 PR23082(UU1 x) { + return x; +} + +union U2 { + __m256 v1; + __m256d v2; +}; + +union UU2 { + union U2; + __m256d v3; +}; + +// CHECK: define <4 x double> @_ZN5test27PR23082ENS_3UU2E(<4 x double> +UU2 PR23082(UU2 x) { + return x; +} +} diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/lib/sparc64-linux-gnu/.keep b/test/Driver/Inputs/debian_8_sparc64_tree/lib/sparc64-linux-gnu/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/lib/sparc64-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/lib64/.keep b/test/Driver/Inputs/debian_8_sparc64_tree/lib64/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/lib64/.keep diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/c++/4.9/.keep b/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/c++/4.9/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/c++/4.9/.keep diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/sparc64-linux-gnu/c++/4.9/.keep b/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/sparc64-linux-gnu/c++/4.9/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/include/sparc64-linux-gnu/c++/4.9/.keep diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtbegin.o b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtbegin.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtbegin.o diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtend.o b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtend.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/gcc/sparc64-linux-gnu/4.9/crtend.o diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crt1.o b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crt1.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crt1.o diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crti.o b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crti.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crti.o diff --git a/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crtn.o b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crtn.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc64_tree/usr/lib/sparc64-linux-gnu/crtn.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib/sparc-linux-gnu/.keep b/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib/sparc-linux-gnu/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib/sparc-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib64/.keep b/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib64/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/lib64/.keep diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/c++/4.9/backward/.keep b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/c++/4.9/backward/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/c++/4.9/backward/.keep diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/sparc-linux-gnu/c++/4.9/64/.keep b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/sparc-linux-gnu/c++/4.9/64/.keep new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/include/sparc-linux-gnu/c++/4.9/64/.keep diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtbegin.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtbegin.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtbegin.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtend.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtend.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/64/crtend.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtbegin.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtbegin.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtbegin.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtend.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtend.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/gcc/sparc-linux-gnu/4.9/crtend.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crt1.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crt1.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crt1.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crti.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crti.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crti.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crtn.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crtn.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib/sparc-linux-gnu/crtn.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crt1.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crt1.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crt1.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crti.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crti.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crti.o diff --git a/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crtn.o b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crtn.o new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Driver/Inputs/debian_8_sparc_multilib_tree/usr/lib64/crtn.o diff --git a/test/Driver/arm-cortex-cpus.c b/test/Driver/arm-cortex-cpus.c index 5052f3bb84c35..b9db9622dd830 100644 --- a/test/Driver/arm-cortex-cpus.c +++ b/test/Driver/arm-cortex-cpus.c @@ -201,13 +201,17 @@ // ================== Check that a bogus architecture gives an error // RUN: %clang -target arm -march=armbogusv6 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS %s -// CHECK-BOGUS: error: the clang compiler does not support '-march=armbogusv6' +// CHECK-BOGUS: error: {{.*}} does not support '-march=armbogusv6' // RUN: %clang -target arm---eabihf -march=armbogusv7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS-HF %s -// CHECK-BOGUS-HF: error: the clang compiler does not support '-march=armbogusv7' +// CHECK-BOGUS-HF: error: {{.*}} does not support '-march=armbogusv7' +// RUN: %clang -target arm -march=armv6bogus -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS2 %s +// CHECK-BOGUS2: error: {{.*}} does not support '-march=armv6bogus' +// RUN: %clang -target arm -march=bogus -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS3 %s +// CHECK-BOGUS3: error: {{.*}} does not support '-march=bogus' // ================== Check that a bogus CPU gives an error // RUN: %clang -target arm -mcpu=bogus -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS-CPU %s -// CHECK-BOGUS-CPU: error: the clang compiler does not support '-mcpu=bogus' +// CHECK-BOGUS-CPU: error: {{.*}} does not support '-mcpu=bogus' // ================== Check default Architecture on each ARM11 CPU // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136j-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s @@ -388,3 +392,13 @@ // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // CHECK-BE-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8-{{.*}} + +// ================== Check whether -mcpu accepts mixed-case values. +// RUN: %clang -target arm-linux-gnueabi -mcpu=Cortex-a5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-A7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=CORTEX-a8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=Cortex-A9 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=corteX-A12 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=CorteX-a15 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=CorteX-A17 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CASE-INSENSITIVE-CPUV7A %s +// CHECK-CASE-INSENSITIVE-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-{{.*}} diff --git a/test/Driver/arm-mfpu.c b/test/Driver/arm-mfpu.c index d941a3c9af06f..8439cddf9d7fd 100644 --- a/test/Driver/arm-mfpu.c +++ b/test/Driver/arm-mfpu.c @@ -15,13 +15,14 @@ // RUN: | FileCheck --check-prefix=CHECK-FPA %s // RUN: %clang -target arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FPA %s -// CHECK-FPA: "-target-feature" "-vfp2" -// CHECK-FPA: "-target-feature" "-vfp3" -// CHECK-FPA: "-target-feature" "-neon" +// CHECK-FPA: error: {{.*}} does not support '-mfpu={{fpa|fpe|fpe2|fpe3|maverick}}' // RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP %s // CHECK-VFP: "-target-feature" "+vfp2" +// CHECK-VFP: "-target-feature" "-vfp3" +// CHECK-VFP: "-target-feature" "-vfp4" +// CHECK-VFP: "-target-feature" "-fp-armv8" // CHECK-VFP: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \ @@ -29,14 +30,19 @@ // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP3 %s // CHECK-VFP3: "-target-feature" "+vfp3" +// CHECK-VFP3: "-target-feature" "-vfp4" +// CHECK-VFP3: "-target-feature" "-fp-armv8" // CHECK-VFP3: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s +// CHECK-VFP3-D16: "-target-feature" "-fp-only-sp" // CHECK-VFP3-D16: "-target-feature" "+d16" // CHECK-VFP3-D16: "-target-feature" "+vfp3" +// CHECK-VFP3-D16: "-target-feature" "-vfp4" +// CHECK-VFP3-D16: "-target-feature" "-fp-armv8" // CHECK-VFP3-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \ @@ -44,14 +50,17 @@ // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP4 %s // CHECK-VFP4: "-target-feature" "+vfp4" +// CHECK-VFP4: "-target-feature" "-fp-armv8" // CHECK-VFP4: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=vfp4-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s +// CHECK-VFP4-D16: "-target-feature" "-fp-only-sp" // CHECK-VFP4-D16: "-target-feature" "+d16" // CHECK-VFP4-D16: "-target-feature" "+vfp4" +// CHECK-VFP4-D16: "-target-feature" "-fp-armv8" // CHECK-VFP4-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \ @@ -61,6 +70,7 @@ // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp" // CHECK-FP4-SP-D16: "-target-feature" "+d16" // CHECK-FP4-SP-D16: "-target-feature" "+vfp4" +// CHECK-FP4-SP-D16: "-target-feature" "-fp-armv8" // CHECK-FP4-SP-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \ @@ -77,6 +87,7 @@ // RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s +// CHECK-FP5-DP-D16: "-target-feature" "-fp-only-sp" // CHECK-FP5-DP-D16: "-target-feature" "+d16" // CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8" // CHECK-FP5-DP-D16: "-target-feature" "-neon" @@ -92,8 +103,8 @@ // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NEON-VFPV4 %s -// CHECK-NEON-VFPV4: "-target-feature" "+neon" // CHECK-NEON-VFPV4: "-target-feature" "+vfp4" +// CHECK-NEON-VFPV4: "-target-feature" "+neon" // RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s @@ -126,17 +137,18 @@ // RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8" -// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+neon" // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto" // RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-FP %s +// CHECK-NO-FP: "-target-feature" "-fp-only-sp" +// CHECK-NO-FP: "-target-feature" "-d16" // CHECK-NO-FP: "-target-feature" "-vfp2" // CHECK-NO-FP: "-target-feature" "-vfp3" // CHECK-NO-FP: "-target-feature" "-vfp4" // CHECK-NO-FP: "-target-feature" "-fp-armv8" -// CHECK-NO-FP: "-target-feature" "-crypto" // CHECK-NO-FP: "-target-feature" "-neon" +// CHECK-NO-FP: "-target-feature" "-crypto" // RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-HF %s diff --git a/test/Driver/cl-outputs.c b/test/Driver/cl-outputs.c index be1172f30fcec..b92c82687a9bb 100644 --- a/test/Driver/cl-outputs.c +++ b/test/Driver/cl-outputs.c @@ -249,22 +249,15 @@ // Fi2: "-E" // Fi2: "-o" "foo.x" +// To match MSVC behavior /o should be ignored for /P output. + // RUN: %clang_cl /P /ofoo -### -- %s 2>&1 | FileCheck -check-prefix=Fio1 %s // Fio1: "-E" -// Fio1: "-o" "foo.i" +// Fio1: "-o" "cl-outputs.i" -// RUN: %clang_cl /P /o foo -### -- %s 2>&1 | FileCheck -check-prefix=Fio2 %s +// RUN: %clang_cl /P /o foo.x -### -- %s 2>&1 | FileCheck -check-prefix=Fio2 %s // Fio2: "-E" -// Fio2: "-o" "foo.i" - -// RUN: %clang_cl /P /ofoo.x -### -- %s 2>&1 | FileCheck -check-prefix=Fio3 %s -// Fio3: "-E" -// Fio3: "-o" "foo.x" - -// RUN: %clang_cl /P /o foo.x -### -- %s 2>&1 | FileCheck -check-prefix=Fio4 %s -// Fio4: "-E" -// Fio4: "-o" "foo.x" - +// Fio2: "-o" "cl-outputs.i" // RUN: %clang_cl /P /obar.x /Fifoo.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE1 %s // FioRACE1: "-E" @@ -272,4 +265,10 @@ // RUN: %clang_cl /P /Fifoo.x /obar.x -### -- %s 2>&1 | FileCheck -check-prefix=FioRACE2 %s // FioRACE2: "-E" -// FioRACE2: "-o" "bar.x" +// FioRACE2: "-o" "foo.x" + +// RUN: %clang_cl /c /GL -### -- %s 2>&1 | FileCheck -check-prefix=LTO-DEFAULT %s +// LTO-DEFAULT: "-emit-llvm-bc"{{.*}}"-o" "cl-outputs.obj" + +// RUN: %clang_cl /c /GL /Fofoo -### -- %s 2>&1 | FileCheck -check-prefix=LTO-FO %s +// LTO-FO: "-emit-llvm-bc"{{.*}}"-o" "foo.obj" diff --git a/test/Driver/crash-report-header.h b/test/Driver/crash-report-header.h new file mode 100644 index 0000000000000..e0193cbe45e99 --- /dev/null +++ b/test/Driver/crash-report-header.h @@ -0,0 +1,18 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: not env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 %clang -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: cat %t/crash-report-header-*.h | FileCheck --check-prefix=CHECKSRC "%s" +// RUN: cat %t/crash-report-header-*.sh | FileCheck --check-prefix=CHECKSH "%s" +// REQUIRES: crash-recovery + +// because of the glob (*.h, *.sh) +// REQUIRES: shell + +#pragma clang __debug parser_crash +// CHECK: Preprocessed source(s) and associated run script(s) are located at: +// CHECK-NEXT: note: diagnostic msg: {{.*}}.h +FOO +// CHECKSRC: FOO +// CHECKSH: "-cc1" +// CHECKSH: "-main-file-name" "crash-report-header.h" +// CHECKSH: "crash-report-header-{{[^ ]*}}.h" diff --git a/test/Driver/fopenmp.c b/test/Driver/fopenmp.c new file mode 100644 index 0000000000000..36c856d8820e5 --- /dev/null +++ b/test/Driver/fopenmp.c @@ -0,0 +1,33 @@ +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// +// CHECK-CC1-OPENMP: "-cc1" +// CHECK-CC1-OPENMP: "-fopenmp" +// +// CHECK-CC1-NO-OPENMP: "-cc1" +// CHECK-CC1-NO-OPENMP-NOT: "-fopenmp" +// +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP +// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// +// CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-OMP: "-lomp" +// +// CHECK-LD-GOMP: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-GOMP: "-lgomp" +// +// CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-IOMP5: "-liomp5" +// +// We'd like to check that the default is sane, but until we have the ability +// to *always* semantically analyze OpenMP without always generating runtime +// calls (in the event of an unsupported runtime), we don't have a good way to +// test the CC1 invocation. Instead, just ensure we do eventually link *some* +// OpenMP runtime. +// +// RUN: %clang -target x86_64-linux-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// +// CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-ANY: "-l{{(omp|gomp|iomp5)}}" diff --git a/test/Driver/krait-cpu.c b/test/Driver/krait-cpu.c index ee324b6a54a52..bf85c6e888e5b 100644 --- a/test/Driver/krait-cpu.c +++ b/test/Driver/krait-cpu.c @@ -1,3 +1,6 @@ // ================== Check default Architecture on krait CPU // RUN: %clang -target arm-linux-gnueabi -mcpu=krait -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s +// ================== Check whether -mcpu accepts mixed-case values. +// RUN: %clang -target arm-linux-gnueabi -mcpu=Krait -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=KRAIT -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s // CHECK-CPUV7A: "-cc1"{{.*}} "-triple" "armv7-{{.*}} diff --git a/test/Driver/linux-header-search.cpp b/test/Driver/linux-header-search.cpp index 574ae22c67de1..23912cb94aeff 100644 --- a/test/Driver/linux-header-search.cpp +++ b/test/Driver/linux-header-search.cpp @@ -285,3 +285,60 @@ // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/mips64el-linux-gnuabi64" // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" + +// Check header search on Debian 8 / Sparc +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target sparc-unknown-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc_multilib_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC32 %s +// CHECK-DEBIAN-SPARC32: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-SPARC32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-DEBIAN-SPARC32: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/c++/4.9" +// CHECK-DEBIAN-SPARC32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/sparc-linux-gnu/c++/4.9" +// CHECK-DEBIAN-SPARC32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/c++/4.9/backward" +// CHECK-DEBIAN-SPARC32: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-DEBIAN-SPARC32: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" +// CHECK-DEBIAN-SPARC32: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/sparc-linux-gnu" +// CHECK-DEBIAN-SPARC32: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK-DEBIAN-SPARC32: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" + +// Check header search on Debian 8 / Sparc, with the oldstyle multilib packages +// RUN: %clang -no-canonical-prefixes -m64 %s -### -fsyntax-only 2>&1 \ +// RUN: -target sparc-unknown-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc_multilib_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC32-LIB64 %s +// CHECK-DEBIAN-SPARC32-LIB64: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-SPARC32-LIB64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-DEBIAN-SPARC32-LIB64: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/c++/4.9" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/sparc-linux-gnu/c++/4.9/64" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../include/c++/4.9/backward" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" +/* TODO: GCC 4.9 includes the following dir in its search path, which + seems questionable. Clang doesn't. Not sure if clang should be + doing that too. */ +// CHECK-DEBIAN-SPARC32-LIB64-todo: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/sparc-linux-gnu" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK-DEBIAN-SPARC32-LIB64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" + +// Check header search on Debian 8 / Sparc64 +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target sparc64-unknown-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc64_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC64 %s +// CHECK-DEBIAN-SPARC64: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-SPARC64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-DEBIAN-SPARC64: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../../include/c++/4.9" +// CHECK-DEBIAN-SPARC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../../include/sparc64-linux-gnu/c++/4.9" +// CHECK-DEBIAN-SPARC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../../include/c++/4.9/backward" +// CHECK-DEBIAN-SPARC64: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-DEBIAN-SPARC64: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" +// CHECK-DEBIAN-SPARC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/sparc64-linux-gnu" +// CHECK-DEBIAN-SPARC64: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK-DEBIAN-SPARC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 38edb7fe4a260..5c4778be8cf5d 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -904,6 +904,67 @@ // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/lib" // CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib" // +// Check linker paths on Debian 8 / Sparc +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=sparc-linux-gnu \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc_multilib_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC32 %s +// CHECK-DEBIAN-SPARC32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC32: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../sparc-linux-gnu{{/|\\\\}}crt1.o" +// CHECK-DEBIAN-SPARC32: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../sparc-linux-gnu{{/|\\\\}}crti.o" +// CHECK-DEBIAN-SPARC32: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9{{/|\\\\}}crtbegin.o" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../sparc-linux-gnu" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../lib" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/lib/sparc-linux-gnu" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/usr/lib/sparc-linux-gnu" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-SPARC32: "-L[[SYSROOT]]/usr/lib" +// CHECK-DEBIAN-SPARC32: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9{{/|\\\\}}crtend.o" +// CHECK-DEBIAN-SPARC32: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../sparc-linux-gnu{{/|\\\\}}crtn.o" +// +// Check linker paths on Debian 8 / Sparc, with the oldstyle multilib packages +// RUN: %clang -no-canonical-prefixes -m64 %s -### -o %t.o 2>&1 \ +// RUN: --target=sparc-linux-gnu \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc_multilib_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC32-LIB64 %s +// CHECK-DEBIAN-SPARC32-LIB64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC32-LIB64: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../lib64{{/|\\\\}}crt1.o" +// CHECK-DEBIAN-SPARC32-LIB64: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../lib64{{/|\\\\}}crti.o" +// CHECK-DEBIAN-SPARC32-LIB64: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/64{{/|\\\\}}crtbegin.o" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/64" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../lib64" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/lib/../lib64" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/usr/lib/../lib64" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-SPARC32-LIB64: "-L[[SYSROOT]]/usr/lib" +// CHECK-DEBIAN-SPARC32-LIB64: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/64{{/|\\\\}}crtend.o" +// CHECK-DEBIAN-SPARC32-LIB64: "[[SYSROOT]]/usr/lib/gcc/sparc-linux-gnu/4.9/../../../../lib64{{/|\\\\}}crtn.o" +// +// Check linker paths on Debian 8 / Sparc64 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=sparc64-linux-gnu \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/debian_8_sparc64_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-SPARC64 %s +// CHECK-DEBIAN-SPARC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu{{/|\\\\}}crt1.o" +// CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu{{/|\\\\}}crti.o" +// CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9{{/|\\\\}}crtbegin.o" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/lib/sparc64-linux-gnu" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/lib/../lib64" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/usr/lib/sparc64-linux-gnu" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../.." +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-SPARC64: "-L[[SYSROOT]]/usr/lib" +// CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9{{/|\\\\}}crtend.o" +// CHECK-DEBIAN-SPARC64: "[[SYSROOT]]/usr/lib/gcc/sparc64-linux-gnu/4.9/../../../sparc64-linux-gnu{{/|\\\\}}crtn.o" +// // Test linker invocation on Android. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ diff --git a/test/Driver/msvc-triple.c b/test/Driver/msvc-triple.c new file mode 100644 index 0000000000000..f181b3199a3f3 --- /dev/null +++ b/test/Driver/msvc-triple.c @@ -0,0 +1,9 @@ +// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19 +// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19 +// RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT + +// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0" +// TARGET-19: target triple = "i686-pc-windows-msvc19.0.0" +// OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0" +// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf" diff --git a/test/Driver/pic.c b/test/Driver/pic.c index 3a14d61cf1c65..a515f8117a1d0 100644 --- a/test/Driver/pic.c +++ b/test/Driver/pic.c @@ -220,6 +220,8 @@ // RUN: | FileCheck %s --check-prefix=CHECK-PIE1 // RUN: %clang -c %s -target powerpc-unknown-openbsd -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 +// RUN: %clang -c %s -target sparc-unknown-openbsd -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // RUN: %clang -c %s -target sparc64-unknown-openbsd -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // RUN: %clang -c %s -target i386-pc-openbsd -fno-pie -### 2>&1 \ diff --git a/test/Driver/windows-arm-minimal-arch.c b/test/Driver/windows-arm-minimal-arch.c index cf55b8f99d0ff..43d6ad8602a65 100644 --- a/test/Driver/windows-arm-minimal-arch.c +++ b/test/Driver/windows-arm-minimal-arch.c @@ -1,5 +1,5 @@ // RUN: not %clang -target thumbv5-windows -mcpu=arm10tdmi %s -o /dev/null 2>&1 \ // RUN: | FileCheck %s -// CHECK: error: the target architecture 'thumbv5' is not supported by the target 'thumbv5--windows-msvc' +// CHECK: error: the target architecture 'thumbv5' is not supported by the target 'thumbv5--windows-msvc diff --git a/test/Format/style-on-command-line.cpp b/test/Format/style-on-command-line.cpp index 007022e74461c..2e757cc92a551 100644 --- a/test/Format/style-on-command-line.cpp +++ b/test/Format/style-on-command-line.cpp @@ -3,13 +3,11 @@ // RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s // RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s // RUN: clang-format -style="{lsjd}" %t.cpp -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s // RUN: printf "\n" > %T/.clang-format // RUN: clang-format -style=file -fallback-style=webkit %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format -// RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format +// RUN: rm %T/.clang-format // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format // RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s // RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s @@ -24,7 +22,6 @@ void f() { // CHECK4: {{^ int \*i;$}} // CHECK5: {{^ int\* i;$}} // CHECK6: {{^Error reading .*\.clang-format: (I|i)nvalid argument}} -// CHECK6: {{^Can't find usable .clang-format, using webkit style$}} // CHECK6: {{^ int\* i;$}} // CHECK7: {{^ int\* i;$}} // CHECK8: {{^ int\* i;$}} diff --git a/test/Frontend/source-col-map.c b/test/Frontend/source-col-map.c index a14023bc82a8c..ae69fbe565c31 100644 --- a/test/Frontend/source-col-map.c +++ b/test/Frontend/source-col-map.c @@ -1,4 +1,4 @@ -// RUN: not %clang_cc1 %s -fsyntax-only -fmessage-length 75 -o /dev/null 2>&1 | FileCheck %s -strict-whitespace +// RUN: not %clang_cc1 -fsyntax-only -fmessage-length 75 -o /dev/null -x c < %s 2>&1 | FileCheck %s -strict-whitespace // Test case for the text diagnostics source column conversion crash. @@ -31,7 +31,8 @@ void test2(Unknown* b); // αααα αααα αααα αααα αααα αααΠvoid test3() { /* αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s"); } -// CHECK: format specifies type 'int' but the argument has type 'char *' +// CHECK: format specifies type 'int' but the argument has +// CHECK: type 'char *' // CHECK-NEXT: ...αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s"); // CHECK-NEXT: {{^ ~~ \^~~$}} // CHECK-NEXT: {{^ %s$}} diff --git a/test/Headers/altivec-intrin.c b/test/Headers/altivec-intrin.c index 1577d7e566c54..7e6ea00987405 100644 --- a/test/Headers/altivec-intrin.c +++ b/test/Headers/altivec-intrin.c @@ -14,5 +14,5 @@ int main() } // FIXME: As noted in ms-intrin.cpp, it would be nice if we didn't have to // hard-code the line number from altivec.h here. -// expected-note@altivec.h:2514 {{deprecated here}} -// expected-note@altivec.h:2649 {{deprecated here}} +// expected-note@altivec.h:* {{deprecated here}} +// expected-note@altivec.h:* {{deprecated here}} diff --git a/test/Lexer/keywords_test.cpp b/test/Lexer/keywords_test.cpp index 19a89c3d30f3d..dd45b40edcabd 100644 --- a/test/Lexer/keywords_test.cpp +++ b/test/Lexer/keywords_test.cpp @@ -1,10 +1,17 @@ // RUN: %clang_cc1 -std=c++03 -fsyntax-only %s // RUN: %clang_cc1 -std=c++11 -DCXX11 -fsyntax-only %s +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -DCXX11 -DCONCEPTS -fsyntax-only %s #define IS_KEYWORD(NAME) _Static_assert(!__is_identifier(NAME), #NAME) #define NOT_KEYWORD(NAME) _Static_assert(__is_identifier(NAME), #NAME) #define IS_TYPE(NAME) void is_##NAME##_type() { int f(NAME); } +#ifdef CONCEPTS +#define CONCEPTS_KEYWORD(NAME) IS_KEYWORD(NAME) +#else +#define CONCEPTS_KEYWORD(NAME) NOT_KEYWORD(NAME) +#endif + #ifdef CXX11 #define CXX11_KEYWORD(NAME) IS_KEYWORD(NAME) #define CXX11_TYPE(NAME) IS_TYPE(NAME) @@ -27,6 +34,10 @@ CXX11_KEYWORD(noexcept); CXX11_KEYWORD(static_assert); CXX11_KEYWORD(thread_local); +// Concepts TS keywords +CONCEPTS_KEYWORD(concept); +CONCEPTS_KEYWORD(requires); + // Clang extension IS_KEYWORD(__char16_t); IS_TYPE(__char16_t); diff --git a/test/Modules/Inputs/template-default-args/a.h b/test/Modules/Inputs/template-default-args/a.h new file mode 100644 index 0000000000000..1ef1ea5907b52 --- /dev/null +++ b/test/Modules/Inputs/template-default-args/a.h @@ -0,0 +1,4 @@ +template<typename T = int> struct A {}; +template<typename T> struct B {}; +template<typename T> struct C; +template<typename T> struct D; diff --git a/test/Modules/Inputs/template-default-args/b.h b/test/Modules/Inputs/template-default-args/b.h new file mode 100644 index 0000000000000..e69de29bb2d1d --- /dev/null +++ b/test/Modules/Inputs/template-default-args/b.h diff --git a/test/Modules/Inputs/template-default-args/module.modulemap b/test/Modules/Inputs/template-default-args/module.modulemap new file mode 100644 index 0000000000000..6182e6b3eee12 --- /dev/null +++ b/test/Modules/Inputs/template-default-args/module.modulemap @@ -0,0 +1 @@ +module X { module A { header "a.h" } module B { header "b.h" } } diff --git a/test/Modules/template-default-args.cpp b/test/Modules/template-default-args.cpp new file mode 100644 index 0000000000000..63187b8dc190b --- /dev/null +++ b/test/Modules/template-default-args.cpp @@ -0,0 +1,22 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs/template-default-args -std=c++11 %s +// +// expected-no-diagnostics + +template<typename T> struct A; +template<typename T> struct B; +template<typename T> struct C; +template<typename T = int> struct D; + +#include "b.h" + +template<typename T = int> struct A {}; +template<typename T> struct B {}; +template<typename T = int> struct B; +template<typename T = int> struct C; +template<typename T> struct D {}; + +A<> a; +B<> b; +extern C<> c; +D<> d; diff --git a/test/Parser/pragma-loop.cpp b/test/Parser/pragma-loop.cpp index 547d87395ef54..a0213ac50d5a8 100644 --- a/test/Parser/pragma-loop.cpp +++ b/test/Parser/pragma-loop.cpp @@ -132,7 +132,7 @@ void test(int *List, int Length) { /* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop vectorize() /* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count() -/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop unroll() +/* expected-error {{missing argument; expected 'full' or 'disable'}} */ #pragma clang loop unroll() /* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, or unroll_count}} */ #pragma clang loop /* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword diff --git a/test/Preprocessor/arm-target-features.c b/test/Preprocessor/arm-target-features.c index 0dace434abb0a..389877125d11d 100644 --- a/test/Preprocessor/arm-target-features.c +++ b/test/Preprocessor/arm-target-features.c @@ -7,6 +7,7 @@ // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1 // RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s +// RUN: %clang -target x86_64-apple-macosx10.10 -arch armv7s -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s // CHECK-V7: __ARMEL__ 1 // CHECK-V7: __ARM_ARCH 7 // CHECK-V7: __ARM_ARCH_7A__ 1 @@ -137,8 +138,8 @@ // FPUNONE-A5-NOT:#define __ARM_NEON__ 1 // FPUNONE-A5-NOT:#define __ARM_VFPV4__ 1 -// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s -// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp3-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s +// RUN: %clang -target armv7-none-linux-gnueabi -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s +// RUN: %clang -target armv7-none-linux-gnueabi -mthumb -mcpu=cortex-a5 -mfpu=vfp4-d16 -x c -E -dM %s -o - | FileCheck --check-prefix=NONEON-A5 %s // NONEON-A5-NOT:#define __ARM_NEON__ 1 // NONEON-A5:#define __ARM_VFPV4__ 1 diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 91ec4d77b5cc0..e80d57b82cd86 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -2793,6 +2793,12 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd6 -target-feature +sse2 < /dev/null | FileCheck -check-prefix I386-NETBSD6-SSE %s // I386-NETBSD6-SSE:#define __FLT_EVAL_METHOD__ 1 +// RUN: %clang_cc1 -E -dM -triple=i686-pc-mingw32 < /dev/null | FileCheck -check-prefix I386-DECLSPEC %s +// RUN: %clang_cc1 -E -dM -fms-extensions -triple=i686-pc-mingw32 < /dev/null | FileCheck -check-prefix I386-DECLSPEC %s +// RUN: %clang_cc1 -E -dM -triple=i686-unknown-cygwin < /dev/null | FileCheck -check-prefix I386-DECLSPEC %s +// RUN: %clang_cc1 -E -dM -fms-extensions -triple=i686-unknown-cygwin < /dev/null | FileCheck -check-prefix I386-DECLSPEC %s +// I386-DECLSPEC: #define __declspec + // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips-none-none < /dev/null | FileCheck -check-prefix MIPS32BE %s // @@ -6845,10 +6851,10 @@ // SPARC:#define __INTMAX_MAX__ 9223372036854775807LL // SPARC:#define __INTMAX_TYPE__ long long int // SPARC:#define __INTMAX_WIDTH__ 64 -// SPARC:#define __INTPTR_FMTd__ "ld" -// SPARC:#define __INTPTR_FMTi__ "li" -// SPARC:#define __INTPTR_MAX__ 2147483647L -// SPARC:#define __INTPTR_TYPE__ long int +// SPARC:#define __INTPTR_FMTd__ "d" +// SPARC:#define __INTPTR_FMTi__ "i" +// SPARC:#define __INTPTR_MAX__ 2147483647 +// SPARC:#define __INTPTR_TYPE__ int // SPARC:#define __INTPTR_WIDTH__ 32 // SPARC:#define __INT_FAST16_FMTd__ "hd" // SPARC:#define __INT_FAST16_FMTi__ "hi" @@ -6900,7 +6906,7 @@ // SPARC:#define __LONG_MAX__ 2147483647L // SPARC-NOT:#define __LP64__ // SPARC:#define __POINTER_WIDTH__ 32 -// SPARC:#define __PTRDIFF_TYPE__ long int +// SPARC:#define __PTRDIFF_TYPE__ int // SPARC:#define __PTRDIFF_WIDTH__ 32 // SPARC:#define __REGISTER_PREFIX__ // SPARC:#define __SCHAR_MAX__ 127 @@ -6920,7 +6926,7 @@ // SPARC:#define __SIZEOF_WCHAR_T__ 4 // SPARC:#define __SIZEOF_WINT_T__ 4 // SPARC:#define __SIZE_MAX__ 4294967295U -// SPARC:#define __SIZE_TYPE__ long unsigned int +// SPARC:#define __SIZE_TYPE__ unsigned int // SPARC:#define __SIZE_WIDTH__ 32 // SPARC:#define __UINT16_C_SUFFIX__ {{$}} // SPARC:#define __UINT16_MAX__ 65535 @@ -6939,7 +6945,7 @@ // SPARC:#define __UINTMAX_TYPE__ long long unsigned int // SPARC:#define __UINTMAX_WIDTH__ 64 // SPARC:#define __UINTPTR_MAX__ 4294967295U -// SPARC:#define __UINTPTR_TYPE__ long unsigned int +// SPARC:#define __UINTPTR_TYPE__ unsigned int // SPARC:#define __UINTPTR_WIDTH__ 32 // SPARC:#define __UINT_FAST16_MAX__ 65535 // SPARC:#define __UINT_FAST16_TYPE__ unsigned short @@ -6969,6 +6975,15 @@ // SPARC:#define __sparcv8 1 // SPARC:#define sparc 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc-none-netbsd < /dev/null | FileCheck -check-prefix SPARC-NETBSD %s +// SPARC-NETBSD:#define __INTPTR_FMTd__ "ld" +// SPARC-NETBSD:#define __INTPTR_FMTi__ "li" +// SPARC-NETBSD:#define __INTPTR_MAX__ 2147483647L +// SPARC-NETBSD:#define __INTPTR_TYPE__ long int +// SPARC-NETBSD:#define __PTRDIFF_TYPE__ long int +// SPARC-NETBSD:#define __SIZE_TYPE__ long unsigned int +// SPARC-NETBSD:#define __UINTPTR_TYPE__ long unsigned int + // RUN: %clang_cc1 -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s // // TCE-NOT:#define _LP64 @@ -8346,6 +8361,10 @@ // PS4:#define __x86_64 1 // PS4:#define __x86_64__ 1 // +// RUN: %clang_cc1 -E -dM -triple=x86_64-pc-mingw32 < /dev/null | FileCheck -check-prefix X86-64-DECLSPEC %s +// RUN: %clang_cc1 -E -dM -fms-extensions -triple=x86_64-unknown-mingw32 < /dev/null | FileCheck -check-prefix X86-64-DECLSPEC %s +// X86-64-DECLSPEC: #define __declspec +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-none < /dev/null | FileCheck -check-prefix SPARCV9 %s // SPARCV9:#define __INT64_TYPE__ long int // SPARCV9:#define __INTMAX_C_SUFFIX__ L diff --git a/test/Profile/Inputs/func-entry.proftext b/test/Profile/Inputs/func-entry.proftext new file mode 100644 index 0000000000000..f7c2052035d42 --- /dev/null +++ b/test/Profile/Inputs/func-entry.proftext @@ -0,0 +1,10 @@ +foo +0 +1 +1000 + +main +4 +2 +1 +10000 diff --git a/test/Profile/func-entry.c b/test/Profile/func-entry.c new file mode 100644 index 0000000000000..32c20a2a458ed --- /dev/null +++ b/test/Profile/func-entry.c @@ -0,0 +1,19 @@ +// Test that function entry counts are set correctly. + +// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata +// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s + +void foo(void); + +// CHECK: @foo() #0 !prof [[FOO:![0-9]+]] +void foo() { return; } + +// CHECK: @main() #1 !prof [[MAIN:![0-9]+]] +int main() { + int i; + for (i = 0; i < 10000; i++) foo(); + return 0; +} + +// CHECK: [[FOO]] = !{!"function_entry_count", i64 1000} +// CHECK: [[MAIN]] = !{!"function_entry_count", i64 1} diff --git a/test/Sema/PR16678.c b/test/Sema/PR16678.c new file mode 100644 index 0000000000000..a06d0a98ba2d8 --- /dev/null +++ b/test/Sema/PR16678.c @@ -0,0 +1,153 @@ +// RUN: %clang_cc1 -DX32TYPE=ULONG -triple powerpc-unknown-linux-gnu -std=c89 -x c %s -verify +// RUN: %clang_cc1 -DX32TYPE=ULONG -triple powerpc-unknown-linux-gnu -std=iso9899:199409 -x c %s -verify +// RUN: %clang_cc1 -DX32TYPE=ULONG -triple powerpc-unknown-linux-gnu -std=c++98 -x c++ %s -verify +// RUN: %clang_cc1 -DX32TYPE=LLONG -triple powerpc-unknown-linux-gnu -std=c99 -x c %s -verify +// RUN: %clang_cc1 -DX32TYPE=LLONG -triple powerpc-unknown-linux-gnu -std=c11 -x c %s -verify +// RUN: %clang_cc1 -DX32TYPE=LLONG -triple powerpc-unknown-linux-gnu -std=c++11 -x c++ %s -verify +// RUN: %clang_cc1 -DX32TYPE=LLONG -triple powerpc-unknown-linux-gnu -std=c++1y -x c++ %s -verify +// RUN: %clang_cc1 -DX32TYPE=LLONG -triple powerpc-unknown-linux-gnu -std=c++1z -x c++ %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULONG -triple powerpc64-unknown-linux-gnu -std=c89 -x c %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULONG -triple powerpc64-unknown-linux-gnu -std=iso9899:199409 -x c %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULONG -triple powerpc64-unknown-linux-gnu -std=c++98 -x c++ %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULLONG -triple powerpc64-unknown-linux-gnu -std=c99 -x c %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULLONG -triple powerpc64-unknown-linux-gnu -std=c11 -x c %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULLONG -triple powerpc64-unknown-linux-gnu -std=c++11 -x c++ %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULLONG -triple powerpc64-unknown-linux-gnu -std=c++1y -x c++ %s -verify +// RUN: %clang_cc1 -DX64TYPE=ULLONG -triple powerpc64-unknown-linux-gnu -std=c++1z -x c++ %s -verify + +#ifdef X64TYPE +#define X32TYPE long +#endif + +#define IS_ULONG_ULONG 1 +#define IS_ULONG2(X) IS_ULONG_##X +#define IS_ULONG(X) IS_ULONG2(X) + +#if !defined(X64TYPE) && !IS_ULONG(X32TYPE) +// expected-no-diagnostics +#endif + +typedef unsigned long ULONG; +typedef long long LLONG; +typedef unsigned long long ULLONG; + + +/****************************************************************************** + * Test 2^31 as a decimal literal with no suffix and with the "l" and "L" cases. + ******************************************************************************/ +extern X32TYPE x32; +extern __typeof__(2147483648) x32; +extern __typeof__(2147483648l) x32; +extern __typeof__(2147483648L) x32; + +#if IS_ULONG(X32TYPE) +#if !__cplusplus + +/****************************************************************************** + * Under pre-C99 ISO C, unsigned long is attempted for decimal integer literals + * that do not have a suffix containing "u" or "U" if the literal does not fit + * within the range of int or long. See 6.1.3.2 paragraph 5. + ******************************************************************************/ +// expected-warning@39 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will have type 'long long' in C99 onwards}} +// expected-warning@40 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will have type 'long long' in C99 onwards}} +// expected-warning@41 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will have type 'long long' in C99 onwards}} +#else + +/****************************************************************************** + * Under pre-C++11 ISO C++, the same holds if the literal contains an "l" or "L" + * in its suffix; otherwise, the behavior is undefined. See 2.13.1 [lex.icon] + * paragraph 2. + ******************************************************************************/ +// expected-warning@39 {{integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will have type 'long long' in C++11 onwards}} +// expected-warning@40 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will have type 'long long' in C++11 onwards}} +// expected-warning@41 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will have type 'long long' in C++11 onwards}} +#endif +#endif + + +#ifdef X64TYPE + +/****************************************************************************** + * Test 2^63 as a decimal literal with no suffix and with the "l" and "L" cases. + ******************************************************************************/ +extern X64TYPE x64; +extern __typeof__(9223372036854775808) x64; +extern __typeof__(9223372036854775808l) x64; +extern __typeof__(9223372036854775808L) x64; + +#if IS_ULONG(X64TYPE) + +#if !__cplusplus + +/****************************************************************************** + * Under pre-C99 ISO C, unsigned long is attempted for decimal integer literals + * that do not have a suffix containing "u" or "U" if the literal does not fit + * within the range of int or long. See 6.1.3.2 paragraph 5. + ******************************************************************************/ +// expected-warning@74 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will be ill-formed in C99 onwards}} +// expected-warning@75 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will be ill-formed in C99 onwards}} +// expected-warning@76 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C89; this literal will be ill-formed in C99 onwards}} +#else + +/****************************************************************************** + * Under pre-C++11 ISO C++, the same holds if the literal contains an "l" or "L" + * in its suffix; otherwise, the behavior is undefined. See 2.13.1 [lex.icon] + * paragraph 2. + ******************************************************************************/ +// expected-warning@74 {{integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will be ill-formed in C++11 onwards}} +// expected-warning@75 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will be ill-formed in C++11 onwards}} +// expected-warning@76 {{integer literal is too large to be represented in type 'long', interpreting as 'unsigned long' per C++98; this literal will be ill-formed in C++11 onwards}} +#endif +#else + +/****************************************************************************** + * The status quo in C99/C++11-and-later modes for the literals in question is + * to interpret them as unsigned as an extension. + ******************************************************************************/ +// expected-warning@74 {{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}} +// expected-warning@75 {{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}} +// expected-warning@76 {{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}} +#endif +#endif + + +/****************************************************************************** + * Test preprocessor arithmetic with 2^31 as a decimal literal with no suffix + * and with the "l" and "L" cases. + ******************************************************************************/ +#if !IS_ULONG(X32TYPE) + +/****************************************************************************** + * If the literal is signed without need for the modified range of the signed + * integer types within the controlling constant expression for conditional + * inclusion, then it will also be signed with said modified range. + ******************************************************************************/ +#define EXPR(X) ((X - X) - 1 < 0) +#else + +/****************************************************************************** + * Strictly speaking, in pre-C99/C++11 ISO C/C++, the preprocessor arithmetic is + * evaluated with the range of long/unsigned long; however, both Clang and GCC + * evaluate using 64-bits even when long/unsigned long are 32-bits outside of + * preprocessing. + * + * If the range used becomes 32-bits, then this test will enforce the treatment + * as unsigned of the literals in question. + * + * Note: + * Under pre-C99/C++11 ISO C/C++, whether the interpretation of the literal is + * affected by the modified range of the signed and unsigned integer types + * within the controlling constant expression for conditional inclusion is + * unclear. + ******************************************************************************/ +#define PP_LONG_MAX ((0ul - 1ul) >> 1) +#define EXPR(X) \ + (PP_LONG_MAX >= 0x80000000 || (X - X) - 1 > 0) // either 2^31 fits into a + // preprocessor "long" or the + // literals in question are + // unsigned +#endif + +#if !(EXPR(2147483648) && EXPR(2147483648l) && EXPR(2147483648L)) +#error Unexpected signedness or conversion behavior +#endif diff --git a/test/Sema/asm.c b/test/Sema/asm.c index 6c6f3f398e330..1a1e02993a723 100644 --- a/test/Sema/asm.c +++ b/test/Sema/asm.c @@ -204,3 +204,20 @@ void fn6() { : "=rm"(a), "=rm"(a) : "11m"(a)) // expected-error {{invalid input constraint '11m' in asm}} } + +// PR14269 +typedef struct test16_foo { + unsigned int field1 : 1; + unsigned int field2 : 2; + unsigned int field3 : 3; +} test16_foo; +test16_foo x; +void test16() +{ + __asm__("movl $5, %0" + : "=rm" (x.field2)); // expected-error {{reference to a bit-field in asm output with a memory constraint '=rm'}} + __asm__("movl $5, %0" + : + : "m" (x.field3)); // expected-error {{reference to a bit-field in asm input with a memory constraint 'm'}} +} + diff --git a/test/Sema/ast-print-x86.c b/test/Sema/ast-print-x86.c new file mode 100644 index 0000000000000..0059776b3dc1e --- /dev/null +++ b/test/Sema/ast-print-x86.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple i686-elf %s -ast-print | FileCheck %s + +// REQUIRES: x86-registered-target + +void assembly() { + int added; + // CHECK: asm volatile ("addl %%ebx,%%eax" : "=a" (added) : "a" (1), "b" (2)); + __asm__ __volatile__("addl %%ebx,%%eax" : "=a" (added) : "a" (1), "b" (2) ); +} diff --git a/test/Sema/ast-print.c b/test/Sema/ast-print.c index 4b2b43190d424..b4d76844fef78 100644 --- a/test/Sema/ast-print.c +++ b/test/Sema/ast-print.c @@ -45,3 +45,11 @@ typedef struct { // CHECK: struct __attribute__((visibility("default"))) S; struct __attribute__((visibility("default"))) S; + +struct pair_t { + int a; + int b; +}; + +// CHECK: struct pair_t p = {a: 3, .b = 4}; +struct pair_t p = {a: 3, .b = 4}; diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index 883cced9f3b07..5f5b6f3dc1981 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -134,3 +134,6 @@ EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned)&Test50 + 10)) // expected-e // <rdar://problem/11874571> EVAL_EXPR(51, 0 != (float)1e99) + +// PR21945 +void PR21945() { int i = (({}), 0l); } diff --git a/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp b/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp index 0c7d354c30654..bfda837e9590b 100644 --- a/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp +++ b/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp @@ -6,3 +6,9 @@ enum ENUM; // expected-warning {{forward references to 'enum' types are a Micros ENUM *var = 0; ENUM var2 = (ENUM)3; enum ENUM1* var3 = 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}} + +typedef void (*FnPtrTy)(); +void (*PR23733_1)() = static_cast<FnPtrTy>((void *)0); // expected-warning {{static_cast between pointer-to-function and pointer-to-object is a Microsoft extension}} +void (*PR23733_2)() = FnPtrTy((void *)0); +void (*PR23733_3)() = (FnPtrTy)((void *)0); +void (*PR23733_4)() = reinterpret_cast<FnPtrTy>((void *)0); diff --git a/test/SemaCXX/attr-noreturn.cpp b/test/SemaCXX/attr-noreturn.cpp index 41214c4f4b453..6df008dffa813 100644 --- a/test/SemaCXX/attr-noreturn.cpp +++ b/test/SemaCXX/attr-noreturn.cpp @@ -17,6 +17,154 @@ namespace test5 { } } +namespace destructor_tests { + __attribute__((noreturn)) void fail(); + + struct A { + ~A() __attribute__((noreturn)) { fail(); } + }; + struct B { + B() {} + ~B() __attribute__((noreturn)) { fail(); } + }; + struct C : A {}; + struct D : B {}; + struct E : virtual A {}; + struct F : A, virtual B {}; + struct G : E {}; + struct H : virtual D {}; + struct I : A {}; + struct J : I {}; + struct K : virtual A {}; + struct L : K {}; + struct M : virtual C {}; + struct N : M {}; + struct O { N n; }; + + __attribute__((noreturn)) void test_1() { A a; } + __attribute__((noreturn)) void test_2() { B b; } + __attribute__((noreturn)) void test_3() { C c; } + __attribute__((noreturn)) void test_4() { D d; } + __attribute__((noreturn)) void test_5() { E e; } + __attribute__((noreturn)) void test_6() { F f; } + __attribute__((noreturn)) void test_7() { G g; } + __attribute__((noreturn)) void test_8() { H h; } + __attribute__((noreturn)) void test_9() { I i; } + __attribute__((noreturn)) void test_10() { J j; } + __attribute__((noreturn)) void test_11() { K k; } + __attribute__((noreturn)) void test_12() { L l; } + __attribute__((noreturn)) void test_13() { M m; } + __attribute__((noreturn)) void test_14() { N n; } + __attribute__((noreturn)) void test_15() { O o; } + + __attribute__((noreturn)) void test_16() { const A& a = A(); } + __attribute__((noreturn)) void test_17() { const B& b = B(); } + __attribute__((noreturn)) void test_18() { const C& c = C(); } + __attribute__((noreturn)) void test_19() { const D& d = D(); } + __attribute__((noreturn)) void test_20() { const E& e = E(); } + __attribute__((noreturn)) void test_21() { const F& f = F(); } + __attribute__((noreturn)) void test_22() { const G& g = G(); } + __attribute__((noreturn)) void test_23() { const H& h = H(); } + __attribute__((noreturn)) void test_24() { const I& i = I(); } + __attribute__((noreturn)) void test_25() { const J& j = J(); } + __attribute__((noreturn)) void test_26() { const K& k = K(); } + __attribute__((noreturn)) void test_27() { const L& l = L(); } + __attribute__((noreturn)) void test_28() { const M& m = M(); } + __attribute__((noreturn)) void test_29() { const N& n = N(); } + __attribute__((noreturn)) void test_30() { const O& o = O(); } + + struct AA {}; + struct BB { BB() {} ~BB() {} }; + struct CC : AA {}; + struct DD : BB {}; + struct EE : virtual AA {}; + struct FF : AA, virtual BB {}; + struct GG : EE {}; + struct HH : virtual DD {}; + struct II : AA {}; + struct JJ : II {}; + struct KK : virtual AA {}; + struct LL : KK {}; + struct MM : virtual CC {}; + struct NN : MM {}; + struct OO { NN n; }; + + __attribute__((noreturn)) void test_31() { + AA a; + BB b; + CC c; + DD d; + EE e; + FF f; + GG g; + HH h; + II i; + JJ j; + KK k; + LL l; + MM m; + NN n; + OO o; + + const AA& aa = AA(); + const BB& bb = BB(); + const CC& cc = CC(); + const DD& dd = DD(); + const EE& ee = EE(); + const FF& ff = FF(); + const GG& gg = GG(); + const HH& hh = HH(); + const II& ii = II(); + const JJ& jj = JJ(); + const KK& kk = KK(); + const LL& ll = LL(); + const MM& mm = MM(); + const NN& nn = NN(); + const OO& oo = OO(); + } // expected-warning {{function declared 'noreturn' should not return}} + + struct P { + ~P() __attribute__((noreturn)) { fail(); } + void foo() {} + }; + struct Q : P { }; + __attribute__((noreturn)) void test31() { + P().foo(); + } + __attribute__((noreturn)) void test32() { + Q().foo(); + } + + struct R { + A a[5]; + }; + __attribute__((noreturn)) void test33() { + R r; + } + + // FIXME: Code flow analysis does not preserve information about non-null + // pointers, so it can't determine that this function is noreturn. + __attribute__((noreturn)) void test34() { + A *a = new A; + delete a; + } // expected-warning {{function declared 'noreturn' should not return}} + + struct S { + virtual ~S(); + }; + struct T : S { + __attribute__((noreturn)) ~T(); + }; + + // FIXME: Code flow analysis does not preserve information about non-null + // pointers or derived class pointers, so it can't determine that this + // function is noreturn. + __attribute__((noreturn)) void test35() { + S *s = new T; + delete s; + } // expected-warning {{function declared 'noreturn' should not return}} +} + // PR5620 void f0() __attribute__((__noreturn__)); void f1(void (*)()); diff --git a/test/SemaCXX/cxx11-gnu-attrs.cpp b/test/SemaCXX/cxx11-gnu-attrs.cpp index ac9cc55b9fcb0..d20617815e6a0 100644 --- a/test/SemaCXX/cxx11-gnu-attrs.cpp +++ b/test/SemaCXX/cxx11-gnu-attrs.cpp @@ -8,6 +8,19 @@ int [[gnu::unused]] attr_on_type; // expected-error@-1 {{'unused' attribute cannot be applied to types}} int *[[gnu::unused]] attr_on_ptr; // expected-warning@-1 {{attribute 'unused' ignored, because it cannot be applied to a type}} +[[gnu::fastcall]] void pr17424_1(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +[[gnu::fastcall]] [[gnu::stdcall]] void pr17424_2(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{calling convention 'stdcall' ignored for this target}} +[[gnu::fastcall]] __stdcall void pr17424_3(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{calling convention '__stdcall' ignored for this target}} +[[gnu::fastcall]] void pr17424_4() [[gnu::stdcall]]; +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{attribute 'stdcall' ignored, because it cannot be applied to a type}} +void pr17424_5 [[gnu::fastcall]](); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} // Valid cases. diff --git a/test/SemaCXX/dllexport.cpp b/test/SemaCXX/dllexport.cpp index e41952562c88e..badb9e259597c 100644 --- a/test/SemaCXX/dllexport.cpp +++ b/test/SemaCXX/dllexport.cpp @@ -439,21 +439,17 @@ class __declspec(dllexport) DerivedFromExportedTemplate : public ExportedClassTe // ImportedTemplate is explicitly imported. class __declspec(dllexport) DerivedFromImportedTemplate : public ImportedClassTemplate<int> {}; -#ifdef MS -// expected-note@+4{{class template 'ClassTemplate<double>' was instantiated here}} -// expected-warning@+4{{propagating dll attribute to already instantiated base class template without dll attribute is not supported}} -// expected-note@+3{{attribute is here}} -#endif class DerivedFromTemplateD : public ClassTemplate<double> {}; +// Base class previously implicitly instantiated without attribute; it will get propagated. class __declspec(dllexport) DerivedFromTemplateD2 : public ClassTemplate<double> {}; -#ifdef MS -// expected-note@+4{{class template 'ClassTemplate<bool>' was instantiated here}} -// expected-warning@+4{{propagating dll attribute to already instantiated base class template with different dll attribute is not supported}} -// expected-note@+3{{attribute is here}} -#endif -class __declspec(dllimport) DerivedFromTemplateB : public ClassTemplate<bool> {}; -class __declspec(dllexport) DerivedFromTemplateB2 : public ClassTemplate<bool> {}; +// Base class has explicit instantiation declaration; the attribute will get propagated. +extern template class ClassTemplate<float>; +class __declspec(dllexport) DerivedFromTemplateF : public ClassTemplate<float> {}; + +class __declspec(dllexport) DerivedFromTemplateB : public ClassTemplate<bool> {}; +// The second derived class doesn't change anything, the attribute that was propagated first wins. +class __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate<bool> {}; #ifdef MS // expected-warning@+3{{propagating dll attribute to explicitly specialized base class template without dll attribute is not supported}} @@ -479,6 +475,10 @@ struct __declspec(dllexport) DerivedFromExplicitlyExportInstantiatedTemplate : p // Base class already instantiated with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {}; +template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase<int>; +struct __declspec(dllexport) DerivedFromExplicitInstantiationDeclTemplateBase : public ExplicitInstantiationDeclTemplateBase<int> {}; + //===----------------------------------------------------------------------===// // Precedence diff --git a/test/SemaCXX/dllimport.cpp b/test/SemaCXX/dllimport.cpp index 6052ea1feef9d..0f616d43c89d2 100644 --- a/test/SemaCXX/dllimport.cpp +++ b/test/SemaCXX/dllimport.cpp @@ -1274,21 +1274,17 @@ class __declspec(dllimport) DerivedFromImportedTemplate : public ImportedClassTe // ExportedClassTemplate is explicitly exported. class __declspec(dllimport) DerivedFromExportedTemplate : public ExportedClassTemplate<int> {}; -#ifdef MS -// expected-note@+4{{class template 'ClassTemplate<double>' was instantiated here}} -// expected-warning@+4{{propagating dll attribute to already instantiated base class template without dll attribute is not supported}} -// expected-note@+3{{attribute is here}} -#endif class DerivedFromTemplateD : public ClassTemplate<double> {}; +// Base class previously implicitly instantiated without attribute; it will get propagated. class __declspec(dllimport) DerivedFromTemplateD2 : public ClassTemplate<double> {}; -#ifdef MS -// expected-note@+4{{class template 'ClassTemplate<bool>' was instantiated here}} -// expected-warning@+4{{propagating dll attribute to already instantiated base class template with different dll attribute is not supported}} -// expected-note@+3{{attribute is here}} -#endif -class __declspec(dllexport) DerivedFromTemplateB : public ClassTemplate<bool> {}; -class __declspec(dllimport) DerivedFromTemplateB2 : public ClassTemplate<bool> {}; +// Base class has explicit instantiation declaration; the attribute will get propagated. +extern template class ClassTemplate<float>; +class __declspec(dllimport) DerivedFromTemplateF : public ClassTemplate<float> {}; + +class __declspec(dllimport) DerivedFromTemplateB : public ClassTemplate<bool> {}; +// The second derived class doesn't change anything, the attribute that was propagated first wins. +class __declspec(dllexport) DerivedFromTemplateB2 : public ClassTemplate<bool> {}; template <typename T> struct ExplicitlySpecializedTemplate { void func() {} }; #ifdef MS @@ -1333,3 +1329,7 @@ struct __declspec(dllimport) DerivedFromExplicitlyExportInstantiatedTemplate : p // Base class already instantiated with import attribute. struct __declspec(dllimport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {}; + +template <typename T> struct ExplicitInstantiationDeclTemplateBase { void func() {} }; +extern template struct ExplicitInstantiationDeclTemplateBase<int>; +struct __declspec(dllimport) DerivedFromExplicitInstantiationDeclTemplateBase : public ExplicitInstantiationDeclTemplateBase<int> {}; |