1From 734aaa66800b91abe42bdef1dd721c368fa17b07 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Mar 2022 16:28:16 -0800
4Subject: [PATCH] compiler-rt: Enable __int128 for ppc32
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 compiler-rt/lib/builtins/CMakeLists.txt | 7 +++----
10 compiler-rt/lib/builtins/int_types.h    | 2 +-
11 2 files changed, 4 insertions(+), 5 deletions(-)
12
13diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
14index ea5ad9cdb864..4d1efc690d71 100644
15--- a/compiler-rt/lib/builtins/CMakeLists.txt
16+++ b/compiler-rt/lib/builtins/CMakeLists.txt
17@@ -607,8 +607,6 @@ set(mips64_SOURCES ${GENERIC_TF_SOURCES}
18 set(mips64el_SOURCES ${GENERIC_TF_SOURCES}
19                      ${mips_SOURCES})
20
21-set(powerpc_SOURCES ${GENERIC_SOURCES})
22-
23 set(powerpcspe_SOURCES ${GENERIC_SOURCES})
24
25 set(powerpc64_SOURCES
26@@ -634,6 +632,7 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
27   )
28 endif()
29 set(powerpc64le_SOURCES ${powerpc64_SOURCES})
30+set(powerpc_SOURCES ${powerpc64_SOURCES})
31
32 set(riscv_SOURCES
33   riscv/save.S
34@@ -740,9 +739,9 @@ else ()
35         list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
36       endif()
37
38-      # For RISCV32, we must force enable int128 for compiling long
39+      # For RISCV32/PPC32, we must force enable int128 for compiling long
40       # double routines.
41-      if("${arch}" STREQUAL "riscv32")
42+      if("${arch}" STREQUAL "riscv32" OR "${arch}" STREQUAL "powerpc" )
43         list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
44       endif()
45
46diff --git a/compiler-rt/lib/builtins/int_types.h b/compiler-rt/lib/builtins/int_types.h
47index 7a72de480676..9ee5a327b28a 100644
48--- a/compiler-rt/lib/builtins/int_types.h
49+++ b/compiler-rt/lib/builtins/int_types.h
50@@ -64,7 +64,7 @@ typedef union {
51 } udwords;
52
53 #if defined(__LP64__) || defined(__wasm__) || defined(__mips64) ||             \
54-    defined(__riscv) || defined(_WIN64)
55+    defined(__riscv) || defined(_WIN64) || defined(__powerpc__)
56 #define CRT_HAS_128BIT
57 #endif
58
59