Author: Maryam Moghadas Date: 2023-02-21T15:44:57-06:00 New Revision: ee815ff2ce8d0782cf04f5cad1d4038207f661cf
URL: https://github.com/llvm/llvm-project/commit/ee815ff2ce8d0782cf04f5cad1d4038207f661cf DIFF: https://github.com/llvm/llvm-project/commit/ee815ff2ce8d0782cf04f5cad1d4038207f661cf.diff LOG: [PowerPC] Fix the implicit casting for the emulated intrinsics This patch is to fix some implicit castings for emulated intrinsics so that there are no lax-vector-conversions errors and warnings. Reviewed By: nemanjai, #powerpc Differential Revision: https://reviews.llvm.org/D144293 Added: Modified: clang/lib/Headers/ppc_wrappers/emmintrin.h clang/lib/Headers/ppc_wrappers/smmintrin.h clang/test/CodeGen/PowerPC/ppc-smmintrin.c Removed: ################################################################################ diff --git a/clang/lib/Headers/ppc_wrappers/emmintrin.h b/clang/lib/Headers/ppc_wrappers/emmintrin.h index 0814ea5593bad..fc18ab9d43b15 100644 --- a/clang/lib/Headers/ppc_wrappers/emmintrin.h +++ b/clang/lib/Headers/ppc_wrappers/emmintrin.h @@ -46,6 +46,7 @@ /* SSE2 */ typedef __vector double __v2df; +typedef __vector float __v4f; typedef __vector long long __v2di; typedef __vector unsigned long long __v2du; typedef __vector int __v4si; @@ -951,7 +952,7 @@ extern __inline __m128d _mm_cvtpi32_pd(__m64 __A) { __v4si __temp; __v2di __tmp2; - __v2df __result; + __v4f __result; __temp = (__v4si)vec_splats(__A); __tmp2 = (__v2di)vec_unpackl(__temp); diff --git a/clang/lib/Headers/ppc_wrappers/smmintrin.h b/clang/lib/Headers/ppc_wrappers/smmintrin.h index 6fe6d2a157a59..349b395c4f00b 100644 --- a/clang/lib/Headers/ppc_wrappers/smmintrin.h +++ b/clang/lib/Headers/ppc_wrappers/smmintrin.h @@ -305,9 +305,9 @@ extern __inline int extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_blend_epi16(__m128i __A, __m128i __B, const int __imm8) { - __v16qi __charmask = vec_splats((signed char)__imm8); + __v16qu __charmask = vec_splats((unsigned char)__imm8); __charmask = vec_gb(__charmask); - __v8hu __shortmask = (__v8hu)vec_unpackh(__charmask); + __v8hu __shortmask = (__v8hu)vec_unpackh((__v16qi)__charmask); #ifdef __BIG_ENDIAN__ __shortmask = vec_reve(__shortmask); #endif diff --git a/clang/test/CodeGen/PowerPC/ppc-smmintrin.c b/clang/test/CodeGen/PowerPC/ppc-smmintrin.c index 5033526fd3369..220b65c1ce164 100644 --- a/clang/test/CodeGen/PowerPC/ppc-smmintrin.c +++ b/clang/test/CodeGen/PowerPC/ppc-smmintrin.c @@ -73,7 +73,7 @@ test_blend() { // CHECK-LABEL: define available_externally <2 x i64> @_mm_blend_epi16(<2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, <2 x i64> noundef %{{[0-9a-zA-Z_.]+}}, i32 noundef signext %{{[0-9a-zA-Z_.]+}}) // CHECK: %[[TRUNC:[0-9a-zA-Z_.]+]] = trunc i32 %{{[0-9a-zA-Z_.]+}} to i8 -// CHECK: call <16 x i8> @vec_splats(signed char)(i8 noundef signext %[[TRUNC]]) +// CHECK: call <16 x i8> @vec_splats(unsigned char)(i8 noundef zeroext %[[TRUNC]]) // CHECK: call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %{{[0-9a-zA-Z_.]+}}) // CHECK: %[[PACK:[0-9a-zA-Z_.]+]] = call <8 x i16> @vec_unpackh(signed char vector[16]) // CHECK: store <8 x i16> %[[PACK]], ptr %{{[0-9a-zA-Z_.]+}}, align 16 @@ -232,8 +232,8 @@ void __attribute__((noinline)) test_round() { _mm_round_ps(mn1, 0); _mm_round_ss(mn1, mn2, 0); - _mm_round_pd(mn1, 0); - _mm_round_sd(mn1, mn2, 0); + _mm_round_pd(md1, 0); + _mm_round_sd(md1, md2, 0); } // CHECK-LABEL: @test_round _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits