[llvm] [Mips] Fix missing sign extension in expansion of sub-word atomic max (PR #77072)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 18:30:46 PDT 2024


topperc wrote:

There's definitely an issue in this sequence

```
; MIPSEL-NEXT:    srav $2, $2, $10
; MIPSEL-NEXT:    srav $7, $7, $10
; MIPSEL-NEXT:    seh $2, $2
; MIPSEL-NEXT:    seh $7, $7
; MIPSEL-NEXT:    slt $5, $2, $7
; MIPSEL-NEXT:    move $3, $2
; MIPSEL-NEXT:    movn $3, $7, $5
```

The move and movn need to use the values in $2 and $7 before the srav and seh. The rest of the code expect the 16 bit value to be in the same place in the register as it was when it came out of the load.

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


More information about the llvm-commits mailing list