}
if (reg->Register.Absolute) {
- res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res);
+ switch (stype) {
+ case TGSI_TYPE_FLOAT:
+ case TGSI_TYPE_DOUBLE:
+ case TGSI_TYPE_UNTYPED:
+ /* modifiers on movs assume data is float */
+ res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res);
+ break;
+ case TGSI_TYPE_UNSIGNED:
+ case TGSI_TYPE_SIGNED:
+ case TGSI_TYPE_VOID:
+ default:
+ /* abs modifier is only legal on floating point types */
+ assert(0);
+ break;
+ }
}
if (reg->Register.Negate) {
- res = lp_build_negate( &bld_base->base, res );
+ switch (stype) {
+ case TGSI_TYPE_FLOAT:
+ case TGSI_TYPE_UNTYPED:
+ /* modifiers on movs assume data is float */
+ res = lp_build_negate( &bld_base->base, res );
+ break;
+ case TGSI_TYPE_DOUBLE:
+ /* no double build context */
+ assert(0);
+ break;
+ case TGSI_TYPE_SIGNED:
+ res = lp_build_negate( &bld_base->int_bld, res );
+ break;
+ case TGSI_TYPE_UNSIGNED:
+ case TGSI_TYPE_VOID:
+ default:
+ assert(0);
+ break;
+ }
}
/*
break;
case TGSI_OPCODE_UADD:
- exec_vector_binary(mach, inst, micro_uadd, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
+ exec_vector_binary(mach, inst, micro_uadd, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
break;
case TGSI_OPCODE_UDIV:
case TGSI_OPCODE_AND:
case TGSI_OPCODE_OR:
case TGSI_OPCODE_XOR:
+ /* XXX some src args may be signed for SAD ? */
case TGSI_OPCODE_SAD:
case TGSI_OPCODE_U2F:
- case TGSI_OPCODE_UADD:
case TGSI_OPCODE_UDIV:
case TGSI_OPCODE_UMOD:
case TGSI_OPCODE_UMAD:
case TGSI_OPCODE_IABS:
case TGSI_OPCODE_ISSG:
case TGSI_OPCODE_UARL:
+ /* UADD is both signed and unsigned require signed for working modifiers */
+ case TGSI_OPCODE_UADD:
return TGSI_TYPE_SIGNED;
default:
return TGSI_TYPE_FLOAT;
case TGSI_OPCODE_OR:
case TGSI_OPCODE_XOR:
case TGSI_OPCODE_SAD:
- case TGSI_OPCODE_UADD:
case TGSI_OPCODE_UDIV:
case TGSI_OPCODE_UMOD:
case TGSI_OPCODE_UMAD:
case TGSI_OPCODE_ARR:
case TGSI_OPCODE_IABS:
case TGSI_OPCODE_ISSG:
+ case TGSI_OPCODE_UADD:
return TGSI_TYPE_SIGNED;
default:
return TGSI_TYPE_FLOAT;
each of the components of *dst*. When this happens, the result is said to be
*replicated* to *dst*. :opcode:`RCP` is one such instruction.
+Modifiers
+^^^^^^^^^^^^^^^
+
+TGSI supports modifiers on inputs (as well as saturate modifier on instructions).
+
+For inputs which have a floating point type, both absolute value and negation
+modifiers are supported (with absolute value being applied first).
+TGSI_OPCODE_MOV is considered to have float input type for applying modifiers.
+
+For inputs which have signed type only the negate modifier is supported. This
+includes instructions which are otherwise ignorant if the type is signed or
+unsigned, such as TGSI_OPCODE_UADD.
+
+For inputs with unsigned type no modifiers are allowed.
+
Instruction Set
---------------