Skip to content

arm64: Investigate using adds and changing the subsequent compare suffix to match expected dotnet behaviour #121445

@jonathandavies-arm

Description

@jonathandavies-arm

If we have the following instructions

add w0, w0, w1
cmp w0, #0
cset w0, gt

we would like to use the adds instruction so that the flags are set during the adds and we don't need a separate cmp instruction.

The issue is that without changing the cset suffix we will get an incorrect results if the add results in an overflow. We would need to check that the result is positive and not zero.

See these 2 comments:
#121380 (comment)
#121380 (comment)

This should also be done for subs and negs.

Metadata

Metadata

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions