gallivm: (trivial) fix typo in argument declaration of lp_build_size_query_soa
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_tgsi.c
index 53c81bd1fc2b51289de20e2dc906f6137c97783e..495940caf804b48c91db2efe0d987d3b92a7ceea 100644 (file)
@@ -310,11 +310,43 @@ lp_build_emit_fetch(
    }
 
    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:
+      case TGSI_TYPE_UNSIGNED:
+         res = lp_build_negate( &bld_base->int_bld, res );
+         break;
+      case TGSI_TYPE_VOID:
+      default:
+         assert(0);
+         break;
+      }
    }
 
    /*
@@ -358,11 +390,8 @@ lp_build_emit_fetch_texoffset(
    if (chan_index == LP_CHAN_ALL) {
       swizzle = ~0;
    } else {
+      assert(chan_index < TGSI_SWIZZLE_W);
       swizzle = tgsi_util_get_src_register_swizzle(&reg.Register, chan_index);
-      if (swizzle > 2) {
-         assert(0 && "invalid swizzle in emit_fetch_texoffset()");
-         return bld_base->base.undef;
-      }
    }
 
    assert(off->Index <= bld_base->info->file_max[off->File]);