[spirv][math] Fix sign propagation for math.powf conversion
authorDaniel Garvey <dan@nod-labs.com>
Wed, 10 May 2023 04:26:37 +0000 (21:26 -0700)
committerLei Zhang <antiagainst@google.com>
Wed, 10 May 2023 04:44:09 +0000 (21:44 -0700)
commit58839f2e2913c2b7c0bb11a2292b8e666835cdb2
tree31cb57255a2d74eba127912e9018780be69c13c6
parent309fdbb49bc3780f7248440cc8467c486ab1dcca
[spirv][math] Fix sign propagation for math.powf conversion

For `x^y`, the result's sign should consider whether `y` is
an integer and whether it's odd or even.

This still does not cover all corner cases regarding `x^y`
but it's an improvement over the current implementation.

Reviewed By: antiagainst, qedawkins

Differential Revision: https://reviews.llvm.org/D150234
mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp
mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir