Cr0a3/ygen

[x64] cast code gen

Closed this issue · 0 comments

Describe the bug
The following function:

define i64 @add( i32 %0,  i32 %1 ) {
 entry:
    %2 = add i32 %0, %1
    %3 = cast %2 to i64
    ret i64 %3

}

Generates following assembly:

section .text

add:
	lea eax, [ ecx + edx ]
	mov rax, rcx // wrong it will just  mov arg1 into output it should be nothing because the lea overrides eax (and the also the upper half of rax) which would mean a cast to 64bit 
	ret