Skip to content

Commit a517127

Browse files
authored
[PowerPC][LLC] Utilize PPC::getNormalizedPPCTargetCPU() to set CPU (#113943)
Utilize common API in PPCTargetParser (#97541) to set default CPU with same interfaces for LLC. This will update AIX default CPU to pwr7 and LoP powerppc64 default CPU to ppc64.
1 parent 227afac commit a517127

File tree

72 files changed

+185
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+185
-118
lines changed

llvm/docs/ReleaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ Changes to the MIPS Backend
164164
Changes to the PowerPC Backend
165165
------------------------------
166166

167+
* The Linux `ppc64` LLC default cpu is updated from `ppc` to `ppc64`.
168+
* The AIX LLC default cpu is updated from `generic` to `pwr7`.
169+
167170
Changes to the RISC-V Backend
168171
-----------------------------
169172

llvm/lib/Target/PowerPC/PPCSubtarget.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "llvm/MC/TargetRegistry.h"
3030
#include "llvm/Support/CommandLine.h"
3131
#include "llvm/Target/TargetMachine.h"
32+
#include "llvm/TargetParser/PPCTargetParser.h"
3233
#include <cstdlib>
3334

3435
using namespace llvm;
@@ -79,13 +80,10 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,
7980
// Determine default and user specified characteristics
8081
std::string CPUName = std::string(CPU);
8182
if (CPUName.empty() || CPU == "generic") {
82-
// If cross-compiling with -march=ppc64le without -mcpu
83-
if (TargetTriple.getArch() == Triple::ppc64le)
84-
CPUName = "ppc64le";
85-
else if (TargetTriple.getSubArch() == Triple::PPCSubArch_spe)
83+
if (TargetTriple.getSubArch() == Triple::PPCSubArch_spe)
8684
CPUName = "e500";
8785
else
88-
CPUName = "generic";
86+
CPUName = std::string(PPC::getNormalizedPPCTargetCPU(TargetTriple));
8987
}
9088

9189
// Determine the CPU to schedule for.

llvm/test/Analysis/LoopCacheAnalysis/PowerPC/compute-cost-m32.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "powerpc-ibm-aix7.2.0.0"
66
; Check IndexedReference::computeRefCost can handle type differences between
77
; CacheLineSize and Numerator
88

9-
; CHECK: Loop '_loop_1_do_' has cost = 2
9+
; CHECK: Loop '_loop_1_do_' has cost = 1
1010

1111
%_elem_type_of_v = type <{ i32 }>
1212

llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
2+
; RUN: llc -mcpu=ppc -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
33
;; Formerly crashed, see PR 1508
44
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
55
target triple = "powerpc64-unknown-linux-gnu"

llvm/test/CodeGen/PowerPC/Frames-dyn-alloca.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s -check-prefix=PPC32-LINUX
2-
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=PPC64-LINUX
2+
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=ppc | FileCheck %s -check-prefix=PPC64-LINUX
33
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -frame-pointer=all | FileCheck %s -check-prefix=PPC32-LINUX
4-
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -frame-pointer=all | FileCheck %s -check-prefix=PPC64-LINUX
4+
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=ppc -frame-pointer=all | FileCheck %s -check-prefix=PPC64-LINUX
55
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s -check-prefix=PPC32-LINUX
66

77
; RUN: llc < %s -mcpu=pwr4 -mattr=-altivec -verify-machineinstrs \

llvm/test/CodeGen/PowerPC/Frames-large.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu \
55
; RUN: -frame-pointer=all | FileCheck %s -check-prefix=PPC32-LINUX-FP
66

7-
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu | \
7+
; RUN: llc -verify-machineinstrs < %s -mcpu=ppc -mtriple=powerpc64-unknown-linux-gnu | \
88
; RUN: FileCheck %s -check-prefix=PPC64-LINUX-NOFP
99

10-
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu \
10+
; RUN: llc -verify-machineinstrs < %s -mcpu=ppc -mtriple=powerpc64-unknown-linux-gnu \
1111
; RUN: -frame-pointer=all | FileCheck %s -check-prefix=PPC64-LINUX-FP
1212

1313
; RUN: llc -verify-machineinstrs < %s -mcpu=pwr4 -mattr=-altivec \

llvm/test/CodeGen/PowerPC/P10-stack-alignment.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
33
; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
44
; RUN: FileCheck %s --check-prefix=CHECK-LE
5-
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
5+
; RUN: llc -verify-machineinstrs -mcpu=ppc -mtriple=powerpc64-unknown-linux-gnu \
66
; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
77
; RUN: FileCheck %s --check-prefix=CHECK-BE
88
; RUN: opt --passes='sroa,loop-vectorize,loop-unroll,instcombine' -S \

llvm/test/CodeGen/PowerPC/aix-cc-abi-mir.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
2-
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -stop-after=machine-cp -verify-machineinstrs < %s | \
2+
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -mcpu=ppc -stop-after=machine-cp -verify-machineinstrs < %s | \
33
; RUN: FileCheck --check-prefix=32BIT %s
44

5-
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp -verify-machineinstrs < %s | \
5+
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mcpu=ppc -stop-after=machine-cp -verify-machineinstrs < %s | \
66
; RUN: FileCheck --check-prefix=64BIT %s
77

88
define void @call_test_chars() {

llvm/test/CodeGen/PowerPC/aix-dwarf.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
2+
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -mcpu=ppc -filetype=obj -o %t.o < %s
33
; RUN: llvm-readobj --section-headers %t.o | FileCheck %s --check-prefixes=SEC,SEC32
44
; RUN: llvm-objdump -r %t.o | FileCheck %s --check-prefix=RELO
55

6-
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t64.o < %s
6+
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mcpu=ppc -filetype=obj -o %t64.o < %s
77
; RUN: llvm-readobj --section-headers %t64.o | FileCheck %s --check-prefixes=SEC,SEC64
88
; RUN: llvm-objdump -r %t64.o | FileCheck %s --check-prefix=RELO64
99

llvm/test/CodeGen/PowerPC/aix-static-init-non-default-priority.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
2-
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s | FileCheck %s
1+
; RUN: llc -mtriple powerpc-ibm-aix-xcoff -mcpu=ppc -verify-machineinstrs < %s | FileCheck %s
2+
; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mcpu=ppc -verify-machineinstrs < %s | FileCheck %s
33

44
@llvm.global_ctors = appending global [5 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @cf1, ptr null }, { i32, ptr, ptr } { i32 21, ptr @cf2, ptr null }, { i32, ptr, ptr } { i32 81, ptr @cf3, ptr null }, { i32, ptr, ptr } { i32 1125, ptr @cf4, ptr null }, { i32, ptr, ptr } { i32 64512, ptr @cf5, ptr null }]
55
@llvm.global_dtors = appending global [5 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 20, ptr @df1, ptr null }, { i32, ptr, ptr } { i32 80, ptr @df2, ptr null }, { i32, ptr, ptr } { i32 1124, ptr @df3, ptr null }, { i32, ptr, ptr } { i32 64511, ptr @df4, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @df5, ptr null }]

0 commit comments

Comments
 (0)