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

[RISC-V] Clean up code gen for floating comparisons #111626

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tomeksowi
Copy link
Contributor

@tomeksowi tomeksowi commented Jan 20, 2025

There are ways to generate better code for equals-or-unordered and not-equals-and-ordered. However, there are no IL opcodes for them (ceq.un, beq.un, bne) so these code gens can't happen.

As a bonus, flip the comparison result with one instruction.

Part of #84834, cc @dotnet/samsung

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 20, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 20, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@risc-vv
Copy link

risc-vv commented Jan 20, 2025

41d470bf is being scheduled for building and testing

GIT: 41d470bf4390b89f83968adb94cd90371be05ecb
REPO: dotnet/runtime
BRANCH: main

Release-build FAILED

buildinfo.json

Compilation failed during core build```

</details>

@risc-vv
Copy link

risc-vv commented Jan 20, 2025

a711137 is being scheduled for building and testing

GIT: a711137381bf85fbcd063a60990604c2f9ffd2e4
REPO: dotnet/runtime
BRANCH: main

Release-build FAILED

buildinfo.json

Compilation failed during core build```

</details>

@tomeksowi
Copy link
Contributor Author

@dotnet/jit-contrib PTAL

@tannergooding
Copy link
Member

There are ways to generate better code for equals-or-unordered and not-equals-and-ordered. However, there are no IL opcodes for them (ceq.un, beq.un, bne) so these code gens can't happen.

IL opcodes aren't required to generate such code. You can recognize patterns such as x == cns or various helpers like T.IsNaN, T.IsFinite, etc.

@risc-vv
Copy link

risc-vv commented Jan 31, 2025

f67b60a is being scheduled for building and testing

GIT: f67b60a9332dff5310247852c613d9661dcbe8d7
REPO: dotnet/runtime
BRANCH: main

Release-build FAILED

buildinfo.json

Cloning into '/godata/pipelines/Release-build/runtime'...
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 4702 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

@tomeksowi
Copy link
Contributor Author

IL opcodes aren't required to generate such code. You can recognize patterns such as x == cns or various helpers like T.IsNaN, T.IsFinite, etc.

True, we can add them when these patterns are recognized and these code gens can be tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Related to the RISC-V architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants