[Mesa-dev] [PATCH 1/2] gallivm: allow negation of all integer types

Roland Scheidegger sroland at vmware.com
Thu May 2 09:44:11 PDT 2013


Am 02.05.2013 18:16, schrieb Zack Rusin:
> ----- Original Message -----
>>> I don't oppose either.  Integer signedness has always been too loose for us
>>> to be pedantic about it here.
>>>
>>
>> Ok. We should update tgsi docs to reflect that, however.
>> Note that we already moved some opcodes (ok only one, uadd) to the
>> signed section in infer_src_type() for exactly this reason but yes
>> that's a hack too, might as well move it back then for consistency.
> 
> How about the attached patch. 
LGTM. Maybe we should restrict modifiers to less instructions (e.g. only
allowed on "math" instructions, not logic ops) if someone has a problem
doing it, but this seems largely independent of signed/unsigned type.

> 
> To be honest, from just looking at the code, I think that adding instructions that explicitly work on signed integers would be cleaner (i.e. add IMAD and IADD).

Well in contrast to the IF/UIF they'd be really redundant unless I'm
missing something so just for supporting negation on inputs or not this
looks like not really worth it (and as said there are also other signed
instructions where supporting negation doesn't really make sense). OTOH
you're right it would be just 3 more instructions (imul/iadd/imad) I
believe so it wouldn't be too bad. But I'm fine with just supporting
negation on unsigned instructions, after all it's just two's complement
negation regardless if it's signed or not. And just document these umul
functions work for both signed and unsigned.

Roland


More information about the mesa-dev mailing list