| Issue |
61505
|
| Summary |
[AArch64] [SVE] ratio of svcntb() to svcnth()
|
| Labels |
|
| Assignees |
|
| Reporter |
k-arrows
|
Test code:
```console
#include <arm_sve.h>
uint64_t f1()
{
return svcntb() / svcnth();
}
uint64_t f2()
{
return (2 * svcntb()) / (2 * svcnth());
}
uint64_t f3()
{
return (3 * svcntb()) / (3 * svcnth());
}
uint64_t f4()
{
return (4 * svcntb()) / (4 * svcnth());
}
```
armv8-a clang (trunk) generates:
```console
f1(): // @f1()
rdvl x8, #1
cnth x9
udiv x0, x8, x9
ret
f2(): // @f2()
rdvl x8, #2
rdvl x9, #1
udiv x0, x8, x9
ret
f3(): // @f3()
mov w0, #2 // =0x2
ret
f4(): // @f4()
rdvl x8, #4
rdvl x9, #2
udiv x0, x8, x9
ret
```
Only f3 is optimized as expected.
Godbolt:
https://godbolt.org/z/rze6bKj5s
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs