Feature Request P2
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: SwiftShader
Branch: master
commit 629bf9563432848496251755a3b634472e252c26
Author: Nicolas Capens <capn@google.com>
Date: Tue Jan 18 15:08:14 2022
Optimize Abs() using LLVM intrinsics
The `fabs` abstract LLVM intrinsic translates to an x86 `vandps`
instruction with a broadcasted scalar memory operand, on CPUs that
support EVEX encoding (AVX-512).
The x86::pabsd() intrinsic was removed because it is currently unused
and its use should be discouraged. The integer Abs() operation already
translates into a `vpabsd` instruction.
Bug: b/215191437
Change-Id: Ibc6016ec7d2eae0d6c1cd339b47169defa3fa1eb
Reviewed-on:https://swiftshader-review.googlesource.com/c/SwiftShader/+/61468
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
M src/Reactor/Reactor.cpp
M src/Reactor/x86.hpp
M src/Reactor/LLVMReactor.cpp
M src/Reactor/SubzeroReactor.cpp
M tests/ReactorUnitTests/ReactorUnitTests.cpp
https://swiftshader-review.googlesource.com/61468
Branch: master
commit 629bf9563432848496251755a3b634472e252c26
Author: Nicolas Capens <capn@google.com>
Date: Tue Jan 18 15:08:14 2022
Optimize Abs() using LLVM intrinsics
The `fabs` abstract LLVM intrinsic translates to an x86 `vandps`
instruction with a broadcasted scalar memory operand, on CPUs that
support EVEX encoding (AVX-512).
The x86::pabsd() intrinsic was removed because it is currently unused
and its use should be discouraged. The integer Abs() operation already
translates into a `vpabsd` instruction.
Bug:
Change-Id: Ibc6016ec7d2eae0d6c1cd339b47169defa3fa1eb
Reviewed-on:
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
M src/Reactor/Reactor.cpp
M src/Reactor/x86.hpp
M src/Reactor/LLVMReactor.cpp
M src/Reactor/SubzeroReactor.cpp
M tests/ReactorUnitTests/ReactorUnitTests.cpp
Description
LLVM 12 introduced intrinsics for integer absolute value (
abs
), signed/unsigned min/max (smin
/smax
/umin
/umax
), as well as floating-point min/max (fmin
/fmax
/minnum
/maxnum
).fabs
has been present before but we don't use it yet. Currently we use x86 instruction intrinsics or a fallback implementation for these operations. Using the target-independent intrinsics would provide LLVM with better optimization opportunities.