[compiler-rt] [compiler-rt] Turn adcs with -1 into sbc with 0 (PR #204868)

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 03:32:26 PDT 2026


https://github.com/statham-arm commented:

Can you explain a bit more in the commit message, please?

I agree that those two instructions are equivalent. In Thumb2 they're distinct encodings, because 0xFFFFFFFF _is_ a valid immediate; in Arm, assemblers typically accept ADC of -1 and treat it as an alias for SBC of 0:
```
$ llvm-mc- -triple armv7a <<<'adcs r0, r0, #-1'
        .text
        sbcs    r0, r0, #0
```

So I'm confident this change is safe. And I presume the idea is to get this code through some assembler which doesn't recognise this equivalence. But can you say what assembler it is?

https://github.com/llvm/llvm-project/pull/204868


More information about the llvm-commits mailing list