* [PATCH 0/2] xtensa: fix floating-point parts of machine description @ 2014-10-12 22:46 Max Filippov 2014-10-12 22:46 ` [PATCH 1/2] xtensa: drop unimplemented floating point operations Max Filippov ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Max Filippov @ 2014-10-12 22:46 UTC (permalink / raw) To: gcc-patches; +Cc: Sterling Augustine, Marc Gauthier, Max Filippov Hi Sterling, this series fixes two bugs in xtensa.md: - generation of non-existent instructions for division/reciprocal/square root - generation of pre- or post-increment floating point loads/stores depending on whether the core supports former or latter. These changes allow building gcc for modern xtensa cores with FPU. Tested on xtensa-linux-uclibc. Max Filippov (2): xtensa: drop unimplemented floating point operations xtensa: use pre- and postincrement FP load/store when available gcc/config/xtensa/xtensa.h | 4 +++ gcc/config/xtensa/xtensa.md | 80 ++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 45 deletions(-) -- 1.8.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] xtensa: drop unimplemented floating point operations 2014-10-12 22:46 [PATCH 0/2] xtensa: fix floating-point parts of machine description Max Filippov @ 2014-10-12 22:46 ` Max Filippov 2014-10-13 16:09 ` augustine.sterling 2014-10-12 23:19 ` [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available Max Filippov 2014-10-13 16:04 ` [PATCH 0/2] xtensa: fix floating-point parts of machine description augustine.sterling 2 siblings, 1 reply; 10+ messages in thread From: Max Filippov @ 2014-10-12 22:46 UTC (permalink / raw) To: gcc-patches; +Cc: Sterling Augustine, Marc Gauthier, Max Filippov xtensa ISA never implemented FP division, reciprocal, square root and inverse square root as single opcode. Remove patterns that can emit them. 2014-10-09 Max Filippov <jcmvbkbc@gmail.com> gcc/ * config/xtensa/xtensa.md (divsf3, *recipsf2, sqrtsf2, *rsqrtsf2): remove. --- gcc/config/xtensa/xtensa.md | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index dddc6ab..0e3f033 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -82,7 +82,7 @@ ;; Attributes. (define_attr "type" - "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fdiv,fsqrt,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry" + "unknown,jump,call,load,store,move,arith,multi,nop,farith,fmadd,fconv,fload,fstore,mul16,mul32,div32,mac16,rsr,wsr,entry" (const_string "unknown")) (define_attr "mode" @@ -360,26 +360,6 @@ (set_attr "mode" "SI") (set_attr "length" "3")]) -(define_insn "divsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_HARD_FLOAT_DIV" - "div.s\t%0, %1, %2" - [(set_attr "type" "fdiv") - (set_attr "mode" "SF") - (set_attr "length" "3")]) - -(define_insn "*recipsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "const_float_1_operand" "") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_HARD_FLOAT_RECIP && flag_unsafe_math_optimizations" - "recip.s\t%0, %2" - [(set_attr "type" "fdiv") - (set_attr "mode" "SF") - (set_attr "length" "3")]) - \f ;; Remainders. @@ -404,28 +384,6 @@ (set_attr "length" "3")]) \f -;; Square roots. - -(define_insn "sqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (sqrt:SF (match_operand:SF 1 "register_operand" "f")))] - "TARGET_HARD_FLOAT_SQRT" - "sqrt.s\t%0, %1" - [(set_attr "type" "fsqrt") - (set_attr "mode" "SF") - (set_attr "length" "3")]) - -(define_insn "*rsqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "const_float_1_operand" "") - (sqrt:SF (match_operand:SF 2 "register_operand" "f"))))] - "TARGET_HARD_FLOAT_RSQRT && flag_unsafe_math_optimizations" - "rsqrt.s\t%0, %2" - [(set_attr "type" "fsqrt") - (set_attr "mode" "SF") - (set_attr "length" "3")]) - -\f ;; Absolute value. (define_insn "abssi2" -- 1.8.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] xtensa: drop unimplemented floating point operations 2014-10-12 22:46 ` [PATCH 1/2] xtensa: drop unimplemented floating point operations Max Filippov @ 2014-10-13 16:09 ` augustine.sterling 2014-10-15 4:23 ` Max Filippov 0 siblings, 1 reply; 10+ messages in thread From: augustine.sterling @ 2014-10-13 16:09 UTC (permalink / raw) To: Max Filippov; +Cc: gcc-patches, Marc Gauthier On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: > xtensa ISA never implemented FP division, reciprocal, square root and > inverse square root as single opcode. Remove patterns that can emit > them. > > 2014-10-09 Max Filippov <jcmvbkbc@gmail.com> > > gcc/ > * config/xtensa/xtensa.md (divsf3, *recipsf2, sqrtsf2, *rsqrtsf2): > remove. Approved. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] xtensa: drop unimplemented floating point operations 2014-10-13 16:09 ` augustine.sterling @ 2014-10-15 4:23 ` Max Filippov 0 siblings, 0 replies; 10+ messages in thread From: Max Filippov @ 2014-10-15 4:23 UTC (permalink / raw) To: augustine.sterling; +Cc: gcc-patches, Marc Gauthier On Mon, Oct 13, 2014 at 8:05 PM, augustine.sterling@gmail.com <augustine.sterling@gmail.com> wrote: > On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> xtensa ISA never implemented FP division, reciprocal, square root and >> inverse square root as single opcode. Remove patterns that can emit >> them. >> >> 2014-10-09 Max Filippov <jcmvbkbc@gmail.com> >> >> gcc/ >> * config/xtensa/xtensa.md (divsf3, *recipsf2, sqrtsf2, *rsqrtsf2): >> remove. > > Approved. Applied to trunk. Thanks! -- Max ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available 2014-10-12 22:46 [PATCH 0/2] xtensa: fix floating-point parts of machine description Max Filippov 2014-10-12 22:46 ` [PATCH 1/2] xtensa: drop unimplemented floating point operations Max Filippov @ 2014-10-12 23:19 ` Max Filippov 2014-10-13 16:05 ` augustine.sterling 2014-10-13 16:04 ` [PATCH 0/2] xtensa: fix floating-point parts of machine description augustine.sterling 2 siblings, 1 reply; 10+ messages in thread From: Max Filippov @ 2014-10-12 23:19 UTC (permalink / raw) To: gcc-patches; +Cc: Sterling Augustine, Marc Gauthier, Max Filippov Earlier versions of xtensa FPU used to support preincrement FP load and store instructions (lsiu/ssiu). Recent FPU supports postincrement FP load and store instructions only (lsip/ssip). Use configuration macro to decide which version is available. 2014-10-10 Max Filippov <jcmvbkbc@gmail.com> gcc/ * config/xtensa/xtensa.h (TARGET_HARD_FLOAT_POSTINC): new macro. * config/xtensa/xtensa.md (*lsiu, *ssiu): add dependency on !TARGET_HARD_FLOAT_POSTINC. (*lsip, *ssip): new instructions. --- gcc/config/xtensa/xtensa.h | 4 ++++ gcc/config/xtensa/xtensa.md | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index c4a8f88..54bfea4 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -39,6 +39,9 @@ extern unsigned xtensa_current_frame_size; #ifndef XCHAL_HAVE_THREADPTR #define XCHAL_HAVE_THREADPTR 0 #endif +#ifndef XCHAL_HAVE_FP_POSTINC +#define XCHAL_HAVE_FP_POSTINC 0 +#endif #define TARGET_BIG_ENDIAN XCHAL_HAVE_BE #define TARGET_DENSITY XCHAL_HAVE_DENSITY #define TARGET_MAC16 XCHAL_HAVE_MAC16 @@ -55,6 +58,7 @@ extern unsigned xtensa_current_frame_size; #define TARGET_HARD_FLOAT_RECIP XCHAL_HAVE_FP_RECIP #define TARGET_HARD_FLOAT_SQRT XCHAL_HAVE_FP_SQRT #define TARGET_HARD_FLOAT_RSQRT XCHAL_HAVE_FP_RSQRT +#define TARGET_HARD_FLOAT_POSTINC XCHAL_HAVE_FP_POSTINC #define TARGET_ABS XCHAL_HAVE_ABS #define TARGET_ADDX XCHAL_HAVE_ADDX #define TARGET_RELEASE_SYNC XCHAL_HAVE_RELEASE_SYNC diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 0e3f033..b8acebb 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -922,7 +922,7 @@ (match_operand:SI 2 "fpmem_offset_operand" "i")))) (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))] - "TARGET_HARD_FLOAT" + "TARGET_HARD_FLOAT && !TARGET_HARD_FLOAT_POSTINC" { if (TARGET_SERIALIZE_VOLATILE && volatile_refs_p (PATTERN (insn))) output_asm_insn ("memw", operands); @@ -938,7 +938,7 @@ (match_operand:SF 2 "register_operand" "f")) (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))] - "TARGET_HARD_FLOAT" + "TARGET_HARD_FLOAT && !TARGET_HARD_FLOAT_POSTINC" { if (TARGET_SERIALIZE_VOLATILE && volatile_refs_p (PATTERN (insn))) output_asm_insn ("memw", operands); @@ -948,6 +948,38 @@ (set_attr "mode" "SF") (set_attr "length" "3")]) +(define_insn "*lsip" + [(set (match_operand:SF 0 "register_operand" "=f") + (mem:SF (match_operand:SI 1 "register_operand" "+a"))) + (set (match_dup 1) + (plus:SI (match_dup 1) + (match_operand:SI 2 "fpmem_offset_operand" "i")))] + "TARGET_HARD_FLOAT && TARGET_HARD_FLOAT_POSTINC" +{ + if (TARGET_SERIALIZE_VOLATILE && volatile_refs_p (PATTERN (insn))) + output_asm_insn ("memw", operands); + return "lsip\t%0, %1, %2"; +} + [(set_attr "type" "fload") + (set_attr "mode" "SF") + (set_attr "length" "3")]) + +(define_insn "*ssip" + [(set (mem:SF (match_operand:SI 0 "register_operand" "+a")) + (match_operand:SF 1 "register_operand" "f")) + (set (match_dup 0) + (plus:SI (match_dup 0) + (match_operand:SI 2 "fpmem_offset_operand" "i")))] + "TARGET_HARD_FLOAT && TARGET_HARD_FLOAT_POSTINC" +{ + if (TARGET_SERIALIZE_VOLATILE && volatile_refs_p (PATTERN (insn))) + output_asm_insn ("memw", operands); + return "ssip\t%1, %0, %2"; +} + [(set_attr "type" "fstore") + (set_attr "mode" "SF") + (set_attr "length" "3")]) + ;; 64-bit floating point moves (define_expand "movdf" -- 1.8.1.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available 2014-10-12 23:19 ` [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available Max Filippov @ 2014-10-13 16:05 ` augustine.sterling 2014-10-14 0:16 ` Max Filippov 2014-10-15 4:34 ` Max Filippov 0 siblings, 2 replies; 10+ messages in thread From: augustine.sterling @ 2014-10-13 16:05 UTC (permalink / raw) To: Max Filippov; +Cc: gcc-patches, Marc Gauthier On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: > 2014-10-10 Max Filippov <jcmvbkbc@gmail.com> > > gcc/ > * config/xtensa/xtensa.h (TARGET_HARD_FLOAT_POSTINC): new macro. > * config/xtensa/xtensa.md (*lsiu, *ssiu): add dependency on > !TARGET_HARD_FLOAT_POSTINC. > (*lsip, *ssip): new instructions. Approved. Do you have write priviliges? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available 2014-10-13 16:05 ` augustine.sterling @ 2014-10-14 0:16 ` Max Filippov 2014-10-15 4:34 ` Max Filippov 1 sibling, 0 replies; 10+ messages in thread From: Max Filippov @ 2014-10-14 0:16 UTC (permalink / raw) To: augustine.sterling; +Cc: gcc-patches, Marc Gauthier On Mon, Oct 13, 2014 at 8:04 PM, augustine.sterling@gmail.com <augustine.sterling@gmail.com> wrote: > On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> 2014-10-10 Max Filippov <jcmvbkbc@gmail.com> >> >> gcc/ >> * config/xtensa/xtensa.h (TARGET_HARD_FLOAT_POSTINC): new macro. >> * config/xtensa/xtensa.md (*lsiu, *ssiu): add dependency on >> !TARGET_HARD_FLOAT_POSTINC. >> (*lsip, *ssip): new instructions. > > Approved. Do you have write priviliges? I don't, will request. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available 2014-10-13 16:05 ` augustine.sterling 2014-10-14 0:16 ` Max Filippov @ 2014-10-15 4:34 ` Max Filippov 1 sibling, 0 replies; 10+ messages in thread From: Max Filippov @ 2014-10-15 4:34 UTC (permalink / raw) To: augustine.sterling; +Cc: gcc-patches, Marc Gauthier On Mon, Oct 13, 2014 at 8:04 PM, augustine.sterling@gmail.com <augustine.sterling@gmail.com> wrote: > On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> 2014-10-10 Max Filippov <jcmvbkbc@gmail.com> >> >> gcc/ >> * config/xtensa/xtensa.h (TARGET_HARD_FLOAT_POSTINC): new macro. >> * config/xtensa/xtensa.md (*lsiu, *ssiu): add dependency on >> !TARGET_HARD_FLOAT_POSTINC. >> (*lsip, *ssip): new instructions. > > Approved. Do you have write priviliges? Applied to trunk. Thanks! -- Max ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] xtensa: fix floating-point parts of machine description 2014-10-12 22:46 [PATCH 0/2] xtensa: fix floating-point parts of machine description Max Filippov 2014-10-12 22:46 ` [PATCH 1/2] xtensa: drop unimplemented floating point operations Max Filippov 2014-10-12 23:19 ` [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available Max Filippov @ 2014-10-13 16:04 ` augustine.sterling 2014-10-13 22:43 ` Max Filippov 2 siblings, 1 reply; 10+ messages in thread From: augustine.sterling @ 2014-10-13 16:04 UTC (permalink / raw) To: Max Filippov; +Cc: gcc-patches, Marc Gauthier On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: > Hi Sterling, > > this series fixes two bugs in xtensa.md: HI Max, thanks for this. I don't see a patch though. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] xtensa: fix floating-point parts of machine description 2014-10-13 16:04 ` [PATCH 0/2] xtensa: fix floating-point parts of machine description augustine.sterling @ 2014-10-13 22:43 ` Max Filippov 0 siblings, 0 replies; 10+ messages in thread From: Max Filippov @ 2014-10-13 22:43 UTC (permalink / raw) To: augustine.sterling; +Cc: gcc-patches, Marc Gauthier On Mon, Oct 13, 2014 at 8:03 PM, augustine.sterling@gmail.com <augustine.sterling@gmail.com> wrote: > On Sun, Oct 12, 2014 at 3:46 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> Hi Sterling, >> >> this series fixes two bugs in xtensa.md: > > HI Max, thanks for this. I don't see a patch though. It's a cover letter with a summary of changes. Patches go as replies to it. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-10-15 4:23 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-10-12 22:46 [PATCH 0/2] xtensa: fix floating-point parts of machine description Max Filippov 2014-10-12 22:46 ` [PATCH 1/2] xtensa: drop unimplemented floating point operations Max Filippov 2014-10-13 16:09 ` augustine.sterling 2014-10-15 4:23 ` Max Filippov 2014-10-12 23:19 ` [PATCH 2/2] xtensa: use pre- and postincrement FP load/store when available Max Filippov 2014-10-13 16:05 ` augustine.sterling 2014-10-14 0:16 ` Max Filippov 2014-10-15 4:34 ` Max Filippov 2014-10-13 16:04 ` [PATCH 0/2] xtensa: fix floating-point parts of machine description augustine.sterling 2014-10-13 22:43 ` Max Filippov
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).