nir: fix constant-folding of 64-bit fpow
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Sun, 30 Apr 2023 10:15:31 +0000 (12:15 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 2 May 2023 07:53:51 +0000 (07:53 +0000)
We need to do full pow if 64-bit, and we can do fpow() otherwise. Not
the other way around.

Fixes: 9076c4e289d ("nir: update opcode definitions for different bit sizes")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22774>

src/compiler/nir/nir_opcodes.py

index bc26380..c3c4ea2 100644 (file)
@@ -907,7 +907,7 @@ binop("fmax", tfloat, _2src_commutative + associative, "fmax(src0, src1)")
 binop("imax", tint, _2src_commutative + associative, "src1 > src0 ? src1 : src0")
 binop("umax", tuint, _2src_commutative + associative, "src1 > src0 ? src1 : src0")
 
-binop("fpow", tfloat, "", "bit_size == 64 ? powf(src0, src1) : pow(src0, src1)")
+binop("fpow", tfloat, "", "bit_size == 64 ? pow(src0, src1) : powf(src0, src1)")
 
 binop_horiz("pack_half_2x16_split", 1, tuint32, 1, tfloat32, 1, tfloat32,
             "pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16)")