| Issue |
233830
|
| Summary |
clang fails to inline various memcmp at least on amd64
|
| Labels |
|
| Assignees |
|
| Reporter |
mjguzik
|
Consider:
```
#define BUFSIZE 40
struct foo {
char buf[BUFSIZE];
};
int test(struct foo *p1, struct foo *p2) {
return __builtin_memcmp(p1, p2, sizeof(struct foo)) == 0;
}
```
I expect that for reasonable sizes this will generate an inline asm when compiled with -O2. This does happen up to a point, but the cut off is too low.
I am seeing the following:
- with `-O2 func` calls for sizes above 32 bytes
- with `-O2 -mno-see` (kernel stuff) func calls for sizes above 16 bytes
fwiw in real code the specific case I'm looking at has 40 bytes and it has be compiled with `-mno-sse`.
In comparison gcc 16.2 emits the asm I'm looking for.
I don't know what would make a sensible upper bound, but it's definitely higher than the 16 and 32 bytes respectively.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs