[llvm] [MIPS] Use same logic as Clang when setting setMaxAtomicSizeInBitsSupported (PR #124218)

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 19:37:42 PST 2025


https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/124218

>From 40a12f8c6dfcd02294b86583427b0097e252a5d9 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Thu, 23 Jan 2025 20:56:15 -0500
Subject: [PATCH] [MIPS] Use same logic as Clang when setting
 setMaxAtomicSizeInBitsSupported

Which means not setting setMaxAtomicSizeInBitsSupported to 32 on Mips 1.
---
 llvm/lib/Target/Mips/MipsISelLowering.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 7c4257c222c0ba..21df09a8bc92a2 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -519,10 +519,12 @@ MipsTargetLowering::MipsTargetLowering(const MipsTargetMachine &TM,
   setTargetDAGCombine({ISD::SDIVREM, ISD::UDIVREM, ISD::SELECT, ISD::AND,
                        ISD::OR, ISD::ADD, ISD::SUB, ISD::AssertZext, ISD::SHL});
 
-  if (Subtarget.isGP64bit())
+  if (ABI.IsN32() || ABI.IsN64())
     setMaxAtomicSizeInBitsSupported(64);
-  else
+  else if (Subtarget.hasMips2())
     setMaxAtomicSizeInBitsSupported(32);
+  else
+    setMaxAtomicSizeInBitsSupported(0);
 
   setMinFunctionAlignment(Subtarget.isGP64bit() ? Align(8) : Align(4));
 



More information about the llvm-commits mailing list