diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -1810,6 +1810,11 @@ return (vector bool __int128)__builtin_altivec_vcmpequq( (vector bool __int128)__a, (vector bool __int128)__b); } + +static __inline__ vector bool __int128 __ATTRS_o_ai +vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) { + return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b); +} #endif #ifdef __POWER9_VECTOR__ @@ -1887,6 +1892,11 @@ return (vector bool __int128) ~(__builtin_altivec_vcmpequq( (vector bool __int128)__a, (vector bool __int128)__b)); } + +static __inline__ vector bool __int128 __ATTRS_o_ai +vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) { + return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b)); +} #endif /* vec_cmpnez */ @@ -14870,6 +14880,11 @@ vector unsigned __int128 __b) { return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); } + +static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a, + vector bool __int128 __b) { + return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); +} #endif /* vec_all_ge */ @@ -15815,6 +15830,11 @@ vector unsigned __int128 __b) { return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); } + +static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a, + vector bool __int128 __b) { + return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); +} #endif /* vec_all_nge */ @@ -16104,6 +16124,11 @@ vector unsigned __int128 __b) { return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); } + +static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a, + vector bool __int128 __b) { + return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); +} #endif /* vec_any_ge */ @@ -17079,6 +17104,11 @@ vector unsigned __int128 __b) { return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); } + +static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a, + vector bool __int128 __b) { + return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); +} #endif /* vec_any_nge */ diff --git a/clang/test/CodeGen/builtins-ppc-p10vector.c b/clang/test/CodeGen/builtins-ppc-p10vector.c --- a/clang/test/CodeGen/builtins-ppc-p10vector.c +++ b/clang/test/CodeGen/builtins-ppc-p10vector.c @@ -19,6 +19,7 @@ vector unsigned long long vulla, vullb, vullc; vector signed __int128 vsi128a, vsi128b, vsi128c; vector unsigned __int128 vui128a, vui128b, vui128c; +vector bool __int128 vbi128a, vbi128b; vector float vfa, vfb; vector double vda, vdb; float fa; @@ -1637,6 +1638,13 @@ return vec_cmpeq(vui128a, vui128b); } +vector bool __int128 test_vec_cmpeq_bool_int128(void) { + // CHECK-LABEL: @test_vec_cmpeq_bool_int128( + // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128> + // CHECK-NEXT: ret <1 x i128> + return vec_cmpeq(vbi128a, vbi128b); +} + vector bool __int128 test_vec_cmpne_s128(void) { // CHECK-LABEL: @test_vec_cmpne_s128( // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128> @@ -1653,6 +1661,14 @@ return vec_cmpne(vui128a, vui128b); } +vector bool __int128 test_vec_cmpne_bool_int128(void) { + // CHECK-LABEL: @test_vec_cmpne_bool_int128( + // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpequq(<1 x i128> + // CHECK-NEXT: %neg.i = xor <1 x i128> %4, + // CHECK-NEXT: ret <1 x i128> + return vec_cmpne(vbi128a, vbi128b); +} + vector bool __int128 test_vec_cmpgt_s128(void) { // CHECK-LABEL: @test_vec_cmpgt_s128( // CHECK: call <1 x i128> @llvm.ppc.altivec.vcmpgtsq(<1 x i128> @@ -1727,6 +1743,13 @@ return vec_any_eq(vsi128a, vsi128b); } +int test_vec_any_eq_bool_int128(void) { + // CHECK-LABEL: @test_vec_any_eq_bool_int128( + // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 1, <1 x i128> %2, <1 x i128> %3) + // CHECK-NEXT: ret i32 + return vec_any_eq(vbi128a, vbi128b); +} + int test_vec_any_ne_s128(void) { // CHECK-LABEL: @test_vec_any_ne_s128( // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 3, <1 x i128> %2, <1 x i128> %3) @@ -1741,6 +1764,13 @@ return vec_any_ne(vui128a, vui128b); } +int test_vec_any_ne_bool_int128(void) { + // CHECK-LABEL: @test_vec_any_ne_bool_int128( + // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 3, <1 x i128> %2, <1 x i128> %3) + // CHECK-NEXT: ret i32 + return vec_any_ne(vbi128a, vbi128b); +} + int test_vec_any_lt_s128(void) { // CHECK-LABEL: @test_vec_any_lt_s128( // CHECK: call i32 @llvm.ppc.altivec.vcmpgtsq.p(i32 1, <1 x i128> %2, <1 x i128> %3) @@ -1811,6 +1841,13 @@ return vec_all_eq(vui128a, vui128b); } +int test_vec_all_eq_bool_int128(void) { + // CHECK-LABEL: @test_vec_all_eq_bool_int128 + // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 2, <1 x i128> %2, <1 x i128> %3) + // CHECK-NEXT: ret i32 + return vec_all_eq(vbi128a, vbi128b); +} + int test_vec_all_ne_s128(void) { // CHECK-LABEL: @test_vec_all_ne_s128( // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 0, <1 x i128> %2, <1 x i128> %3) @@ -1825,6 +1862,13 @@ return vec_all_ne(vui128a, vui128b); } +int test_vec_all_ne_bool_int128(void) { + // CHECK-LABEL: test_vec_all_ne_bool_int128 + // CHECK: call i32 @llvm.ppc.altivec.vcmpequq.p(i32 0, <1 x i128> %2, <1 x i128> %3) + // CHECK-NEXT: ret i32 + return vec_all_ne(vbi128a, vbi128b); +} + int test_vec_all_lt_s128(void) { // CHECK-LABEL: @test_vec_all_lt_s128( // CHECK: call i32 @llvm.ppc.altivec.vcmpgtsq.p(i32 2, <1 x i128> %2, <1 x i128> %3)