{"id":2231417,"url":"http://patchwork.ozlabs.org/api/patches/2231417/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-4-pbonzini@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430172204.1006673-4-pbonzini@redhat.com>","list_archive_url":null,"date":"2026-04-30T17:21:09","name":"[PULL,03/58] target/i386/tcg: simplify decoding of 0F 38 F0...FF","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"951b45eb7bbe2aa2e438aee46bdcc12414cfb77d","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/?format=json","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-4-pbonzini@redhat.com/mbox/","series":[{"id":502347,"url":"http://patchwork.ozlabs.org/api/series/502347/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502347","date":"2026-04-30T17:21:16","name":"[PULL,01/58] pythondeps: bump to meson 1.11.1","version":1,"mbox":"http://patchwork.ozlabs.org/series/502347/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231417/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231417/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=MrLFw1ov;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=d4J/0HbB;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g61Hp6DGfz1yJr\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 03:24:22 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIV5z-0004cR-OK; Thu, 30 Apr 2026 13:22:39 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV5q-0004Yp-7P\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:22:33 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV5n-0004Az-AD\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:22:29 -0400","from mail-qk1-f199.google.com (mail-qk1-f199.google.com\n [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-454-2aOcmuJdPaaNzXoQt_lh4A-1; Thu, 30 Apr 2026 13:22:21 -0400","by mail-qk1-f199.google.com with SMTP id\n af79cd13be357-8ee9a11aa75so257752685a.2\n for <qemu-devel@nongnu.org>; Thu, 30 Apr 2026 10:22:21 -0700 (PDT)","from [192.168.10.48] ([151.49.85.67])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8fbb0fe8572sm25554785a.14.2026.04.30.10.22.18\n for <qemu-devel@nongnu.org>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Apr 2026 10:22:18 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777569744;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=z0z3XL+n9Zll9qCigaTT2NKDDvuOn9S6esTZ+bYQfJ8=;\n b=MrLFw1ovqQkQLewglOtIdqguGD2PLjDyoHs3A2H9HZkLWp1ZblQtTB3CbD/4BLkOGvU842\n uwLcsjqmJ235+1ESudXZ9m/ls2ePk+5fI9080kQ56Q2WDHCzJv74htQjU3vJknZNecFH1M\n 32ANjFIRmF1k6yxqSrznkyZupvjo8+w=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1777569740; x=1778174540; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=z0z3XL+n9Zll9qCigaTT2NKDDvuOn9S6esTZ+bYQfJ8=;\n b=d4J/0HbBajg106OATMq5DI1DSWJBqzNjm1a++93g5PLY/h4fyEQ6oCy44xxbxohHgH\n gbcvBRP9f93CXuhx3I9Syx3R/ZpsDoh9dkosnYigxYRL5PLLfk628mJZblEIJJp1p9R2\n MiyOLFPOzNCBIqRYuULDUN+9m3s1XaNjrS13ZaTzOcNiCfN2Yebw0Qdu0KJusa8S10Of\n vI8+o+srYO0Ca0ro2mlNdLqa2UMzRfmFAzKYG6yLTrCODJLo04LwcOJEDgEcZQ2u0k6V\n KknA9XZNC5FDkxov7j4ZIQE8ZZDV6aMYecidIhv8JqLzbeB1fCFZmQC4kAPcON0RIE2p\n kwuQ=="],"X-MC-Unique":"2aOcmuJdPaaNzXoQt_lh4A-1","X-Mimecast-MFC-AGG-ID":"2aOcmuJdPaaNzXoQt_lh4A_1777569741","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777569740; x=1778174540;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=z0z3XL+n9Zll9qCigaTT2NKDDvuOn9S6esTZ+bYQfJ8=;\n b=hMfp7Rubc7QUyyRZm6lHnT5gsmM5AypP+vlbMEc+PAaoEshpl4NP8f/01FPS6wac5X\n W8A9BMJfHDJGMFS7hqFIhlTWYCfBvRhOQZL2GKzrLxac261hMn/qi3ivshQIikTTuv7E\n G+DY1LWmk4/1Kq1HLf8UDCqRgQXpMqiIARvyaqbJgWdlNxGDIAvggQJsxJCcF3FnoAMz\n ap1GbE8c3wD6vv9XYsUnFZm++RdLLWzVRUVQwJ8dfcVUTdjlRcUG+1VYw3WbAoO4eCt4\n Cj84gdgvptxA1fV8y5iycKg7Ndlnz3hSA69Z42rpSmyQ8SUxo/6mf7YOCD/EUMENswo8\n sCKg==","X-Gm-Message-State":"AOJu0YymCcMj/unPdilLweRx34O2j1yyitzGCcNrNj8LMa8RcSHWZ5nM\n 0GZ78zyg29PbI/FmHTOylO6APD+8xNhjZ+SwKolOOIwIw85nz2MI80Qy87JMIpc+VRbz2OrvfeW\n lY4PEvKIofctgRx3omIwGMhPQZprrAGDrTKWB12cxUSy+8gg7vSfzMSBi3mN6RDNU7Iww7wmBXj\n bYKIik98rS2lCsNAJWOO6SC31KRdrFdTGu8jIoe9j3","X-Gm-Gg":"AeBDieus0KDkLulJS3TymOemwA8iPdnt/ycQFbIw+Jbeq9H5jwen+W+uAqlQ5STmwGL\n 1GNQRucC1Bq0FD8WvfHiJpIaR7HDjHsYp2pH1QrtYMFHKrTMXDzs9KV6fkEbtM0GJ5zmr/DiOSa\n 6Zqc1MkPsOYvKqig8i1uasrYu37xp8gRXV5Ov43IiqWtPXcmBbUU8rIN83I31HHvsWv7JgIctpb\n i1/4dKxrGTE7qGo4zJGhXbswESz5/HBa39Q/Jgu0AxqQ1tpEJ+pWgR2qpTaPqZedsRMcUXjTI5p\n LWeyPKKNUhCaSwG+EB4mcmSMQxr1wKG8oV4ep8SQRYbdeDnrsJOtPPxri77Jnh7Mz9SYawrd3Yw\n C/tpuzN6Ha25R1GtNCVb/TKR5yfd6EeIWhApkosUW1/95hvHAZYYA9ecxLAmqgDsNwRS7+yyrKz\n JDaSwj5tA3NZVXrlms1rIujLqI5AReZ9z4B+0=","X-Received":["by 2002:a05:620a:4627:b0:8d0:191:69b5 with SMTP id\n af79cd13be357-8fab2140c16mr479873585a.54.1777569740314;\n Thu, 30 Apr 2026 10:22:20 -0700 (PDT)","by 2002:a05:620a:4627:b0:8d0:191:69b5 with SMTP id\n af79cd13be357-8fab2140c16mr479862885a.54.1777569739527;\n Thu, 30 Apr 2026 10:22:19 -0700 (PDT)"],"From":"Paolo Bonzini <pbonzini@redhat.com>","To":"qemu-devel@nongnu.org","Subject":"[PULL 03/58] target/i386/tcg: simplify decoding of 0F 38 F0...FF","Date":"Thu, 30 Apr 2026 19:21:09 +0200","Message-ID":"<20260430172204.1006673-4-pbonzini@redhat.com>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260430172204.1006673-1-pbonzini@redhat.com>","References":"<20260430172204.1006673-1-pbonzini@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=pbonzini@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"These lines are shown in the manual with a weird representation that\nconfers a special meaning to 0x66 0xF2 prefixes.  In reality, this is\njust the CRC32 instruction (chosen by 0xF2) plus a data size override\nprefix.  All other instruction in the range that use the 0xF2 prefix\nare VEX-encoded and therefore they do not support multiple prefixes.\nBecause of this, it is possible to handle the four prefixes normally\nusing decode_by_prefix; the 0x66 0xF2 combination for CRC32 is handled\nnaturally by the \"v\" operand size.\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n target/i386/tcg/decode-new.c.inc | 21 +++------------------\n 1 file changed, 3 insertions(+), 18 deletions(-)","diff":"diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc\nindex c8b5bd6ad26..ac181308ca4 100644\n--- a/target/i386/tcg/decode-new.c.inc\n+++ b/target/i386/tcg/decode-new.c.inc\n@@ -873,8 +873,8 @@ static const X86OpEntry opcodes_0F38_00toEF[240] = {\n     [0xef] = X86_OP_ENTRY3(CMPccXADD,   M,y, G,y, B,y,  vex13 xchg chk(o64) cpuid(CMPCCXADD) p_66),\n };\n \n-/* five rows for no prefix, 66, F3, F2, 66+F2  */\n-static const X86OpEntry opcodes_0F38_F0toFF[16][5] = {\n+/* four rows for no prefix, 66, F3, F2 (including 66+F2 operand size override) */\n+static const X86OpEntry opcodes_0F38_F0toFF[16][4] = {\n     /*\n      * MOVBE and CRC32 are incorrectly listed as always doing 32-bit operation\n      * without prefix and 16-bit operation with 0x66.\n@@ -884,49 +884,42 @@ static const X86OpEntry opcodes_0F38_F0toFF[16][5] = {\n         X86_OP_ENTRYwr(MOVBE, G,v, M,v, cpuid(MOVBE)),\n         {},\n         X86_OP_ENTRY2(CRC32, G,d, E,b, cpuid(SSE42)),\n-        X86_OP_ENTRY2(CRC32, G,d, E,b, cpuid(SSE42)),\n     },\n     [1] = {\n         X86_OP_ENTRYwr(MOVBE, M,v, G,v, cpuid(MOVBE)),\n         X86_OP_ENTRYwr(MOVBE, M,v, G,v, cpuid(MOVBE)),\n         {},\n         X86_OP_ENTRY2(CRC32, G,d, E,v, cpuid(SSE42)),\n-        X86_OP_ENTRY2(CRC32, G,d, E,v, cpuid(SSE42)),\n     },\n     [2] = {\n         X86_OP_ENTRY3(ANDN, G,y, B,y, E,y, vex13 cpuid(BMI1)),\n         {},\n         {},\n         {},\n-        {},\n     },\n     [3] = {\n         X86_OP_GROUP3(group17, B,y, None,None, E,y, vex13 cpuid(BMI1)),\n         {},\n         {},\n         {},\n-        {},\n     },\n     [5] = {\n         X86_OP_ENTRY3(BZHI, G,y, E,y, B,y, vex13 cpuid(BMI1)),\n         {},\n         X86_OP_ENTRY3(PEXT, G,y, B,y, E,y, vex13 zextT0 cpuid(BMI2)),\n         X86_OP_ENTRY3(PDEP, G,y, B,y, E,y, vex13 zextT0 cpuid(BMI2)),\n-        {},\n     },\n     [6] = {\n         {},\n         X86_OP_ENTRY2(ADCX, G,y, E,y, cpuid(ADX)),\n         X86_OP_ENTRY2(ADOX, G,y, E,y, cpuid(ADX)),\n         X86_OP_ENTRY3(MULX, /* B,y, */ G,y, E,y, 2,y, vex13 cpuid(BMI2)),\n-        {},\n     },\n     [7] = {\n         X86_OP_ENTRY3(BEXTR, G,y, E,y, B,y, vex13 zextT0 cpuid(BMI1)),\n         X86_OP_ENTRY3(SHLX, G,y, E,y, B,y, vex13 cpuid(BMI1)),\n         X86_OP_ENTRY3(SARX, G,y, E,y, B,y, vex13 sextT0 cpuid(BMI1)),\n         X86_OP_ENTRY3(SHRX, G,y, E,y, B,y, vex13 zextT0 cpuid(BMI1)),\n-        {},\n     },\n };\n \n@@ -936,15 +929,7 @@ static void decode_0F38(DisasContext *s, CPUX86State *env, X86OpEntry *entry, ui\n     if (*b < 0xf0) {\n         *entry = opcodes_0F38_00toEF[*b];\n     } else {\n-        int row = 0;\n-        if (s->prefix & PREFIX_REPZ) {\n-            /* The REPZ (F3) prefix has priority over 66 */\n-            row = 2;\n-        } else {\n-            row += s->prefix & PREFIX_REPNZ ? 3 : 0;\n-            row += s->prefix & PREFIX_DATA ? 1 : 0;\n-        }\n-        *entry = opcodes_0F38_F0toFF[*b & 15][row];\n+        *entry = *decode_by_prefix(s, opcodes_0F38_F0toFF[*b & 15]);\n     }\n }\n \n","prefixes":["PULL","03/58"]}