Skip to content

aarch64: sbc is not being used #164748

@pinskia

Description

@pinskia

Take:

unsigned f1(unsigned a, unsigned b, unsigned c)
{
  unsigned t = a < b;
  return c - t;
}

LLVM produces:

f1:
        cmp     w0, w1
        cset    w8, lo
        sub     w0, w2, w8
        ret

The cset/sub combo should be replaced with:

        sbc     w0, w2, wzr

Which is what GCC produces:

f1:
        cmp     w0, w1
        sbc     w0, w2, wzr
        ret

https://godbolt.org/z/5f83qTK79

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions