| Issue |
160756
|
| Summary |
Use `BLSR` fusions to break dependency chains even when intermediate _expression_ value is consumed
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Validark
|
[Godbolt](https://c.godbo.lt/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,selection:(endColumn:1,endLineNumber:7,positionColumn:1,positionLineNumber:7,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:'%23include+%3Cstdint.h%3E%0A%0Auint64_t+foo(uint64_t+z)+%7B%0A++++uint64_t+w+%3D+z+-+1%3B%0A++++return+(z+%26+w)+*+w%3B%0A%7D%0A'),l:'5',n:'0',o:'C+source+%231',t:'0')),k:47.14192766144739,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:cclang_trunk,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'1',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,libs:!(),options:'-O3+--target%3Dx86_64-linux+-march%3Dznver5',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:'5',n:'0',o:'+x86-64+clang+(trunk)+(Editor+%231)',t:'0')),k:52.858072338552596,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4)
```c
#include <stdint.h>
uint64_t foo(uint64_t z) {
uint64_t w = z - 1;
return (z & w) * w;
}
```
Emits:
```asm
foo:
lea rax, [rdi - 1]
and rdi, rax ; can't be computed in parallel with `lea`
imul rax, rdi
ret
```
I was expecting:
```asm
foo:
lea rax, [rdi - 1]
blsr rdi, rdi ; can be computed in parallel with `lea`
imul rax, rdi
ret
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs