[PATCH] D71028: [Mips] Add support for min/max/umin/umax atomics

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 10:50:04 PST 2019


mbrkusanin added a comment.

There is a trick we can do to avoid taking an additional register. We can reuse either **OldVal** or **Incr** for intermediate results. I know that return value needs to be same as **OldVal** but I don't know if changing **Incr** is allowed.

If we reuse **Incr** it would look something like this for max:

  slt BinOpRes, OldVal, Incr
  movz Incr, OldVal ,BinOpRes, Incr #overwrite Incr with OldVal if it is higher value
  move BinOpRes, Incr

or for R6 <https://reviews.llvm.org/source/compiler-rt/>

  slt BinOpRes, OldVal Incr
  selnez Incr, Incr, BinOpRes
  seleqz BinOpRes, OldVal, BinOpRes
  or BinOpRes, BinOpRes, Incr


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71028/new/

https://reviews.llvm.org/D71028





More information about the llvm-commits mailing list