[Bug target/109463] suboptimal sequence for converting 64-bit unsigned int to float
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109463 --- Comment #3 from elronnd at elronnd dot net --- Yes, I think the gcc approach of branching is definitely better. But it's still a good idea to optimise for size in the cold path.
[Bug c/109463] New: suboptimal sequence for converting 64-bit unsigned int to float
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109463 Bug ID: 109463 Summary: suboptimal sequence for converting 64-bit unsigned int to float Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: elronnd at elronnd dot net Target Milestone: --- double f(uint64_t x) { return x; } gives: test rdi,rdi js 10 pxor xmm0,xmm0 cvtsi2sd xmm0,rdi ret nop 10: movrax,rdi andedi,0x1 pxor xmm0,xmm0 shrrax,1 or rax,rdi cvtsi2sd xmm0,rax addsd xmm0,xmm0 ret In particular, the sequence: movrax,rdi andedi,0x1 shrrax,1 or rax,rdi cvtsi2sd xmm0,rax Can be replaced with: movzx eax,dil shrrdi,1 or rdi,rax cvtsi2sd xmm0,rdi Since all 9 low bits of rdi are below the sticky bit, oring them together in any order suffices to round correctly. Alternatively, in order to avoid clobbering rdi, use the following sequence: movrax,rdi shrrax,1 or al,dil cvtsi2sd xmm0,rax (The penalty for partial register access appears to be very cheap or nonexistent on recent uarchs.)
[Bug c/103113] New: Bad error message with multiply indirect pointer to struct
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103113 Bug ID: 103113 Summary: Bad error message with multiply indirect pointer to struct Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: elronnd at elronnd dot net Target Milestone: --- $ cat q.c int f() { struct { int m; } **x; return x->m; } $ gcc -c q.c q.c: In function ‘f’: q.c:3:17: error: ‘*x’ is a pointer; did you mean to use ‘->’? 3 | return x->m; | ^~ | ->
[Bug rtl-optimization/97607] New: Spurious sign extension
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97607 Bug ID: 97607 Summary: Spurious sign extension Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: elronnd at elronnd dot net Target Milestone: --- The following code extern void fun(char); void wrapper(char x) { fun(x); } Should compile 'wrapper' to a single jump, but instead it does this (on amd64): wrapper: movsx edi, dil jmp fun Presumably 'x' is getting promoted to int in wrapper, and the promotion never gets removed.