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

Quentin Dian via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 22:56:07 PDT 2024


DianQK wrote:

I have reduced to the following code:

```llvm
target datalayout = "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
target triple = "mipsel-unknown-linux-gnu"

define i32 @main() {
  %1 = call signext i8 @test()
  %2 = sext i8 %1 to i32
  ret i32 %2
}

define signext i8 @test() {
  %i = alloca i8, align 1
  store i8 23, ptr %i, align 1
  %i1 = atomicrmw max ptr %i, i8 42 seq_cst, align 1
  ret i8 %i1
}
```

@yingopq I hope this can be of some use.

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


More information about the llvm-commits mailing list