[X86] Lower abdu(lhs, rhs) -> or(usubsat(lhs,rhs), usubsat(rhs,lhs))
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 2 May 2023 17:37:28 +0000 (18:37 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 2 May 2023 18:54:04 +0000 (19:54 +0100)
commitedce93c9d8ddcd65740d22851db9209ff5ec066e
tree592767723300eaaed12678626d662c4051c57ec2
parent419bc85675fe73f2d19cd3f756cf029248fb4295
[X86] Lower abdu(lhs, rhs) -> or(usubsat(lhs,rhs), usubsat(rhs,lhs))

Adds pre-SSE4 v8i16 abdu handling - we already have something similar for umax(x,y) -> add(x,usubsat(y,x)) / umin(x,y) -> sub(x,usubsat(x,y))

(I'm starting to look at adding generic TargetLowering expandABD() handling and came across this missed opportunity).

Inspiration: http://0x80.pl/notesen/2018-03-11-sse-abs-unsigned.html

Alive2: https://alive2.llvm.org/ce/z/gMhaTa
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/abdu-vector-128.ll
llvm/test/CodeGen/X86/midpoint-int-vec-128.ll