Skip to content
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

Add simd_bswap, simd_bitreverse, simd_ctlz, and simd_cttz intrinsics #114156

Merged
merged 4 commits into from
Jul 29, 2023

Conversation

calebzulawski
Copy link
Member

@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 28, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member

Intrinsic has incorrect argument type!
<4 x i32> (<4 x i32>, i8)* @llvm.ctlz.v4i32
Intrinsic has incorrect argument type!
<4 x i32> (<4 x i32>, i8)* @llvm.ctlz.v4i32
Intrinsic has incorrect argument type!
<4 x i32> (<4 x i32>, i8)* @llvm.cttz.v4i32
Intrinsic has incorrect argument type!
<4 x i32> (<4 x i32>, i8)* @llvm.cttz.v4i32
LLVM ERROR: Broken module found, compilation aborted!

well
that won't do.

@calebzulawski
Copy link
Member Author

Is that LLVM 14 specific? I'm pretty sure the bump to 15 is imminent.

@calebzulawski
Copy link
Member Author

Ah, actually, the problem is that it's encoding the last argument as i8 instead of i1. Why does it work elsewhere?

@workingjubilee
Copy link
Member

Is that LLVM 14 specific? I'm pretty sure the bump to 15 is imminent.

I don't thiiink so?

@Urgau
Copy link
Member

Urgau commented Jul 28, 2023

Is that LLVM 14 specific? I'm pretty sure the bump to 15 is imminent.

I don't thiiink so?

#114148 8 hours ago ;-)

@workingjubilee
Copy link
Member

@Urgau I mean that I don't think the issue is LLVM 14 specific, I could be wrong.

@Urgau
Copy link
Member

Urgau commented Jul 28, 2023

@Urgau I mean that I don't think the issue is LLVM 14 specific, I could be wrong.

Oh, yeah sorry. As for the issue here, I would just note that type_bool() is indeed i8 not i1; to have i1 you should call type_i1().

@bjorn3
Copy link
Member

bjorn3 commented Jul 28, 2023

cg_clif and cg_gcc will need these intrinsics too.

@calebzulawski
Copy link
Member Author

Is that LLVM 14 specific? I'm pretty sure the bump to 15 is imminent.

I don't thiiink so?

It compiles on newer LLVM so at some point it became flexible enough to accept i8.

cg_clif and cg_gcc will need these intrinsics too.

@bjorn3 do you expect that to be part of this PR, or just making a note of it?

@bjorn3
Copy link
Member

bjorn3 commented Jul 28, 2023

Mostly making a note. I can implement it on the cg_clif side myself. I don't know what @antoyo prefers for cg_gcc.

@antoyo
Copy link
Contributor

antoyo commented Jul 28, 2023

I'm also taking note for cg_gcc and I'll implement it myself.

@calebzulawski
Copy link
Member Author

@Urgau I mean that I don't think the issue is LLVM 14 specific, I could be wrong.

Oh, yeah sorry. As for the issue here, I would just note that type_bool() is indeed i8 not i1; to have i1 you should call type_i1().

It looks like this worked!

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 29, 2023

📌 Commit ce4a48f has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2023
@RalfJung
Copy link
Member

Any chance someone could make a PR to also implement these in Miri? :) Let me know if you need any pointers for getting started. The existing SIMD intrinsics are probably a good template.

@bors
Copy link
Contributor

bors commented Jul 29, 2023

⌛ Testing commit ce4a48f with merge 03a5725...

@bors
Copy link
Contributor

bors commented Jul 29, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 03a5725 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 29, 2023
@bors bors merged commit 03a5725 into rust-lang:master Jul 29, 2023
11 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Jul 29, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (03a5725): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.6% [0.8%, 5.6%] 16
Regressions ❌
(secondary)
4.7% [1.4%, 9.0%] 5
Improvements ✅
(primary)
-1.8% [-1.8%, -1.8%] 1
Improvements ✅
(secondary)
-2.6% [-3.5%, -2.0%] 4
All ❌✅ (primary) 1.4% [-1.8%, 5.6%] 17

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 652.746s -> 651.287s (-0.22%)

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jul 31, 2023
…er-errors

Fix simd_bswap for i8/u8

rust-lang#114156 missed this test case ☹️
cc `@workingjubilee`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 31, 2023
…-errors

Fix simd_bswap for i8/u8

rust-lang#114156 missed this test case ☹️
cc `@workingjubilee`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.