adenilson / rpms / zlib

Forked from rpms/zlib 8 months ago
Clone
68c528
From 480b65cae6c20a41aa698a6c9d3b260f6f744004 Mon Sep 17 00:00:00 2001
68c528
From: Ilya Leoshkevich <iii@linux.ibm.com>
68c528
Date: Thu, 2 Feb 2023 19:41:32 +0100
68c528
Subject: [PATCH] 0003-PATCH-Fix-clang-s-behavior-on-versions-7.patch
68c528
68c528
---
68c528
 contrib/power/clang_workaround.h | 15 ++++++++++-----
68c528
 1 file changed, 10 insertions(+), 5 deletions(-)
68c528
68c528
diff --git a/contrib/power/clang_workaround.h b/contrib/power/clang_workaround.h
68c528
index b5e7dae..915f7e5 100644
68c528
--- a/contrib/power/clang_workaround.h
68c528
+++ b/contrib/power/clang_workaround.h
68c528
@@ -39,7 +39,12 @@ __vector unsigned long long  __builtin_pack_vector (unsigned long __a,
68c528
 	return __v;
68c528
 }
68c528
 
68c528
-#ifndef vec_xxpermdi
68c528
+/*
68c528
+ * Clang 7 changed the behavior of vec_xxpermdi in order to provide the same
68c528
+ * behavior of GCC. That means code adapted to Clang >= 7 does not work on
68c528
+ * Clang <= 6.  So, fallback to __builtin_unpack_vector() on Clang <= 6.
68c528
+ */
68c528
+#if !defined vec_xxpermdi || __clang_major__ <= 6
68c528
 
68c528
 static inline
68c528
 unsigned long __builtin_unpack_vector (__vector unsigned long long __v,
68c528
@@ -62,9 +67,9 @@ static inline
68c528
 unsigned long __builtin_unpack_vector_0 (__vector unsigned long long __v)
68c528
 {
68c528
 	#if defined(__BIG_ENDIAN__)
68c528
-	return vec_xxpermdi(__v, __v, 0x0)[1];
68c528
-	#else
68c528
 	return vec_xxpermdi(__v, __v, 0x0)[0];
68c528
+	#else
68c528
+	return vec_xxpermdi(__v, __v, 0x3)[0];
68c528
 	#endif
68c528
 }
68c528
 
68c528
@@ -72,9 +77,9 @@ static inline
68c528
 unsigned long __builtin_unpack_vector_1 (__vector unsigned long long __v)
68c528
 {
68c528
 	#if defined(__BIG_ENDIAN__)
68c528
-	return vec_xxpermdi(__v, __v, 0x3)[1];
68c528
-	#else
68c528
 	return vec_xxpermdi(__v, __v, 0x3)[0];
68c528
+	#else
68c528
+	return vec_xxpermdi(__v, __v, 0x0)[0];
68c528
 	#endif
68c528
 }
68c528
 #endif /* vec_xxpermdi */
68c528
-- 
68c528
2.39.1
68c528