| Issue |
76135
|
| Summary |
[Reassociate]
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
vfdff
|
* test: https://gcc.godbolt.org/z/jnjn3P9s5
```
int mul1(int a, int b, int c, int d, int e, int f) {
return a*b*c*c*d*e*f;
}
int mul2(int a, int b, int c, int d, int e, int f) {
int tmp1 = a * b * c;
int tmp2 = d * e * f;
return tmp1 * tmp2;
}
```
* gcc:
```
mul2(int, int, int, int, int, int):
mul w0, w0, w1
mul w3, w3, w4
mul w0, w0, w2
mul w3, w3, w5
mul w0, w0, w3
ret
```
* llvm:
```
mul2(int, int, int, int, int, int): // @mul2(int, int, int, int, int, int)
mul w8, w1, w0
mul w8, w8, w2
mul w8, w8, w3
mul w8, w8, w4
mul w0, w8, w5
ret
```
* For the test `mul2`, we already split the long chain mul into 2 chains because some machine may be have multi-units for mul instruction, but the clang still geneate **a single chain** of mul with register dependence.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs