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

cmd/asm: riscv64 assembler claims that 4294967295 does not fit in 32 bits #37382

Closed
josharian opened this issue Feb 23, 2020 · 2 comments
Closed
Labels
arch-riscv Issues solely affecting the riscv64 architecture. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@josharian
Copy link
Contributor

After some compiler tweaks, I got this complaint out of the RISCV64 assembler:

# cmd/compile/internal/ssa
cmd/compile/internal/ssa/compile.go:429:45: 00038 (/Users/josh/go/tip/src/cmd/compile/internal/ssa/regalloc.go:2555)	MOV	$4294967295, X3: constant 4294967295 too large: immediate does not fit in 32-bits: 4294967295
cmd/compile/internal/ssa/compile.go:429:45: 00068 (/Users/josh/go/tip/src/cmd/compile/internal/ssa/regalloc.go:2636)	MOV	$4294967295, X3: constant 4294967295 too large: immediate does not fit in 32-bits: 4294967295

But 4294967295 does fit (barely!) in 32 bits. So either the error message is wrong, or the instruction should get encoded.

(My compiler changes aren't ready to share, but you should be able to reproduce just with assembly.)

cc @4a6f656c

@robpike
Copy link
Contributor

robpike commented Feb 23, 2020

Not only that, the message has bad grammar: s/32-bits/32 bits/
src/cmd/internal/obj/riscv/obj.go:884

The test seems to think you have a signed immediate, in which case the error is correct, if poorly worded.

@ALTree ALTree added NeedsFix The path to resolution is known, but the work has not been done. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Feb 24, 2020
@seankhliao seankhliao added the arch-riscv Issues solely affecting the riscv64 architecture. label Aug 27, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 27, 2022
@mengzhuo
Copy link
Contributor

This issue fixed by https://go-review.googlesource.com/c/go/+/345050, closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Issues solely affecting the riscv64 architecture. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants