Re: [Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
> I haven't been following the 'double' work so dumb questions/comments: > > First, could you document the new opcodes in gallium/docs/source/tgsi.rst? Yup already done in my tree. > > In the case of micro_u64seq(), etc. why doesn't it do > > dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; > > Don't we want a 64-bit boolean result? I can imagine wanting to use the > result of a U64SEQ instruction in some subsequent bit-wise masking > instructions with 64-bit operands. A 32-bit result wouldn't work for that. No we've defined the *SEQ family to always return a boolean which is the 32bit integer. You can still use USEQ on these values without 64-bitness as they are stored internally as 2 x 32s to get a mask that would work. > > Finally, it seems this patch and 22/23 could be merged. This patch adds a > bunch of micro_*() functions that the compiler will warn as unused until > patch 22 is applied. Maybe the tgsi_exec.[ch] changes could be one patch > and the other tgsi changes in another. Not a big deal though. Oh I messed up my commits here, the tgsi_exec.c stuff should be in the later softpipe enable patch not here. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
On Thu, Jun 9, 2016 at 2:41 PM, Marek Olšákwrote: > On Thu, Jun 9, 2016 at 4:43 PM, Brian Paul wrote: >> On 06/08/2016 06:48 PM, Dave Airlie wrote: >>> >>> From: Dave Airlie >>> >>> This adds support to TGSI for 64-bit integer immediates. >>> >>> Signed-off-by: Dave Airlie >>> --- >>> src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ >>> src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 >>> - >>> src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 + >>> src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++ >>> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +- >>> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ >>> src/gallium/include/pipe/p_shader_tokens.h | 2 + >>> 7 files changed, 358 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> b/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> index d59b7ff..614bcb2 100644 >>> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c >>> @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, >>>i++; >>>break; >>> } >>> + case TGSI_IMM_INT64: { >>> + union di d; >>> + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >>> + UID( d.i ); >>> + i++; >>> + break; >>> + } >>> + case TGSI_IMM_UINT64: { >>> + union di d; >>> + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >>> + UID( d.ui ); >>> + i++; >>> + break; >>> + } >>> case TGSI_IMM_FLOAT32: >>>if (ctx->dump_float_as_hex) >>> HFLT( data[i].Float ); >>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> b/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> index 1457c06..c929475 100644 >>> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c >>> @@ -77,6 +77,8 @@ >>> union tgsi_double_channel { >>> double d[TGSI_QUAD_SIZE]; >>> unsigned u[TGSI_QUAD_SIZE][2]; >>> + uint64_t u64[TGSI_QUAD_SIZE]; >>> + int64_t i64[TGSI_QUAD_SIZE]; >>> }; >>> >>> struct tgsi_double_vector { >>> @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, >>> dst->d[3] = (double)src->u[3]; >>> } >>> >>> +static void >>> +micro_i64abs(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; >>> + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; >>> + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; >>> + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; >>> +} >>> + >>> +static void >>> +micro_i64sgn(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; >>> + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; >>> + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; >>> + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; >>> +} >>> + >>> +static void >>> +micro_i64neg(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->i64[0] = -src->i64[0]; >>> + dst->i64[1] = -src->i64[1]; >>> + dst->i64[2] = -src->i64[2]; >>> + dst->i64[3] = -src->i64[3]; >>> +} >>> + >>> +static void >>> +micro_u64seq(union tgsi_double_channel *dst, >>> + const union tgsi_double_channel *src) >>> +{ >>> + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; >>> + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; >>> + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; >>> + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; >>> +} >> >> >> I haven't been following the 'double' work so dumb questions/comments: >> >> First, could you document the new opcodes in gallium/docs/source/tgsi.rst? >> >> In the case of micro_u64seq(), etc. why doesn't it do >> >> dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; > > Did you mean ULL? UL is 32 bits on a 32-bit arch. I think that all the comparisons have to return a boolean, which in TGSI is a 32-bit 0/~0. Otherwise I suspect there's going to be a ton of bugs from doing like "int(64bitint == 5)". -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
On Thu, Jun 9, 2016 at 4:43 PM, Brian Paulwrote: > On 06/08/2016 06:48 PM, Dave Airlie wrote: >> >> From: Dave Airlie >> >> This adds support to TGSI for 64-bit integer immediates. >> >> Signed-off-by: Dave Airlie >> --- >> src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ >> src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 >> - >> src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 + >> src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++ >> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +- >> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ >> src/gallium/include/pipe/p_shader_tokens.h | 2 + >> 7 files changed, 358 insertions(+), 3 deletions(-) >> >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c >> b/src/gallium/auxiliary/tgsi/tgsi_dump.c >> index d59b7ff..614bcb2 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c >> @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, >>i++; >>break; >> } >> + case TGSI_IMM_INT64: { >> + union di d; >> + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >> + UID( d.i ); >> + i++; >> + break; >> + } >> + case TGSI_IMM_UINT64: { >> + union di d; >> + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >> + UID( d.ui ); >> + i++; >> + break; >> + } >> case TGSI_IMM_FLOAT32: >>if (ctx->dump_float_as_hex) >> HFLT( data[i].Float ); >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c >> b/src/gallium/auxiliary/tgsi/tgsi_exec.c >> index 1457c06..c929475 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c >> @@ -77,6 +77,8 @@ >> union tgsi_double_channel { >> double d[TGSI_QUAD_SIZE]; >> unsigned u[TGSI_QUAD_SIZE][2]; >> + uint64_t u64[TGSI_QUAD_SIZE]; >> + int64_t i64[TGSI_QUAD_SIZE]; >> }; >> >> struct tgsi_double_vector { >> @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, >> dst->d[3] = (double)src->u[3]; >> } >> >> +static void >> +micro_i64abs(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; >> + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; >> + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; >> + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; >> +} >> + >> +static void >> +micro_i64sgn(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; >> + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; >> + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; >> + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; >> +} >> + >> +static void >> +micro_i64neg(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = -src->i64[0]; >> + dst->i64[1] = -src->i64[1]; >> + dst->i64[2] = -src->i64[2]; >> + dst->i64[3] = -src->i64[3]; >> +} >> + >> +static void >> +micro_u64seq(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; >> + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; >> + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; >> + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; >> +} > > > I haven't been following the 'double' work so dumb questions/comments: > > First, could you document the new opcodes in gallium/docs/source/tgsi.rst? > > In the case of micro_u64seq(), etc. why doesn't it do > > dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; Did you mean ULL? UL is 32 bits on a 32-bit arch. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
Am 09.06.2016 um 16:43 schrieb Brian Paul: > On 06/08/2016 06:48 PM, Dave Airlie wrote: >> From: Dave Airlie>> >> This adds support to TGSI for 64-bit integer immediates. >> >> Signed-off-by: Dave Airlie >> --- >> src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ >> src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 >> - >> src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 + >> src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++ >> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +- >> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ >> src/gallium/include/pipe/p_shader_tokens.h | 2 + >> 7 files changed, 358 insertions(+), 3 deletions(-) >> >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c >> b/src/gallium/auxiliary/tgsi/tgsi_dump.c >> index d59b7ff..614bcb2 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c >> @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, >>i++; >>break; >> } >> + case TGSI_IMM_INT64: { >> + union di d; >> + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >> + UID( d.i ); >> + i++; >> + break; >> + } >> + case TGSI_IMM_UINT64: { >> + union di d; >> + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; >> + UID( d.ui ); >> + i++; >> + break; >> + } >> case TGSI_IMM_FLOAT32: >>if (ctx->dump_float_as_hex) >> HFLT( data[i].Float ); >> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c >> b/src/gallium/auxiliary/tgsi/tgsi_exec.c >> index 1457c06..c929475 100644 >> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c >> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c >> @@ -77,6 +77,8 @@ >> union tgsi_double_channel { >> double d[TGSI_QUAD_SIZE]; >> unsigned u[TGSI_QUAD_SIZE][2]; >> + uint64_t u64[TGSI_QUAD_SIZE]; >> + int64_t i64[TGSI_QUAD_SIZE]; >> }; >> >> struct tgsi_double_vector { >> @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, >> dst->d[3] = (double)src->u[3]; >> } >> >> +static void >> +micro_i64abs(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; >> + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; >> + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; >> + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; >> +} >> + >> +static void >> +micro_i64sgn(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; >> + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; >> + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; >> + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; >> +} >> + >> +static void >> +micro_i64neg(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->i64[0] = -src->i64[0]; >> + dst->i64[1] = -src->i64[1]; >> + dst->i64[2] = -src->i64[2]; >> + dst->i64[3] = -src->i64[3]; >> +} >> + >> +static void >> +micro_u64seq(union tgsi_double_channel *dst, >> + const union tgsi_double_channel *src) >> +{ >> + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; >> + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; >> + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; >> + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; >> +} > > I haven't been following the 'double' work so dumb questions/comments: > > First, could you document the new opcodes in gallium/docs/source/tgsi.rst? > > In the case of micro_u64seq(), etc. why doesn't it do > > dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; > > Don't we want a 64-bit boolean result? I can imagine wanting to use the > result of a U64SEQ instruction in some subsequent bit-wise masking > instructions with 64-bit operands. A 32-bit result wouldn't work for that. I'm no expert on this neither, but this works all the same as doubles. Booleans are a bit annoying, but ultimately with an untyped register file we can't really have different booleans for doubles/int64 instructions. It is all pretty annoying (even more so for gallivm) but it seems unavoidable. Note that it might appear here that results and sources really are 64bit values, but ultimately the fetch and store functions will distribute the 4 64bit values to 2 regs containing 4 32bit values each. Roland > > Finally, it seems this patch and 22/23 could be merged. This patch adds > a bunch of micro_*() functions that the compiler will warn as unused > until patch 22 is applied. Maybe the tgsi_exec.[ch] changes could be > one patch and the other tgsi changes in another. Not a
Re: [Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
On 06/08/2016 06:48 PM, Dave Airlie wrote: From: Dave AirlieThis adds support to TGSI for 64-bit integer immediates. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 - src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 + src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++ src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ src/gallium/include/pipe/p_shader_tokens.h | 2 + 7 files changed, 358 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index d59b7ff..614bcb2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, i++; break; } + case TGSI_IMM_INT64: { + union di d; + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; + UID( d.i ); + i++; + break; + } + case TGSI_IMM_UINT64: { + union di d; + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; + UID( d.ui ); + i++; + break; + } case TGSI_IMM_FLOAT32: if (ctx->dump_float_as_hex) HFLT( data[i].Float ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1457c06..c929475 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -77,6 +77,8 @@ union tgsi_double_channel { double d[TGSI_QUAD_SIZE]; unsigned u[TGSI_QUAD_SIZE][2]; + uint64_t u64[TGSI_QUAD_SIZE]; + int64_t i64[TGSI_QUAD_SIZE]; }; struct tgsi_double_vector { @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, dst->d[3] = (double)src->u[3]; } +static void +micro_i64abs(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; +} + +static void +micro_i64sgn(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; +} + +static void +micro_i64neg(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = -src->i64[0]; + dst->i64[1] = -src->i64[1]; + dst->i64[2] = -src->i64[2]; + dst->i64[3] = -src->i64[3]; +} + +static void +micro_u64seq(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; +} I haven't been following the 'double' work so dumb questions/comments: First, could you document the new opcodes in gallium/docs/source/tgsi.rst? In the case of micro_u64seq(), etc. why doesn't it do dst->u64[0] = src[0].u64[0] == src[1].u64[0] ? ~0UL : 0U; Don't we want a 64-bit boolean result? I can imagine wanting to use the result of a U64SEQ instruction in some subsequent bit-wise masking instructions with 64-bit operands. A 32-bit result wouldn't work for that. Finally, it seems this patch and 22/23 could be merged. This patch adds a bunch of micro_*() functions that the compiler will warn as unused until patch 22 is applied. Maybe the tgsi_exec.[ch] changes could be one patch and the other tgsi changes in another. Not a big deal though. -Brian + +static void +micro_u64sne(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] != src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] != src[1].u64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].u64[2] != src[1].u64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].u64[3] != src[1].u64[3] ? ~0U : 0U; +} + +static void +micro_i64slt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].i64[0] < src[1].i64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].i64[1] < src[1].i64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].i64[2] < src[1].i64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].i64[3] < src[1].i64[3] ? ~0U : 0U; +} + +static void +micro_u64slt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src)
[Mesa-dev] [PATCH 19/23] gallium/tgsi: add support for 64-bit integer immediates.
From: Dave AirlieThis adds support to TGSI for 64-bit integer immediates. Signed-off-by: Dave Airlie --- src/gallium/auxiliary/tgsi/tgsi_dump.c | 14 ++ src/gallium/auxiliary/tgsi/tgsi_exec.c | 244 - src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 + src/gallium/auxiliary/tgsi/tgsi_text.c | 44 ++ src/gallium/auxiliary/tgsi/tgsi_ureg.c | 45 +- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 ++ src/gallium/include/pipe/p_shader_tokens.h | 2 + 7 files changed, 358 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index d59b7ff..614bcb2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -254,6 +254,20 @@ dump_imm_data(struct tgsi_iterate_context *iter, i++; break; } + case TGSI_IMM_INT64: { + union di d; + d.i = data[i].Uint | (uint64_t)data[i+1].Uint << 32; + UID( d.i ); + i++; + break; + } + case TGSI_IMM_UINT64: { + union di d; + d.ui = data[i].Uint | (uint64_t)data[i+1].Uint << 32; + UID( d.ui ); + i++; + break; + } case TGSI_IMM_FLOAT32: if (ctx->dump_float_as_hex) HFLT( data[i].Float ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1457c06..c929475 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -77,6 +77,8 @@ union tgsi_double_channel { double d[TGSI_QUAD_SIZE]; unsigned u[TGSI_QUAD_SIZE][2]; + uint64_t u64[TGSI_QUAD_SIZE]; + int64_t i64[TGSI_QUAD_SIZE]; }; struct tgsi_double_vector { @@ -692,11 +694,251 @@ micro_u2d(union tgsi_double_channel *dst, dst->d[3] = (double)src->u[3]; } +static void +micro_i64abs(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = src->i64[0] >= 0.0 ? src->i64[0] : -src->i64[0]; + dst->i64[1] = src->i64[1] >= 0.0 ? src->i64[1] : -src->i64[1]; + dst->i64[2] = src->i64[2] >= 0.0 ? src->i64[2] : -src->i64[2]; + dst->i64[3] = src->i64[3] >= 0.0 ? src->i64[3] : -src->i64[3]; +} + +static void +micro_i64sgn(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = src->i64[0] < 0 ? -1 : src->i64[0] > 0 ? 1 : 0; + dst->i64[1] = src->i64[1] < 0 ? -1 : src->i64[1] > 0 ? 1 : 0; + dst->i64[2] = src->i64[2] < 0 ? -1 : src->i64[2] > 0 ? 1 : 0; + dst->i64[3] = src->i64[3] < 0 ? -1 : src->i64[3] > 0 ? 1 : 0; +} + +static void +micro_i64neg(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->i64[0] = -src->i64[0]; + dst->i64[1] = -src->i64[1]; + dst->i64[2] = -src->i64[2]; + dst->i64[3] = -src->i64[3]; +} + +static void +micro_u64seq(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] == src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] == src[1].u64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].u64[2] == src[1].u64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].u64[3] == src[1].u64[3] ? ~0U : 0U; +} + +static void +micro_u64sne(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] != src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] != src[1].u64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].u64[2] != src[1].u64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].u64[3] != src[1].u64[3] ? ~0U : 0U; +} + +static void +micro_i64slt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].i64[0] < src[1].i64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].i64[1] < src[1].i64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].i64[2] < src[1].i64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].i64[3] < src[1].i64[3] ? ~0U : 0U; +} + +static void +micro_u64slt(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] < src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] < src[1].u64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].u64[2] < src[1].u64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].u64[3] < src[1].u64[3] ? ~0U : 0U; +} + +static void +micro_i64sge(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].i64[0] >= src[1].i64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].i64[1] >= src[1].i64[1] ? ~0U : 0U; + dst->u[2][0] = src[0].i64[2] >= src[1].i64[2] ? ~0U : 0U; + dst->u[3][0] = src[0].i64[3] >= src[1].i64[3] ? ~0U : 0U; +} + +static void +micro_u64sge(union tgsi_double_channel *dst, + const union tgsi_double_channel *src) +{ + dst->u[0][0] = src[0].u64[0] >= src[1].u64[0] ? ~0U : 0U; + dst->u[1][0] = src[0].u64[1] >= src[1].u64[1] ?