-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[PowerPC][AIX] Emit PowerPC version for XCOFF #113214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b3ab7fa
[PowerPC][AIX] Emit PowerPC version for XCOFF
amy-kwan b5dffed
Update patch to use PPCTargetXCOFFStreamer instead.
amy-kwan cd8e424
Fix clang format
amy-kwan 06119fa
Fix comment and pull out code into variable.
amy-kwan 7e696cf
Fix static_cast, move AIX specific code into XCOFFObjectWriter
amy-kwan 6aab9cb
Remove unncessary variables/functions from MCAssembler.h
amy-kwan 1a05e2b
Add test case with multiple target-cpu
amy-kwan 4a6bbc9
Add CHECK-NOT for older target-cpu in test case
amy-kwan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
llvm/test/CodeGen/PowerPC/aix-cpu-version-multifunction.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s | ||
|
||
; For the .machine directive emitted on AIX, the "target-cpu" attribute that is | ||
; the newest will be used as the CPU for the module (in this case, PWR10). | ||
|
||
; CHECK: .file "file.c" | ||
; CHECK-NEXT: .csect ..text..[PR],5 | ||
; CHECK-NEXT: .rename ..text..[PR],"" | ||
; CHECK-NEXT: .machine "PWR10" | ||
; CHECK-NOT: .machine "PWR8" | ||
|
||
source_filename = "file.c" | ||
|
||
define dso_local signext i32 @testFunc1() #0 { | ||
entry: | ||
%retval = alloca i32, align 4 | ||
store i32 0, ptr %retval, align 4 | ||
ret i32 0 | ||
} | ||
|
||
define dso_local signext i32 @testFunc2() #1 { | ||
entry: | ||
%retval = alloca i32, align 4 | ||
store i32 0, ptr %retval, align 4 | ||
ret i32 0 | ||
} | ||
|
||
attributes #0 = { "target-cpu" = "pwr8" } | ||
attributes #1 = { "target-cpu" = "pwr10" } | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s | ||
|
||
; CHECK: .file "1.c" | ||
; CHECK-NEXT: .csect ..text..[PR],5 | ||
; CHECK-NEXT: .rename ..text..[PR],"" | ||
; CHECK-NEXT: .machine "PWR8" | ||
|
||
source_filename = "1.c" | ||
|
||
define dso_local signext i32 @main() #0 { | ||
entry: | ||
%retval = alloca i32, align 4 | ||
store i32 0, ptr %retval, align 4 | ||
ret i32 0 | ||
} | ||
|
||
attributes #0 = {"target-cpu"="pwr8"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,57 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ,OBJ32 %s | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t64.o < %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ,OBJ64 %s | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr9 < %s | FileCheck --check-prefixes=ASM %s | ||
|
||
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr9 -filetype=obj -o %t.o < %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ32 %s | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr9 -filetype=obj -o %t64.o < %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ64 %s | ||
|
||
source_filename = "1.c" | ||
|
||
; OBJ: Name: .file | ||
; OBJ: Source Language ID: TB_C (0x0) | ||
; OBJ32: CPU Version ID: TCPU_COM (0x3) | ||
; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) | ||
; OBJ: Name: 1.c | ||
; ASM: .file "1.c",,"LLVM{{.*}}" | ||
; ASM-NEXT: .csect ..text..[PR],5 | ||
; ASM-NEXT: .rename ..text..[PR],"" | ||
; ASM-NEXT: .machine "PWR9" | ||
|
||
; OBJ32: Symbol { | ||
; OBJ32-NEXT: Index: 0 | ||
; OBJ32-NEXT: Name: .file | ||
; OBJ32-NEXT: Value (SymbolTableIndex): 0x0 | ||
; OBJ32-NEXT: Section: N_DEBUG | ||
; OBJ32-NEXT: Source Language ID: TB_C (0x0) | ||
; OBJ32-NEXT: CPU Version ID: TCPU_PWR9 (0x1A) | ||
; OBJ32-NEXT: StorageClass: C_FILE (0x67) | ||
; OBJ32-NEXT: NumberOfAuxEntries: 2 | ||
; OBJ32-NEXT: File Auxiliary Entry { | ||
; OBJ32-NEXT: Index: 1 | ||
; OBJ32-NEXT: Name: 1.c | ||
; OBJ32-NEXT: Type: XFT_FN (0x0) | ||
; OBJ32-NEXT: } | ||
; OBJ32-NEXT: File Auxiliary Entry { | ||
; OBJ32-NEXT: Index: 2 | ||
; OBJ32-NEXT: Name: LLVM | ||
; OBJ32-NEXT: Type: XFT_CV (0x2) | ||
; OBJ32-NEXT: } | ||
; OBJ32-NEXT: } | ||
|
||
; OBJ64: Symbol { | ||
; OBJ64-NEXT: Index: 0 | ||
; OBJ64-NEXT: Name: .file | ||
; OBJ64-NEXT: Value (SymbolTableIndex): 0x0 | ||
; OBJ64-NEXT: Section: N_DEBUG | ||
; OBJ64-NEXT: Source Language ID: TB_C (0x0) | ||
; OBJ64-NEXT: CPU Version ID: TCPU_PWR9 (0x1A) | ||
; OBJ64-NEXT: StorageClass: C_FILE (0x67) | ||
; OBJ64-NEXT: NumberOfAuxEntries: 2 | ||
; OBJ64-NEXT: File Auxiliary Entry { | ||
; OBJ64-NEXT: Index: 1 | ||
; OBJ64-NEXT: Name: 1.c | ||
; OBJ64-NEXT: Type: XFT_FN (0x0) | ||
; OBJ64-NEXT: Auxiliary Type: AUX_FILE (0xFC) | ||
; OBJ64-NEXT: } | ||
; OBJ64-NEXT: File Auxiliary Entry { | ||
; OBJ64-NEXT: Index: 2 | ||
; OBJ64-NEXT: Name: LLVM | ||
; OBJ64-NEXT: Type: XFT_CV (0x2) | ||
; OBJ64-NEXT: Auxiliary Type: AUX_FILE (0xFC) | ||
; OBJ64-NEXT: } | ||
; OBJ64-NEXT: } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ,OBJ32 %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ %s | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t64.o < %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ,OBJ64 %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ %s | ||
|
||
source_filename = "1.cpp" | ||
|
||
; OBJ: Name: .file | ||
; OBJ: Source Language ID: TB_CPLUSPLUS (0x9) | ||
; OBJ32: CPU Version ID: TCPU_COM (0x3) | ||
; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) | ||
; OBJ: CPU Version ID: TCPU_PWR7 (0x18) | ||
; OBJ: Name: 1.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ,OBJ32 %s | ||
; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=OBJ %s | ||
; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t64.o < %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ,OBJ64 %s | ||
; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=OBJ %s | ||
|
||
source_filename = "1.f95" | ||
|
||
; OBJ: Name: .file | ||
; OBJ: Source Language ID: TB_Fortran (0x1) | ||
; OBJ32: CPU Version ID: TCPU_COM (0x3) | ||
; OBJ64: CPU Version ID: TCPU_PPC64 (0x2) | ||
; OBJ: CPU Version ID: TCPU_PWR7 (0x18) | ||
; OBJ: Name: 1.f95 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a test case for the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
llvm/test/CodeGen/PowerPC/aix-cpu-version.ll
is supposed to cover this. Or am I misunderstanding your comment?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my suggestion is that two functions with different "target-cpu" value since there is for loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diggerlin Does https://github.com/llvm/llvm-project/pull/113214/files#diff-2e809a9d9830c21bfba3193739b08c17aad49154bc669f409c1c543837414dfb sufficiently address your comment?