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

Open
josharian opened this issue Feb 23, 2020 · 1 comment
Open

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Feb 23, 2020

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.