-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Mark {vl, vtype} as clobber in inline assembly #128636
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
Closed
HankChang736
wants to merge
3
commits into
llvm:main
from
HankChang736:HankChang736/add-clobber-constraints-to-inline-asm
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
37 changes: 37 additions & 0 deletions
37
llvm/test/CodeGen/RISCV/rvv/vsetvl-cross-inline-asm-clobber.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,37 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=riscv64 -mcpu=sifive-x280 -verify-machineinstrs < %s | FileCheck %s | ||
|
||
define void @foo(<vscale x 8 x half> %0, <vscale x 8 x half> %1) { | ||
; CHECK-LABEL: foo: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma | ||
; CHECK-NEXT: vmv.v.i v12, 0 | ||
; CHECK-NEXT: lui a0, 1 | ||
; CHECK-NEXT: addiw a0, a0, -1096 | ||
; CHECK-NEXT: vmv.v.i v16, 0 | ||
; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma | ||
; CHECK-NEXT: #APP | ||
; CHECK-NEXT: vfmadd.vv v16, v12, v12 | ||
; CHECK-NEXT: #NO_APP | ||
; CHECK-NEXT: #APP | ||
; CHECK-NEXT: vfmadd.vv v16, v12, v12 | ||
; CHECK-NEXT: #NO_APP | ||
; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma | ||
; CHECK-NEXT: vse16.v v8, (zero) | ||
; CHECK-NEXT: ret | ||
entry: | ||
%2 = tail call i64 @llvm.riscv.vsetvli.i64(i64 3000, i64 0, i64 0) | ||
%3 = tail call <vscale x 8 x float> asm sideeffect "vfmadd.vv $0, $1, $2", "=^vr,^vr,^vr,0,~{vl},~{vtype}"(<vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer) | ||
%4 = tail call <vscale x 8 x float> asm sideeffect "vfmadd.vv $0, $1, $2", "=^vr,^vr,^vr,0,~{vl},~{vtype}"(<vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer, <vscale x 8 x float> %3) | ||
tail call void @llvm.riscv.vse.nxv8f16.i64(<vscale x 8 x half> %0, ptr null, i64 %2) | ||
ret void | ||
} | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none) | ||
declare i64 @llvm.riscv.vsetvli.i64(i64, i64 immarg, i64 immarg) #0 | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: write) | ||
declare void @llvm.riscv.vse.nxv8f16.i64(<vscale x 8 x half>, ptr nocapture, i64) #1 | ||
|
||
attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) } | ||
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) } |
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,37 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=riscv64 -mcpu=sifive-x280 -verify-machineinstrs < %s | FileCheck %s | ||
|
||
define void @foo(<vscale x 8 x half> %0, <vscale x 8 x half> %1) { | ||
; CHECK-LABEL: foo: | ||
; CHECK: # %bb.0: # %entry | ||
; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma | ||
; CHECK-NEXT: vmv.v.i v12, 0 | ||
; CHECK-NEXT: lui a0, 1 | ||
; CHECK-NEXT: addiw a0, a0, -1096 | ||
; CHECK-NEXT: vmv.v.i v16, 0 | ||
; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma | ||
; CHECK-NEXT: #APP | ||
; CHECK-NEXT: vfmadd.vv v16, v12, v12 | ||
; CHECK-NEXT: #NO_APP | ||
; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma | ||
; CHECK-NEXT: #APP | ||
; CHECK-NEXT: vfmadd.vv v16, v12, v12 | ||
; CHECK-NEXT: #NO_APP | ||
; CHECK-NEXT: vse16.v v8, (zero) | ||
; CHECK-NEXT: ret | ||
entry: | ||
%2 = tail call i64 @llvm.riscv.vsetvli.i64(i64 3000, i64 0, i64 0) | ||
%3 = tail call <vscale x 8 x float> asm sideeffect "vfmadd.vv $0, $1, $2", "=^vr,^vr,^vr,0"(<vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer) | ||
%4 = tail call <vscale x 8 x float> asm sideeffect "vfmadd.vv $0, $1, $2", "=^vr,^vr,^vr,0"(<vscale x 8 x float> zeroinitializer, <vscale x 8 x float> zeroinitializer, <vscale x 8 x float> %3) | ||
tail call void @llvm.riscv.vse.nxv8f16.i64(<vscale x 8 x half> %0, ptr null, i64 %2) | ||
ret void | ||
} | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none) | ||
declare i64 @llvm.riscv.vsetvli.i64(i64, i64 immarg, i64 immarg) #0 | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: write) | ||
declare void @llvm.riscv.vse.nxv8f16.i64(<vscale x 8 x half>, ptr nocapture, i64) #1 | ||
|
||
attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) } | ||
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) } |
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.
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 this implementation is better, just update it with your implementation.
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.
That doesn't work with the
target
attribute.