-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Mips] Support llvm.readcyclecounter intrinsic #114953
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
;RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips32r2 < %s | FileCheck %s --check-prefix=MIPSEL | ||
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. What will happen for pre-r2 or non Linux? 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. Please add test cases for
|
||
;RUN: llc -mtriple=mips64el-linux-gnuabi64 -mcpu=mips64r2 < %s | FileCheck %s --check-prefix=MIPS64EL | ||
;RUN: llc -mtriple=mipsel-linux-gnu -mcpu=mips2 < %s | FileCheck %s --check-prefix=MIPSEL | ||
;RUN: llc -mtriple=mips64el-linux-gnuabi64 -mcpu=mips3 < %s | FileCheck %s --check-prefix=MIPS64EL | ||
;RUN: llc -mtriple=mipsel -mcpu=mips32r2 < %s | FileCheck %s --check-prefix=MIPSEL | ||
;RUN: llc -mtriple=mips64el -mcpu=mips64r2 < %s | FileCheck %s --check-prefix=MIPS64EL | ||
;RUN: llc -mtriple=mipsel -mcpu=mips2 < %s | FileCheck %s --check-prefix=MIPSEL_NOT_SUPPORTED | ||
;RUN: llc -mtriple=mips64el -mcpu=mips3 < %s | FileCheck %s --check-prefix=MIPS64EL_NOT_SUPPORTED | ||
|
||
define i64 @test_readcyclecounter() nounwind { | ||
; MIPSEL-LABEL: test_readcyclecounter: | ||
; MIPSEL: # %bb.0: # %entry | ||
; MIPSEL-NEXT: .set push | ||
; MIPSEL-NEXT: .set mips32r2 | ||
; MIPSEL-NEXT: rdhwr $2, $hwr_cc | ||
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. Ohh, I find another problem, the return value is 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. @yingopq please fix this problem. |
||
; MIPSEL-NEXT: .set pop | ||
; MIPSEL-NEXT: jr $ra | ||
; MIPSEL-NEXT: addiu $3, $zero, 0 | ||
; | ||
; MIPSEL_NOT_SUPPORTED-LABEL: test_readcyclecounter: | ||
; MIPSEL_NOT_SUPPORTED: # %bb.0: # %entry | ||
; MIPSEL_NOT_SUPPORTED-NEXT: addiu $2, $zero, 0 | ||
; MIPSEL_NOT_SUPPORTED-NEXT: jr $ra | ||
; MIPSEL_NOT_SUPPORTED-NEXT: addiu $3, $zero, 0 | ||
; | ||
; MIPS64EL-LABEL: test_readcyclecounter: | ||
; MIPS64EL: # %bb.0: # %entry | ||
; MIPS64EL-NEXT: .set push | ||
; MIPS64EL-NEXT: .set mips32r2 | ||
; MIPS64EL-NEXT: rdhwr $2, $hwr_cc | ||
; MIPS64EL-NEXT: .set pop | ||
; MIPS64EL-NEXT: jr $ra | ||
; MIPS64EL-NEXT: nop | ||
; | ||
; MIPS64EL_NOT_SUPPORTED-LABEL: test_readcyclecounter: | ||
; MIPS64EL_NOT_SUPPORTED: # %bb.0: # %entry | ||
; MIPS64EL_NOT_SUPPORTED-NEXT: jr $ra | ||
; MIPS64EL_NOT_SUPPORTED-NEXT: daddiu $2, $zero, 0 | ||
entry: | ||
%tmp0 = call i64 @llvm.readcyclecounter() | ||
ret i64 %tmp0 | ||
} | ||
|
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.
We should only support it for mips32r2+ or linux triples.
I mean you should check if it is mips32r2+ or the os section of triple is Linux.