-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[Xtensa] Implement THREADPTR and DFPAccel Xtensa Options. #145543
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
5 commits
Select commit
Hold shift + click to select a range
dcf0ea1
[Xtensa] Implement THREADPTR and DFPAccel Xtensa Options.
andreisfr 8ecbd81
[Xtensa] Minor fixes.
andreisfr db4f250
[Xtensa] Fix TLS Address lowering.
andreisfr d601f28
[Xtensa] Minor fixes.
andreisfr 280cdd5
[Xtensa] Fix TLS Address lowering and tests.
andreisfr 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,11 +186,17 @@ bool Xtensa::checkRegister(MCRegister RegNo, const FeatureBitset &FeatureBits, | |
| return FeatureBits[Xtensa::FeatureMiscSR]; | ||
| case Xtensa::PRID: | ||
| return RAType == Xtensa::REGISTER_READ && FeatureBits[Xtensa::FeaturePRID]; | ||
| case Xtensa::THREADPTR: | ||
| return FeatureBits[FeatureTHREADPTR]; | ||
| case Xtensa::VECBASE: | ||
| return FeatureBits[Xtensa::FeatureRelocatableVector]; | ||
| case Xtensa::FCR: | ||
| case Xtensa::FSR: | ||
| return FeatureBits[FeatureSingleFloat]; | ||
| case Xtensa::F64R_LO: | ||
| case Xtensa::F64R_HI: | ||
| case Xtensa::F64S: | ||
| return FeatureBits[FeatureDFPAccel]; | ||
| case Xtensa::WINDOWBASE: | ||
| case Xtensa::WINDOWSTART: | ||
| return FeatureBits[Xtensa::FeatureWindowed]; | ||
|
|
@@ -203,12 +209,23 @@ bool Xtensa::checkRegister(MCRegister RegNo, const FeatureBitset &FeatureBits, | |
|
|
||
| // Get Xtensa User Register by encoding value. | ||
| MCRegister Xtensa::getUserRegister(unsigned Code, const MCRegisterInfo &MRI) { | ||
| MCRegister UserReg = Xtensa::NoRegister; | ||
|
|
||
| if (MRI.getEncodingValue(Xtensa::FCR) == Code) { | ||
| return Xtensa::FCR; | ||
| UserReg = Xtensa::FCR; | ||
| } else if (MRI.getEncodingValue(Xtensa::FSR) == Code) { | ||
| return Xtensa::FSR; | ||
| UserReg = Xtensa::FSR; | ||
| } else if (MRI.getEncodingValue(Xtensa::F64R_LO) == Code) { | ||
| UserReg = Xtensa::F64R_LO; | ||
| } else if (MRI.getEncodingValue(Xtensa::F64R_HI) == Code) { | ||
| UserReg = Xtensa::F64R_HI; | ||
| } else if (MRI.getEncodingValue(Xtensa::F64S) == Code) { | ||
| UserReg = Xtensa::F64S; | ||
| } else if (MRI.getEncodingValue(Xtensa::THREADPTR) == Code) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no else after return
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I rewrote the function code. |
||
| UserReg = Xtensa::THREADPTR; | ||
| } | ||
| return Xtensa::NoRegister; | ||
|
|
||
| return UserReg; | ||
| } | ||
|
|
||
| static MCAsmInfo *createXtensaMCAsmInfo(const MCRegisterInfo &MRI, | ||
|
|
||
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
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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ; RUN: not llc -mtriple=xtensa -mattr=+threadptr -relocation-model=pic -filetype=null < %s 2>&1 \ | ||
| ; RUN: | FileCheck -check-prefix=XTENSA-PIC %s | ||
| ; RUN: not llc -mtriple=xtensa -filetype=null < %s 2>&1 \ | ||
| ; RUN: | FileCheck -check-prefix=XTENSA-NO-THREADPTR %s | ||
|
|
||
| ; XTENSA-PIC: error: <unknown>:0:0: in function f i32 (): only local-exec and initial-exec TLS mode supported | ||
| ; XTENSA-PIC: error: <unknown>:0:0: in function f i32 (): PIC relocations are not supported | ||
|
|
||
| ; XTENSA-NO-THREADPTR: error: <unknown>:0:0: in function f i32 (): only emulated TLS supported | ||
|
|
||
| @i = external thread_local global i32 | ||
|
|
||
| define i32 @f() { | ||
| entry: | ||
| %tmp1 = load i32, ptr @i | ||
| ret i32 %tmp1 | ||
| } |
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,18 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc -mtriple=xtensa -mattr=+threadptr < %s | FileCheck %s | ||
|
|
||
| @i = external thread_local global i32 | ||
|
|
||
| define i32 @f() { | ||
| ; CHECK-LABEL: f: | ||
| ; CHECK: .cfi_startproc | ||
| ; CHECK-NEXT: # %bb.0: # %entry | ||
| ; CHECK-NEXT: l32r a8, .LCPI0_0 | ||
| ; CHECK-NEXT: rur a9, threadptr | ||
| ; CHECK-NEXT: add a8, a9, a8 | ||
| ; CHECK-NEXT: l32i a2, a8, 0 | ||
| ; CHECK-NEXT: ret | ||
| entry: | ||
| %tmp1 = load i32, ptr @i | ||
| ret i32 %tmp1 | ||
| } |
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,19 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5 | ||
| # RUN: llvm-mc -triple=xtensa -mattr=+dfpaccel -disassemble %s | FileCheck -check-prefixes=CHECK-DFPACCEL %s | ||
| # RUN: not llvm-mc -triple=xtensa -disassemble %s 2>&1 | FileCheck --implicit-check-not=warning: -check-prefixes=CHECK-CORE %s | ||
|
|
||
| ## Verify that binary code is correctly disassembled with | ||
| ## DFPACCEL option enabled. Also verify that dissasembling without | ||
| ## DFPACCEL option generates warnings. | ||
|
|
||
| [0xa0,0x3e,0xe3] | ||
| # CHECK-DFPACCEL: rur a3, f64r_lo | ||
| # CHECK-CORE: :[[@LINE-2]]:2: warning: invalid instruction encoding | ||
|
|
||
| [0xb0,0x3e,0xe3] | ||
| # CHECK-DFPACCEL: rur a3, f64r_hi | ||
| # CHECK-CORE: :[[@LINE-2]]:2: warning: invalid instruction encoding | ||
|
|
||
| [0xc0,0x3e,0xe3] | ||
| # CHECK-DFPACCEL: rur a3, f64s | ||
| # CHECK-CORE: :[[@LINE-2]]:2: warning: invalid instruction encoding |
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,11 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5 | ||
| # RUN: llvm-mc -triple=xtensa -mattr=+threadptr -disassemble %s | FileCheck -check-prefixes=CHECK-THREADPTR %s | ||
| # RUN: not llvm-mc -triple=xtensa -disassemble %s 2>&1 | FileCheck --implicit-check-not=warning: -check-prefixes=CHECK-CORE %s | ||
|
|
||
| ## Verify that binary code is correctly disassembled with | ||
| ## THREADPTR option enabled. Also verify that dissasembling without | ||
| ## THREADPTR option generates warnings. | ||
|
|
||
| [0x70,0x3e,0xe3] | ||
| # CHECK-THREADPTR: rur a3, threadptr | ||
| # CHECK-CORE: :[[@LINE-2]]:2: warning: invalid instruction encoding |
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,53 @@ | ||
| # RUN: llvm-mc %s -triple=xtensa -show-encoding --mattr=+dfpaccel \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK,CHECK-INST %s | ||
|
|
||
| .align 4 | ||
| LBL0: | ||
|
|
||
| # CHECK-INST: rur a3, f64r_lo | ||
| # CHECK: encoding: [0xa0,0x3e,0xe3] | ||
| rur a3, f64r_lo | ||
|
|
||
| # CHECK-INST: rur a3, f64r_lo | ||
| # CHECK: encoding: [0xa0,0x3e,0xe3] | ||
| rur a3, 234 | ||
|
|
||
| # CHECK-INST: rur a3, f64r_lo | ||
| # CHECK: encoding: [0xa0,0x3e,0xe3] | ||
| rur.f64r_lo a3 | ||
|
|
||
| # CHECK-INST: wur a3, f64r_lo | ||
| # CHECK: encoding: [0x30,0xea,0xf3] | ||
| wur a3, f64r_lo | ||
|
|
||
| # CHECK-INST: rur a3, f64r_hi | ||
| # CHECK: encoding: [0xb0,0x3e,0xe3] | ||
| rur a3, f64r_hi | ||
|
|
||
| # CHECK-INST: rur a3, f64r_hi | ||
| # CHECK: encoding: [0xb0,0x3e,0xe3] | ||
| rur a3, 235 | ||
|
|
||
| # CHECK-INST: rur a3, f64r_hi | ||
| # CHECK: encoding: [0xb0,0x3e,0xe3] | ||
| rur.f64r_hi a3 | ||
|
|
||
| # CHECK-INST: wur a3, f64r_hi | ||
| # CHECK: encoding: [0x30,0xeb,0xf3] | ||
| wur a3, f64r_hi | ||
|
|
||
| # CHECK-INST: rur a3, f64s | ||
| # CHECK: encoding: [0xc0,0x3e,0xe3] | ||
| rur a3, f64s | ||
|
|
||
| # CHECK-INST: rur a3, f64s | ||
| # CHECK: encoding: [0xc0,0x3e,0xe3] | ||
| rur a3, 236 | ||
|
|
||
| # CHECK-INST: rur a3, f64s | ||
| # CHECK: encoding: [0xc0,0x3e,0xe3] | ||
| rur.f64s a3 | ||
|
|
||
| # CHECK-INST: wur a3, f64s | ||
| # CHECK: encoding: [0x30,0xec,0xf3] | ||
| wur a3, f64s |
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.
This file doesn't seem to exist (unless it's automatically generated and that for some reason doesn't happen on our build bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/38131/steps/canvas?sid=0197cba7-2e95-40b3-9381-0d2daeb1afaf)
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.
Thank you, I'm preparing fix.
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.
@TimNN , I created PR #146731
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.
Fixed.