Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Sep 20, 2025

Fixes regression after e5bbaa9.
e5500 accidentally still had the 64bit feature applied instead of
64bit-support.

Fixes regression after e5bbaa9.
e5500 accidentally still had the 64bit feature applied instead of
64bit-support.
Copy link
Contributor Author

arsenm commented Sep 20, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm marked this pull request as ready for review September 20, 2025 02:00
@llvmbot
Copy link
Member

llvmbot commented Sep 20, 2025

@llvm/pr-subscribers-backend-powerpc

Author: Matt Arsenault (arsenm)

Changes

Fixes regression after e5bbaa9.
e5500 accidentally still had the 64bit feature applied instead of
64bit-support.


Full diff: https://github.com/llvm/llvm-project/pull/159893.diff

2 Files Affected:

  • (modified) llvm/lib/Target/PowerPC/PPC.td (+1-1)
  • (added) llvm/test/CodeGen/PowerPC/ppc32_64bit_support_cpus.ll (+66)
diff --git a/llvm/lib/Target/PowerPC/PPC.td b/llvm/lib/Target/PowerPC/PPC.td
index d491e88b66ad8..d89a9487c0da2 100644
--- a/llvm/lib/Target/PowerPC/PPC.td
+++ b/llvm/lib/Target/PowerPC/PPC.td
@@ -695,7 +695,7 @@ def : ProcessorModel<"e500mc", PPCE500mcModel,
                    FeatureSTFIWX, FeatureICBT, FeatureBookE,
                    FeatureISEL, FeatureMFTB]>;
 def : ProcessorModel<"e5500", PPCE5500Model,
-                  [DirectiveE5500, FeatureMFOCRF, Feature64Bit,
+                  [DirectiveE5500, FeatureMFOCRF, Feature64BitSupport,
                    FeatureSTFIWX, FeatureICBT, FeatureBookE,
                    FeatureISEL, FeatureMFTB]>;
 def : ProcessorModel<"a2", PPCA2Model,
diff --git a/llvm/test/CodeGen/PowerPC/ppc32_64bit_support_cpus.ll b/llvm/test/CodeGen/PowerPC/ppc32_64bit_support_cpus.ll
new file mode 100644
index 0000000000000..d9ce9e663040d
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/ppc32_64bit_support_cpus.ll
@@ -0,0 +1,66 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -mtriple=powerpc-unknown-linux-gnu -mcpu=e5500 < %s | FileCheck -check-prefix=PPC32 %s
+; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=e5500 < %s | FileCheck -check-prefix=PPC64 %s
+
+; Test that ppc32 triples work on cpus that support 64-bit.
+
+declare void @func(ptr)
+declare void @func_no_args()
+
+define void @call_assert() #0 {
+; PPC32-LABEL: call_assert:
+; PPC32:       # %bb.0:
+; PPC32-NEXT:    mflr 0
+; PPC32-NEXT:    stwu 1, -16(1)
+; PPC32-NEXT:    li 3, 0
+; PPC32-NEXT:    stw 0, 20(1)
+; PPC32-NEXT:    bl func
+; PPC32-NEXT:    lwz 0, 20(1)
+; PPC32-NEXT:    addi 1, 1, 16
+; PPC32-NEXT:    mtlr 0
+; PPC32-NEXT:    blr
+;
+; PPC64-LABEL: call_assert:
+; PPC64:       # %bb.0:
+; PPC64-NEXT:    mflr 0
+; PPC64-NEXT:    stdu 1, -112(1)
+; PPC64-NEXT:    li 3, 0
+; PPC64-NEXT:    std 0, 128(1)
+; PPC64-NEXT:    bl func
+; PPC64-NEXT:    nop
+; PPC64-NEXT:    addi 1, 1, 112
+; PPC64-NEXT:    ld 0, 16(1)
+; PPC64-NEXT:    mtlr 0
+; PPC64-NEXT:    blr
+  call void @func(ptr null)
+  ret void
+}
+
+define void @call_nop_select_fail() #0 {
+; PPC32-LABEL: call_nop_select_fail:
+; PPC32:       # %bb.0:
+; PPC32-NEXT:    mflr 0
+; PPC32-NEXT:    stwu 1, -16(1)
+; PPC32-NEXT:    stw 0, 20(1)
+; PPC32-NEXT:    bl func_no_args
+; PPC32-NEXT:    lwz 0, 20(1)
+; PPC32-NEXT:    addi 1, 1, 16
+; PPC32-NEXT:    mtlr 0
+; PPC32-NEXT:    blr
+;
+; PPC64-LABEL: call_nop_select_fail:
+; PPC64:       # %bb.0:
+; PPC64-NEXT:    mflr 0
+; PPC64-NEXT:    stdu 1, -112(1)
+; PPC64-NEXT:    std 0, 128(1)
+; PPC64-NEXT:    bl func_no_args
+; PPC64-NEXT:    nop
+; PPC64-NEXT:    addi 1, 1, 112
+; PPC64-NEXT:    ld 0, 16(1)
+; PPC64-NEXT:    mtlr 0
+; PPC64-NEXT:    blr
+  call void @func_no_args()
+  ret void
+}
+
+attributes #0 = { nounwind }

@arsenm arsenm enabled auto-merge (squash) September 20, 2025 02:01
@arsenm arsenm merged commit 5eebb58 into main Sep 20, 2025
13 checks passed
@arsenm arsenm deleted the users/arsenm/ppc/fix-e5500-using-64bit-feature branch September 20, 2025 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants