pan/bi: Factor out enum bifrost_minmax_mode

We'll want it from the compiler-side.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>
This commit is contained in:
Alyssa Rosenzweig 2020-03-02 20:51:03 -05:00 committed by Marge Bot
parent 34165c7ec0
commit bbf41ffb00
2 changed files with 11 additions and 4 deletions

View file

@ -96,6 +96,13 @@ enum bifrost_roundmode {
BIFROST_RTZ = 0x3
};
enum bifrost_minmax_mode {
BIFROST_MINMAX_NONE = 0x0,
BIFROST_NAN_WINS = 0x1,
BIFROST_SRC1_WINS = 0x2,
BIFROST_SRC0_WINS = 0x3,
};
struct bifrost_fma_add {
unsigned src0 : 3;
unsigned src1 : 3;

View file

@ -439,20 +439,20 @@ static void dump_output_mod(FILE *fp, unsigned mod)
static void dump_minmax_mode(FILE *fp, unsigned mod)
{
switch (mod) {
case 0:
case BIFROST_MINMAX_NONE:
/* Same as fmax() and fmin() -- return the other number if any
* number is NaN. Also always return +0 if one argument is +0 and
* the other is -0.
*/
break;
case 1:
case BIFROST_NAN_WINS:
/* Instead of never returning a NaN, always return one. The
* "greater"/"lesser" NaN is always returned, first by checking the
* sign and then the mantissa bits.
*/
fprintf(fp, ".nan_wins");
break;
case 2:
case BIFROST_SRC1_WINS:
/* For max, implement src0 > src1 ? src0 : src1
* For min, implement src0 < src1 ? src0 : src1
*
@ -463,7 +463,7 @@ static void dump_minmax_mode(FILE *fp, unsigned mod)
*/
fprintf(fp, ".src1_wins");
break;
case 3:
case BIFROST_SRC0_WINS:
/* For max, implement src0 < src1 ? src1 : src0
* For min, implement src0 > src1 ? src1 : src0
*/