r300: exit early in presubtract is not supported
authorPavel Ondračka <pavel.ondracka@gmail.com>
Wed, 9 Aug 2023 06:32:01 +0000 (08:32 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 25 Aug 2023 14:48:14 +0000 (14:48 +0000)
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24830>

src/gallium/drivers/r300/compiler/radeon_optimize.c

index d6a911d..9ecb9ec 100644 (file)
@@ -809,15 +809,18 @@ static int peephole_mul_omod(
  */
 static int peephole(struct radeon_compiler * c, struct rc_instruction * inst)
 {
-       switch(inst->U.I.Opcode){
+       if (!c->has_presub)
+               return 0;
+
+       switch(inst->U.I.Opcode) {
        case RC_OPCODE_ADD:
-               if (c->has_presub) {
-                       if(peephole_add_presub_inv(c, inst))
-                               return 1;
-                       if(peephole_add_presub_add(c, inst))
-                               return 1;
-               }
+       {
+               if (peephole_add_presub_inv(c, inst))
+                       return 1;
+               if (peephole_add_presub_add(c, inst))
+                       return 1;
                break;
+       }
        default:
                break;
        }