lima/gpir: add better lowering for ftrunc
authorVasily Khoruzhick <anarsoul@gmail.com>
Tue, 10 Mar 2020 08:30:14 +0000 (01:30 -0700)
committerVasily Khoruzhick <anarsoul@gmail.com>
Mon, 16 Mar 2020 23:28:33 +0000 (16:28 -0700)
commit2756b629171f61ca8e162be7b332e91a62c5c978
tree052810b07014c013f15891064401bc0925f3ffe5
parentb7d89476f1e7d0f3b9e751887f42b750a5ec216e
lima/gpir: add better lowering for ftrunc

GP doesn't support ftrunc natively and unfortunately one in generic
opt_algebraic is not GP-friendly either. Introduce our own lowering
that utilizes fsign() that GP supports:
ftrunc(a) = fmul(fsign(a), ffloor(fmax(a, -a)))

Tested-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4126>
.gitlab-ci/deqp-lima-fails.txt
src/gallium/drivers/lima/ir/lima_ir.h
src/gallium/drivers/lima/ir/lima_nir_algebraic.py
src/gallium/drivers/lima/lima_program.c