public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in
@ 2024-05-31 13:50 gjl at gcc dot gnu.org
2024-05-31 13:52 ` [Bug middle-end/115307] " gjl at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-31 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
Bug ID: 115307
Summary: [avr] Don't expand isinf() like a built-in
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: gjl at gcc dot gnu.org
Target Milestone: ---
avr-gcc compiles
int isinff (float);
int call_isinff (float f)
{
return isinff (f);
}
like:
call_isinff:
push r12 ; 63 [c=4 l=1] pushqi1/0
push r13 ; 64 [c=4 l=1] pushqi1/0
push r14 ; 65 [c=4 l=1] pushqi1/0
push r15 ; 66 [c=4 l=1] pushqi1/0
push r28 ; 67 [c=4 l=1] pushqi1/0
/* prologue: function */
/* frame size = 0 */
/* stack size = 5 */
.L__stack_usage = 5
movw r12,r22 ; 56 [c=4 l=2] *movsf/0
movw r14,r24
clt ; 57 [c=4 l=2] *abssf2/1
bld r15,7
ldi r28,lo8(1) ; 58 [c=4 l=1] movqi_insn/1
ldi r18,lo8(-1) ; 59 [c=4 l=4] *movsf/4
ldi r19,lo8(-1)
ldi r20,lo8(127)
ldi r21,lo8(127)
movw r24,r14 ; 60 [c=4 l=2] *movsf/0
movw r22,r12
call __unordsf2 ; 10 [c=12 l=2] call_value_insn/1
cpse r24,__zero_reg__ ; 61 [c=0 l=1] enable_interrupt-3
rjmp .L2
ldi r18,lo8(-1) ; 52 [c=4 l=4] *movsf/4
ldi r19,lo8(-1)
ldi r20,lo8(127)
ldi r21,lo8(127)
movw r24,r14 ; 53 [c=4 l=2] *movsf/0
movw r22,r12
call __lesf2 ; 15 [c=12 l=2] call_value_insn/1
cp __zero_reg__,r24 ; 77 [c=16 l=1] *swapped_tstqi
brge .L2 ; 78 [c=4 l=1] branch
ldi r28,0 ; 51 [c=4 l=1] movqi_insn/0
.L2:
ldi r24,lo8(1) ; 45 [c=4 l=1] movqi_insn/1
eor r24,r28 ; 46 [c=4 l=1] *xorqi3
ldi r25,0 ; 50 [c=4 l=1] movqi_insn/0
/* epilogue start */
pop r28 ; 70 [c=4 l=1] popqi
pop r15 ; 71 [c=4 l=1] popqi
pop r14 ; 72 [c=4 l=1] popqi
pop r13 ; 73 [c=4 l=1] popqi
pop r12 ; 74 [c=4 l=1] popqi
ret ; 75 [c=0 l=1] return_from_epilogue
where a simple call to isinff would be mush better.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
@ 2024-05-31 13:52 ` gjl at gcc dot gnu.org
2024-05-31 15:49 ` [Bug target/115307] " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-05-31 13:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
2024-05-31 13:52 ` [Bug middle-end/115307] " gjl at gcc dot gnu.org
@ 2024-05-31 15:49 ` rguenth at gcc dot gnu.org
2024-06-01 8:54 ` [Bug tree-optimization/115307] " cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-31 15:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that we probably fold isinff early. On x86 I see already in
.original:
return !(ABS_EXPR <f> u<= 3.4028234663852885981170418348451692544e+38);
I think your option is to provide optabs for isinf<mode> but make expansion
of them always FAIL; (which is of course a quite ugly way)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
2024-05-31 13:52 ` [Bug middle-end/115307] " gjl at gcc dot gnu.org
2024-05-31 15:49 ` [Bug target/115307] " rguenth at gcc dot gnu.org
@ 2024-06-01 8:54 ` cvs-commit at gcc dot gnu.org
2024-06-01 9:12 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-01 8:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:
https://gcc.gnu.org/g:fabb545026f714b7d1cbe586f4c5bbf6430bdde3
commit r15-966-gfabb545026f714b7d1cbe586f4c5bbf6430bdde3
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Sat Jun 1 10:38:00 2024 +0200
AVR: tree-optimization/115307 - Work around isinf bloat from early passes.
PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf<mode>2) [sf, df]: New expanders.
gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (2 preceding siblings ...)
2024-06-01 8:54 ` [Bug tree-optimization/115307] " cvs-commit at gcc dot gnu.org
@ 2024-06-01 9:12 ` cvs-commit at gcc dot gnu.org
2024-06-01 9:14 ` gjl at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-01 9:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:
https://gcc.gnu.org/g:9d08c55f7c99329f4289ad3a4157c2d8d8a78d8c
commit r14-10266-g9d08c55f7c99329f4289ad3a4157c2d8d8a78d8c
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Sat Jun 1 10:38:00 2024 +0200
AVR: tree-optimization/115307 - Work around isinf bloat from early passes.
PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf<mode>2) [sf, df]: New expanders.
gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.
(cherry picked from commit fabb545026f714b7d1cbe586f4c5bbf6430bdde3)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (3 preceding siblings ...)
2024-06-01 9:12 ` cvs-commit at gcc dot gnu.org
@ 2024-06-01 9:14 ` gjl at gcc dot gnu.org
2024-06-01 9:34 ` gjl at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-06-01 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
The isinf part is fixied in v14.2+, but there is also isnan etc. which don't
currently habe an optabs entry, so defining a failing expander won't work.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (4 preceding siblings ...)
2024-06-01 9:14 ` gjl at gcc dot gnu.org
@ 2024-06-01 9:34 ` gjl at gcc dot gnu.org
2024-06-01 11:40 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-06-01 9:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> The issue is that we probably fold isinff early. On x86 I see already in
> .original:
>
> return !(ABS_EXPR <f> u<= 3.4028234663852885981170418348451692544e+38);
That looks incorrect. The man 3 page for isinf states that it returns -1 for
-Inf, but that expression returns 1 for -Inf (same for the expanded avr code
above).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (5 preceding siblings ...)
2024-06-01 9:34 ` gjl at gcc dot gnu.org
@ 2024-06-01 11:40 ` cvs-commit at gcc dot gnu.org
2024-06-01 15:21 ` gjl at gcc dot gnu.org
2024-06-03 17:12 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-01 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:
https://gcc.gnu.org/g:c57d73f4cd5ca61327406fc2521a2235dd49d12e
commit r13-8817-gc57d73f4cd5ca61327406fc2521a2235dd49d12e
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Sat Jun 1 10:38:00 2024 +0200
AVR: tree-optimization/115307 - Work around isinf bloat from early passes.
PR tree-optimization/115307
gcc/
* config/avr/avr.md (SFDF): New mode iterator.
(isinf<mode>2) [sf, df]: New expanders.
gcc/testsuite/
* gcc.target/avr/torture/pr115307-isinf.c: New test.
(cherry picked from commit fabb545026f714b7d1cbe586f4c5bbf6430bdde3)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (6 preceding siblings ...)
2024-06-01 11:40 ` cvs-commit at gcc dot gnu.org
@ 2024-06-01 15:21 ` gjl at gcc dot gnu.org
2024-06-03 17:12 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-06-01 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P4 |P3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/115307] [avr] Don't expand isinf() like a built-in
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
` (7 preceding siblings ...)
2024-06-01 15:21 ` gjl at gcc dot gnu.org
@ 2024-06-03 17:12 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-06-03 17:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115307
--- Comment #7 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Note the difference between __builtin_isinf (C standard semantics, returns
unspecified nonzero value for an infinity) and __builtin_isinf_sign (stricter
semantics returning 1 for +Inf and -1 for -Inf).
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-03 17:12 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 13:50 [Bug middle-end/115307] New: [avr] Don't expand isinf() like a built-in gjl at gcc dot gnu.org
2024-05-31 13:52 ` [Bug middle-end/115307] " gjl at gcc dot gnu.org
2024-05-31 15:49 ` [Bug target/115307] " rguenth at gcc dot gnu.org
2024-06-01 8:54 ` [Bug tree-optimization/115307] " cvs-commit at gcc dot gnu.org
2024-06-01 9:12 ` cvs-commit at gcc dot gnu.org
2024-06-01 9:14 ` gjl at gcc dot gnu.org
2024-06-01 9:34 ` gjl at gcc dot gnu.org
2024-06-01 11:40 ` cvs-commit at gcc dot gnu.org
2024-06-01 15:21 ` gjl at gcc dot gnu.org
2024-06-03 17:12 ` jsm28 at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).