target-i386: xsave: Simplify CPUID[0xD,0].{EAX,EDX} calculation
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 22 Sep 2016 17:58:32 +0000 (14:58 -0300)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 27 Sep 2016 19:17:17 +0000 (16:17 -0300)
Instead of assigning individual bits in a loop, just copy the
values from ena_mask.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
target-i386/cpu.c

index 99685812adfe2e6695701042d5aa90c640a57264..7e66003204c46f9f4feb4acc4a57b989a7bf7b92 100644 (file)
@@ -2523,15 +2523,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             for (i = 2; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
                 const ExtSaveArea *esa = &x86_ext_save_areas[i];
                 if ((ena_mask >> i) & 1) {
-                    if (i < 32) {
-                        *eax |= 1u << i;
-                    } else {
-                        *edx |= 1u << (i - 32);
-                    }
                     *ecx = MAX(*ecx, esa->offset + esa->size);
                 }
             }
-            *eax |= ena_mask & (XSTATE_FP_MASK | XSTATE_SSE_MASK);
+            *eax = ena_mask;
+            *edx = ena_mask >> 32;
             *ebx = *ecx;
         } else if (count == 1) {
             *eax = env->features[FEAT_XSAVE];