-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[WebAssembly,llvm] Add llvm.wasm.ref.test.func intrinsic #147486
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
22 commits
Select commit
Hold shift + click to select a range
5eb65fd
[WebAssembly,llvm] Add llvm.wasm.ref.test.func intrinsic, option 2
hoodmane ce05ea5
Use bit width to decide whether to emit CImm or Imm
hoodmane f049ff6
Try moving to WebAssemblyISelDAGToDAG
hoodmane a6582c5
Revert some unneeded changes
hoodmane 1335a04
Tidy up
hoodmane aff1350
Fix and cleanup
hoodmane ec77465
Separate test cases into their own functions
hoodmane e32bb0b
Cleanup
hoodmane 6562073
try using an Imm if getSignificantBits() < 64
hoodmane c4e921a
Fix handling of void functions
hoodmane 2df9ffc
Apply suggestions from code review
hoodmane 802cae7
Convert diagnostic back to unreachable
hoodmane 1fa1772
Add comment that words are 64 bits
hoodmane e8a0ee1
More idiomatic assertions
hoodmane d8af945
Generate assertions with utils/update_llc_test_checks.py
hoodmane e8845c9
Fix
hoodmane 2dacd98
Fix swapped params and returns
hoodmane 6ad6d2c
Support multiple return values
hoodmane a9d9420
llvm style for loop bound
hoodmane 781d7ae
Add comment explaining operand magic number
hoodmane 57c7be8
Test against wasm64 too
hoodmane 0330a8b
clang-format
hoodmane 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
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,120 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -mcpu=mvp -mattr=+reference-types | FileCheck --check-prefixes CHECK,CHK32 %s | ||
; RUN: llc < %s --mtriple=wasm64-unknown-unknown -mcpu=mvp -mattr=+reference-types | FileCheck --check-prefixes CHECK,CHK64 %s | ||
|
||
define void @test_fpsig_void_void(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_void_void: | ||
; CHK32: .functype test_fpsig_void_void (i32) -> () | ||
; CHK64: .functype test_fpsig_void_void (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test () -> () | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
define void @test_fpsig_return_i32(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_return_i32: | ||
; CHK32: .functype test_fpsig_return_i32 (i32) -> () | ||
; CHK64: .functype test_fpsig_return_i32 (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test () -> (i32) | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
define void @test_fpsig_return_i64(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_return_i64: | ||
; CHK32: .functype test_fpsig_return_i64 (i32) -> () | ||
; CHK64: .functype test_fpsig_return_i64 (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test () -> (i64) | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i64 0) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
define void @test_fpsig_return_f32(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_return_f32: | ||
; CHK32: .functype test_fpsig_return_f32 (i32) -> () | ||
; CHK64: .functype test_fpsig_return_f32 (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test () -> (f32) | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, float 0.) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
define void @test_fpsig_return_f64(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_return_f64: | ||
; CHK32: .functype test_fpsig_return_f64 (i32) -> () | ||
; CHK64: .functype test_fpsig_return_f64 (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test () -> (f64) | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, double 0.) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
|
||
define void @test_fpsig_param_i32(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_param_i32: | ||
; CHK32: .functype test_fpsig_param_i32 (i32) -> () | ||
; CHK64: .functype test_fpsig_param_i32 (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test (f64) -> () | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, token poison, double 0.) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
|
||
define void @test_fpsig_multiple_params_and_returns(ptr noundef %func) local_unnamed_addr #0 { | ||
; CHECK-LABEL: test_fpsig_multiple_params_and_returns: | ||
; CHK32: .functype test_fpsig_multiple_params_and_returns (i32) -> () | ||
; CHK64: .functype test_fpsig_multiple_params_and_returns (i64) -> () | ||
; CHECK-NEXT: # %bb.0: # %entry | ||
; CHECK-NEXT: local.get 0 | ||
; CHECK-NEXT: table.get __indirect_function_table | ||
; CHECK-NEXT: ref.test (i64, f32, i64) -> (i32, i64, f32, f64) | ||
; CHECK-NEXT: call use | ||
; CHECK-NEXT: # fallthrough-return | ||
entry: | ||
%res = tail call i32 (ptr, ...) @llvm.wasm.ref.test.func(ptr %func, i32 0, i64 0, float 0., double 0., token poison, i64 0, float 0., i64 0) | ||
tail call void @use(i32 noundef %res) #3 | ||
ret void | ||
} | ||
|
||
|
||
declare void @use(i32 noundef) local_unnamed_addr #1 |
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.
Uh oh!
There was an error while loading. Please reload this page.