From 55a34378b2e5983ae0dc2de26e1b1d6dfd928467 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Thu, 9 Nov 2023 04:37:43 +0800
Subject: [PATCH 12/12] macro-assembler-ppc.h: fix asserts for ppc

---
 src/codegen/ppc/macro-assembler-ppc.cc | 13 +++++++------
 src/codegen/ppc/macro-assembler-ppc.h  |  4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/codegen/ppc/macro-assembler-ppc.cc b/src/codegen/ppc/macro-assembler-ppc.cc
index 99d1e819f75..aaa268c2a66 100644
--- a/v8/src/codegen/ppc/macro-assembler-ppc.cc
+++ b/v8/src/codegen/ppc/macro-assembler-ppc.cc
@@ -2367,7 +2367,7 @@ void MacroAssembler::Xor(Register ra, Register rs, const Operand& rb,
 
 void MacroAssembler::CmpSmiLiteral(Register src1, Smi smi, Register scratch,
                                    CRegister cr) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   Cmpi(src1, Operand(smi), scratch, cr);
 #else
   LoadSmiLiteral(scratch, smi);
@@ -2377,7 +2377,7 @@ void MacroAssembler::CmpSmiLiteral(Register src1, Smi smi, Register scratch,
 
 void MacroAssembler::CmplSmiLiteral(Register src1, Smi smi, Register scratch,
                                     CRegister cr) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   Cmpli(src1, Operand(smi), scratch, cr);
 #else
   LoadSmiLiteral(scratch, smi);
@@ -2387,7 +2387,7 @@ void MacroAssembler::CmplSmiLiteral(Register src1, Smi smi, Register scratch,
 
 void MacroAssembler::AddSmiLiteral(Register dst, Register src, Smi smi,
                                    Register scratch) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   Add(dst, src, static_cast<intptr_t>(smi.ptr()), scratch);
 #else
   LoadSmiLiteral(scratch, smi);
@@ -2397,7 +2397,7 @@ void MacroAssembler::AddSmiLiteral(Register dst, Register src, Smi smi,
 
 void MacroAssembler::SubSmiLiteral(Register dst, Register src, Smi smi,
                                    Register scratch) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   Add(dst, src, -(static_cast<intptr_t>(smi.ptr())), scratch);
 #else
   LoadSmiLiteral(scratch, smi);
@@ -2407,7 +2407,7 @@ void MacroAssembler::SubSmiLiteral(Register dst, Register src, Smi smi,
 
 void MacroAssembler::AndSmiLiteral(Register dst, Register src, Smi smi,
                                    Register scratch, RCBit rc) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   And(dst, src, Operand(smi), rc);
 #else
   LoadSmiLiteral(scratch, smi);
@@ -2916,7 +2916,8 @@ void TurboAssembler::LoadEntryFromBuiltinIndex(Register builtin_index) {
 
   // The builtin_index register contains the builtin index as a Smi.
   // Untagging is folded into the indexing operand below.
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+  // TODO: verify this specifically.
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
   ShiftLeftImm(builtin_index, builtin_index,
                Operand(kSystemPointerSizeLog2 - kSmiShift));
 #else
diff --git a/src/codegen/ppc/macro-assembler-ppc.h b/src/codegen/ppc/macro-assembler-ppc.h
index 2c46124b24d..7134db3e1b4 100644
--- a/v8/src/codegen/ppc/macro-assembler-ppc.h
+++ b/v8/src/codegen/ppc/macro-assembler-ppc.h
@@ -892,7 +892,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
   }
 
   void SmiToPtrArrayOffset(Register dst, Register src) {
-#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if defined(V8_COMPRESS_POINTERS) || defined(V8_31BIT_SMIS_ON_64BIT_ARCH) || defined(V8_TARGET_ARCH_PPC)
     STATIC_ASSERT(kSmiTag == 0 && kSmiShift < kPointerSizeLog2);
     ShiftLeftImm(dst, src, Operand(kPointerSizeLog2 - kSmiShift));
 #else
@@ -911,7 +911,7 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
   void AssertNotSmi(Register object);
   void AssertSmi(Register object);
 
-#if !defined(V8_COMPRESS_POINTERS) && !defined(V8_31BIT_SMIS_ON_64BIT_ARCH)
+#if !defined(V8_COMPRESS_POINTERS) && !defined(V8_31BIT_SMIS_ON_64BIT_ARCH) && !defined(V8_TARGET_ARCH_PPC)
   // Ensure it is permissible to read/write int value directly from
   // upper half of the smi.
   STATIC_ASSERT(kSmiTag == 0);
