search for: lfsr32

Displaying 2 results from an estimated 2 matches for "lfsr32".

2018 Nov 26
3
BUGS in code generated for target i386-win32
Hi @ll, LLVM/clang generates wrong code for the following program (see <https://godbolt.org/z/UZrrkG>): --- sample.c --- unsigned __fastcall lfsr32(unsigned argument, unsigned polynomial) { __asm { add ecx, ecx ; ecx = argument << 1 sbb eax, eax ; eax = CF ? -1 : 0 and eax, edx ; eax = CF ? polynomial : 0 xor eax, ecx ; eax = (argument << 1) ^ (CF ? polynomial : 0) } } int main() { u...
2018 Nov 26
2
BUGS in code generated for target i386-win32
...es the > issues you're seeing. > >> BUG #1: the compiler fails to allocate (EAX for) the variable "lfsr"! >> BUG #2: the variable "lfsr" is NOT initialized! > > Since the __asm isn't linked (as far as Clang is concerned) to > either input for lfsr32, they're both unused. REALLY? Or better: OUCH! Is Clang NOT aware of the __fastcall calling convention and its register usage? Clang does NOT create prolog/epilog here, so it CLEARLY knows that "argument" is held in ECX and "polynomial" in EDX ... as documented for __fastc...