Issue 168828
Summary [x86] Eliminate `movzx` when upper part of register is irrelevant or overwritten
Labels new issue
Assignees
Reporter Validark
    ```zig
export fn foo(x: u8) u32 {
    return @ctz(x >> 1);
}
```

```asm
foo:
        shr     dil
        movzx eax, dil
        or      eax, 256
        tzcnt   eax, eax
 ret
```

Could be:


```asm
foo:
        shr     dil
        or edi, 256
        tzcnt   eax, edi
        ret
```

The compiler could also look for things like `or eax, -256` and eliminate `movzx eax, al` since the relevant bits are overwritten anyway.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to