https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121047

            Bug ID: 121047
           Summary: Possible hardware issue with Raptor Lake processors
                    for code that gcc may generate
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

There is a blog post at

https://fgiesen.wordpress.com/2025/05/21/oodle-2-9-14-and-intel-13th-14th-gen-cpus/

which says that Raptor Lake Intel processors have a bug which sometimes
lets the processor store the bits 7:0 (registers like cl or
dl) instead of bits 15:8 (ch or dh).

Source for which such code is generated is below, with-O2 -mbmi2.

This is not a gcc bug, so I am not sure what, if anything, gcc
should or should not do about this. I also cannot confirm this
on my own hardware, which is a different generation, but I thought
I'd record this anyway; this may be something that should be closed as
INVALID if gcc does not want to provide a workaround.

#include <stdint.h>

void decode_five(uint8_t* dest, uint64_t& bits_ref, const uint16_t* table)
{
    uint64_t bits = bits_ref;
    uint16_t e;

    e = table[bits & 2047];
    bits >>= e & 63;
    dest[0] = e >> 8;

    e = table[bits & 2047];
    bits >>= e & 63;
    dest[1] = e >> 8;

    e = table[bits & 2047];
    bits >>= e & 63;
    dest[2] = e >> 8;

    e = table[bits & 2047];
    bits >>= e & 63;
    dest[3] = e >> 8;

    e = table[bits & 2047];
    bits >>= e & 63;
    dest[4] = e >> 8;

    bits_ref = bits;
}

Reply via email to