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

Test for returning Option<u128> and similar types returned in three registers by LLVM #21

Closed
bjorn3 opened this issue Jan 11, 2024 · 3 comments · Fixed by #40
Closed
Labels
test-request Add a test to the suite for this

Comments

@bjorn3
Copy link
Contributor

bjorn3 commented Jan 11, 2024

LLVM will split this into three return registers, while Cranelift currently uses two return registers + implicit return value pointer: rust-lang/rustc_codegen_cranelift#1449

@Gankra
Copy link
Owner

Gankra commented Jun 30, 2024

Is it necessary to use the Real Option type or is this a classic "all things shaped like Option"?

If the latter, this can now be expressed as OptionU128.procgen.kdl:

tagged "OptionU128" {
  Some { _ "u128"; }
  None
}

(Literally just that, we procgen the functions from just a type definition now!)

Although that will implicitly get a #[repr(C)]. If you specifically want to test repr-rust:

@repr "rust"
tagged "OptionU128" {
  Some { _ "u128"; }
  None
}

If this is specific to the rust calling convention, we'll need to add that to CallingConventions and teach the rust backend how to support it (and the C backend to skip it).

@Gankra
Copy link
Owner

Gankra commented Jun 30, 2024

(Thinking out loud: strictly speaking we could actually say the repr of an non-@repr'd type matches the calling convention we're generating for, or that we will generate both repr variants... sigh more combinatorics and test keys and cli flags...)

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jun 30, 2024

Is it necessary to use the Real Option type or is this a classic "all things shaped like Option"?

Should be the latter.

@Gankra Gankra added the test-request Add a test to the suite for this label Jun 30, 2024
Gankra added a commit that referenced this issue Jul 1, 2024
Note that C still doesn't implement align, but as of #39 we combinatoric repr(rust) vs repr(c) and include rustcall as a calling convention, so our coverage of rust <-> rust (in particular for codegen_backend users) is significantly improved.

fixes #23
fixes #21
fixes #15
@Gankra Gankra closed this as completed in #40 Jul 1, 2024
@Gankra Gankra closed this as completed in dd37470 Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-request Add a test to the suite for this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants