Re: [PATCH] RISC-V: THead: Fix missing CFI directives for th.sdd in prologue.

2023-10-04 Thread
On 10/4/23 15:49, Xianmiao Qu wrote:
> 
> From: quxm 
> 
I'm sorry for posting the wrong username and email. If someone helps me merge 
the code later, please delete this line for me (Just use the username and email 
from the email I am currently sending, Xianmiao Qu 
).
Thanks,
Xianmiao


[PATCH, csky] Force .init_array suppor for GLIBC

2018-12-04 Thread
Hi, 
I have submitted a patch to force .init_array suppor for GLIBC


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 266812)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2018-12-05  Xianmiao Qu  
+
+   * config.gcc (csky-*-linux-gnu*): Force .init_array support.
+
 2018-12-05  Segher Boessenkool  
 
* config/rs6000/rs6000.c (rs6000_function_arg): Only do the special
Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 266812)
+++ gcc/config.gcc  (working copy)
@@ -1356,6 +1356,9 @@ csky-*-*)
case ${target} in
csky-*-linux-gnu*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+   # Force .init_array support.  The configure script 
cannot always
+   # automatically detect that GAS supports it, yet we 
require it.
+   gcc_cv_initfini_array=yes
;;
csky-*-linux-uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"






[PATCH, csky] Update linux-unwind.h for kernel

2018-11-15 Thread
Hi, 
I have submitted a patch to update linux-unwind for kernel


Index: libgcc/ChangeLog
===
--- libgcc/ChangeLog(revision 266199)
+++ libgcc/ChangeLog(working copy)
@@ -1,5 +1,11 @@
 2018-11-15  Xianmiao Qu  
 
+   * config/csky/linux-unwind.h (sc_pt_regs): Update for kernel. 
+   (sc_pt_regs_lr): Update for kernel.
+   (sc_pt_regs_tls): Update for kernel.
+
+2018-11-15  Xianmiao Qu  
+
* config/csky/linux-unwind.h: Fix coding style.
 
 2018-11-13  Xianmiao Qu  
Index: libgcc/config/csky/linux-unwind.h
===
--- libgcc/config/csky/linux-unwind.h   (revision 266199)
+++ libgcc/config/csky/linux-unwind.h   (working copy)
@@ -47,9 +47,9 @@
 #define MOVI_R7_139_V2_PART0 0xea07
 #define MOVI_R7_139_V2_PART1 139
 
-#define sc_pt_regs(x) (sc->sc_##x)
-#define sc_pt_regs_lr (sc->sc_r15)
-#define sc_pt_regs_tls(x) (sc->sc_exregs[15])
+#define sc_pt_regs(x) (sc->sc_pt_regs.x)
+#define sc_pt_regs_lr (sc->sc_pt_regs.lr)
+#define sc_pt_regs_tls(x) sc_pt_regs(x)
 
 #define MD_FALLBACK_FRAME_STATE_FOR csky_fallback_frame_state





Re: [PATCH, csky] Update dynamic linker'name

2018-11-15 Thread


Hi,
GNU_USER_DYNAMIC_LINKER is defined in linux.h, it will expand to 
GLIBC_DYNAMIC_LINKER when configured with glibc

> 在 2018年11月15日,下午6:30,Richard Biener  写道:
> 
> On Thu, Nov 15, 2018 at 7:02 AM 瞿仙淼  wrote:
>> 
>> Hi,
>>I have submitted a patch to update dynamic linker'name
>> 
>> 
>> Index: gcc/ChangeLog
>> ===
>> --- gcc/ChangeLog   (revision 266171)
>> +++ gcc/ChangeLog   (working copy)
>> @@ -1,3 +1,9 @@
>> +2018-11-15  Xianmiao Qu  
>> +
>> +   * config/csky/csky-linux-elf.h (LINUX_DYNAMIC_LINKER): Remove.
>> +   (GLIBC_DYNAMIC_LINKER): Define.
>> +   (LINUX_TARGET_LINK_SPEC): Update the dynamic linker's name.
>> +
>> 2018-11-15  Bin Cheng  
>> 
>>PR tree-optimization/84648
>> Index: gcc/config/csky/csky-linux-elf.h
>> ===
>> --- gcc/config/csky/csky-linux-elf.h(revision 266171)
>> +++ gcc/config/csky/csky-linux-elf.h(working copy)
>> @@ -61,7 +61,7 @@
>>   %{mvdsp:-mvdsp}  \
>>   "
>> 
>> -#define LINUX_DYNAMIC_LINKER  "/lib/ld.so.1"
>> +#define GLIBC_DYNAMIC_LINKER 
>> "/lib/ld-linux-cskyv2%{mhard-float:-hf}%{mbig-endian:-be}.so.1"
>> 
>> #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v}\
>>%{b}\
>> @@ -70,7 +70,7 @@
>>%{symbolic:-Bsymbolic}  \
>>%{!static:  \
>>  %{rdynamic:-export-dynamic}   \
>> - %{!shared:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}  \
>> + %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}   \
> 
> ^^^ GNU_USER_DYNAMIC_LINKER vs. GLIBC_DYNAMIC_LINKER
> 
>>-X  \
>>%{mbig-endian:-EB} %{mlittle-endian:-EL}\
>>%{EB:-EB} %{EL:-EL}"
>> Index: libgcc/ChangeLog
>> ===
>> --- libgcc/ChangeLog(revision 266171)
>> +++ libgcc/ChangeLog(working copy)
>> @@ -1,3 +1,7 @@
>> +2018-11-15  Xianmiao Qu  
>> +
>> +   * config/csky/linux-unwind.h: Fix coding style.
>> +
>> 2018-11-13  Xianmiao Qu  
>> 
>>* config/csky/linux-unwind.h (_sig_ucontext_t): Remove.
>> Index: libgcc/config/csky/linux-unwind.h
>> ===
>> --- libgcc/config/csky/linux-unwind.h   (revision 266171)
>> +++ libgcc/config/csky/linux-unwind.h   (working copy)
>> @@ -25,10 +25,8 @@
>> 
>> #ifndef inhibit_libc
>> 
>> -/*
>> - * Do code reading to identify a signal frame, and set the frame state data
>> - * appropriately.  See unwind-dw2.c for the structs.
>> - */
>> +/* Do code reading to identify a signal frame, and set the frame state data
>> +   appropriately.  See unwind-dw2.c for the structs.  */
>> 
>> #include 
>> #include 



[PATCH, csky] Update dynamic linker'name

2018-11-14 Thread
Hi, 
I have submitted a patch to update dynamic linker'name


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 266171)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2018-11-15  Xianmiao Qu  
+
+   * config/csky/csky-linux-elf.h (LINUX_DYNAMIC_LINKER): Remove.
+   (GLIBC_DYNAMIC_LINKER): Define.
+   (LINUX_TARGET_LINK_SPEC): Update the dynamic linker's name.
+
 2018-11-15  Bin Cheng  
 
PR tree-optimization/84648
Index: gcc/config/csky/csky-linux-elf.h
===
--- gcc/config/csky/csky-linux-elf.h(revision 266171)
+++ gcc/config/csky/csky-linux-elf.h(working copy)
@@ -61,7 +61,7 @@
   %{mvdsp:-mvdsp}  \
   "
 
-#define LINUX_DYNAMIC_LINKER  "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER 
"/lib/ld-linux-cskyv2%{mhard-float:-hf}%{mbig-endian:-be}.so.1"
 
 #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v}\
%{b}\
@@ -70,7 +70,7 @@
%{symbolic:-Bsymbolic}  \
%{!static:  \
  %{rdynamic:-export-dynamic}   \
- %{!shared:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}  \
+ %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}   \
-X  \
%{mbig-endian:-EB} %{mlittle-endian:-EL}\
%{EB:-EB} %{EL:-EL}"
Index: libgcc/ChangeLog
===
--- libgcc/ChangeLog(revision 266171)
+++ libgcc/ChangeLog(working copy)
@@ -1,3 +1,7 @@
+2018-11-15  Xianmiao Qu  
+
+   * config/csky/linux-unwind.h: Fix coding style.
+
 2018-11-13  Xianmiao Qu  
 
* config/csky/linux-unwind.h (_sig_ucontext_t): Remove.
Index: libgcc/config/csky/linux-unwind.h
===
--- libgcc/config/csky/linux-unwind.h   (revision 266171)
+++ libgcc/config/csky/linux-unwind.h   (working copy)
@@ -25,10 +25,8 @@
 
 #ifndef inhibit_libc
 
-/*
- * Do code reading to identify a signal frame, and set the frame state data
- * appropriately.  See unwind-dw2.c for the structs.
- */
+/* Do code reading to identify a signal frame, and set the frame state data
+   appropriately.  See unwind-dw2.c for the structs.  */
 
 #include 
 #include 




[PATCH, csky] Update linux-unwind.h

2018-11-13 Thread
Hi, 
I have submitted a patch to update linux-unwind for C-SKY


Index: libgcc/ChangeLog
===
--- libgcc/ChangeLog(revision 266056)
+++ libgcc/ChangeLog(working copy)
@@ -1,3 +1,9 @@
+2018-11-13  Xianmiao Qu  
+
+   * config/csky/linux-unwind.h (_sig_ucontext_t): Remove.
+   (csky_fallback_frame_state): Modify the check of the 
+   instructions to adapt to changes in the kernel
+
 2018-11-09  Stafford Horne  
Richard Henderson  
 
Index: libgcc/config/csky/linux-unwind.h
===
--- libgcc/config/csky/linux-unwind.h   (revision 266056)
+++ libgcc/config/csky/linux-unwind.h   (working copy)
@@ -25,23 +25,34 @@
 
 #ifndef inhibit_libc
 
-/* Do code reading to identify a signal frame, and set the frame
-   state data appropriately.  See unwind-dw2.c for the structs.  */
+/*
+ * Do code reading to identify a signal frame, and set the frame state data
+ * appropriately.  See unwind-dw2.c for the structs.
+ */
 
 #include 
 #include 
 
-/* The third parameter to the signal handler points to something with
-   this structure defined in asm/ucontext.h, but the name clashes with
-   struct ucontext from sys/ucontext.h so this private copy is used.  */
-typedef struct _sig_ucontext {
-  unsigned long uc_flags;
-  struct _sig_ucontext  *uc_link;
-  stack_t   uc_stack;
-  struct sigcontext uc_mcontext;
-  sigset_t  uc_sigmask;
-} _sig_ucontext_t;
+#define TRAP0_V1 0x0008
+#define MOVI_R1_119_V1 (0x6000 + (119 << 4) + 1)
+#define MOVI_R1_127_V1 (0x6000 + (127 << 4) + 1)
+#define ADDI_R1_32_V1 (0x2000 + (31 << 4) + 1)
+#define ADDI_R1_14_V1 (0x2000 + (13 << 4) + 1)
+#define ADDI_R1_12_V1 (0x2000 + (11 << 4) + 1)
 
+#define TRAP0_V2_PART0 0xc000
+#define TRAP0_V2_PART1 0x2020
+#define MOVI_R7_119_V2_PART0 0xea07
+#define MOVI_R7_119_V2_PART1 119
+#define MOVI_R7_173_V2_PART0 0xea07
+#define MOVI_R7_173_V2_PART1 173
+#define MOVI_R7_139_V2_PART0 0xea07
+#define MOVI_R7_139_V2_PART1 139
+
+#define sc_pt_regs(x) (sc->sc_##x)
+#define sc_pt_regs_lr (sc->sc_r15)
+#define sc_pt_regs_tls(x) (sc->sc_exregs[15])
+
 #define MD_FALLBACK_FRAME_STATE_FOR csky_fallback_frame_state
 
 static _Unwind_Reason_Code
@@ -54,78 +65,66 @@ csky_fallback_frame_state (struct _Unwind_Context
   int i;
 
   /* movi r7, __NR_rt_sigreturn; trap 0  */
-  if ((*(pc+0) == 0xea07) && (*(pc+1) == 119)
-  && (*(pc+2) == 0xc000) &&  (*(pc+3) == 0x2020))
-  {
-struct sigframe
+  if ((*(pc + 0) == MOVI_R7_139_V2_PART0)
+  && (*(pc + 1) == MOVI_R7_139_V2_PART1) && (*(pc + 2) == TRAP0_V2_PART0)
+  && (*(pc + 3) == TRAP0_V2_PART1))
 {
-  int sig;
-  int code;
-  struct sigcontext *psc;
-  unsigned long extramask[2]; /* _NSIG_WORDS */
-  struct sigcontext sc;
-} *_rt = context->cfa;
-sc = _rt->psc; // &(_rt->sc);
-  }
-  /* movi r7, __NR_rt_sigreturn; trap 0  */
-  else if ((*(pc+0) == 0xea07) && (*(pc+1) == 173)
-  && (*(pc+2) == 0xc000) &&  (*(pc+3) == 0x2020))
-  {
-struct rt_sigframe
-{
-  int sig;
-  struct siginfo *pinfo;
-  void* puc;
-  siginfo_t info;
-  struct ucontext uc;
-} *_rt = context->cfa;
-sc = &(_rt->uc.uc_mcontext);
-  }
+  struct rt_sigframe
+  {
+   int sig;
+   struct siginfo *pinfo;
+   void *puc;
+   siginfo_t info;
+   ucontext_t uc;
+  } *_rt = context->cfa;
+  sc = &(_rt->uc.uc_mcontext);
+}
   else
 return _URC_END_OF_STACK;
 
-  new_cfa = (_Unwind_Ptr) sc->sc_usp;
+  new_cfa = (_Unwind_Ptr) sc_pt_regs (usp);
   fs->regs.cfa_how = CFA_REG_OFFSET;
   fs->regs.cfa_reg = STACK_POINTER_REGNUM;
   fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
 
   fs->regs.reg[0].how = REG_SAVED_OFFSET;
-  fs->regs.reg[0].loc.offset = (_Unwind_Ptr)&(sc->sc_a0) - new_cfa;
+  fs->regs.reg[0].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a0) - new_cfa;
 
   fs->regs.reg[1].how = REG_SAVED_OFFSET;
-  fs->regs.reg[1].loc.offset = (_Unwind_Ptr)&(sc->sc_a1) - new_cfa;
+  fs->regs.reg[1].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a1) - new_cfa;
 
   fs->regs.reg[2].how = REG_SAVED_OFFSET;
-  fs->regs.reg[2].loc.offset = (_Unwind_Ptr)&(sc->sc_a2) - new_cfa;
+  fs->regs.reg[2].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a2) - new_cfa;
 
   fs->regs.reg[3].how = REG_SAVED_OFFSET;
-  fs->regs.reg[3].loc.offset = (_Unwind_Ptr)&(sc->sc_a3) - new_cfa;
+  fs->regs.reg[3].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a3) - new_cfa;
 
   for (i = 4; i < 14; i++)
 {
   fs->regs.reg[i].how = REG_SAVED_OFFSET;
-  fs->regs.reg[i].loc.offset = ((_Unwind_Ptr)&(sc->sc_regs[i - 4])
-   - new_cfa);
+  fs->regs.reg[i].loc.offset =
+   (_Unwind_Ptr) & sc_pt_regs (regs[i - 4]) - new_cfa;
 }
 
-  for (i = 16; i < 32; i++)
+  for (i = 16; i < 31; i++)
 {
   fs->regs.reg[i].how = REG_SAVED_OFFSET;

[PATCH, csky] Handle -frounding-math.

2018-11-11 Thread
Hi, 
I have submitted a patch to handle -frounding-math for C-SKY


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 266023)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2018-11-11  Xianmiao Qu  
+
+   * config/csky/csky.md (*fpuv2_nmulsf3_1, *fpuv2_nmuldf3_1): Handle
+   -frounding-math.
+
 2018-11-11  Sandra Loosemore  
 
PR c++/43105
Index: gcc/config/csky/csky_insn_fpu.md
===
--- gcc/config/csky/csky_insn_fpu.md(revision 266023)
+++ gcc/config/csky/csky_insn_fpu.md(working copy)
@@ -131,7 +131,7 @@
   [(set (match_operand:SF 0 "register_operand" "=v")
(mult:SF (neg:SF (match_operand:SF 1 "register_operand" "%v"))
 (match_operand:SF 2 "register_operand" "v")))]
-  "CSKY_ISA_FEATURE (fpv2_sf)"
+  "CSKY_ISA_FEATURE (fpv2_sf) && !flag_rounding_math"
   "fnmuls\t%0, %1, %2")
 
 (define_insn "*fpuv2_nmulsf3_2"
@@ -145,7 +145,7 @@
   [(set (match_operand:DF 0 "register_operand" "=v")
(mult:DF (neg:DF (match_operand:DF 1 "register_operand" "%v"))
 (match_operand:DF 2 "register_operand" "v")))]
- "CSKY_ISA_FEATURE (fpv2_df)"
+ "CSKY_ISA_FEATURE (fpv2_df) && !flag_rounding_math"
  "fnmuld\t%0, %1, %2")
 
 (define_insn "*fpuv2_nmuldf3_2"
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog (revision 266023)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2018-11-11  Xianmiao Qu  
+
+   * gcc.target/csky/fnmul-1.c: New.
+   * gcc.target/csky/fnmul-2.c: New.
+   * gcc.target/csky/fnmul-3.c: New.
+   * gcc.target/csky/fnmul-4.c: New.
+
 2018-11-11  Uros Bizjak  
 
PR target/87928
Index: gcc/testsuite/gcc.target/csky/fnmul-1.c
===
--- gcc/testsuite/gcc.target/csky/fnmul-1.c (nonexistent)
+++ gcc/testsuite/gcc.target/csky/fnmul-1.c (working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -a * b;
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -a * b;
+}
+
Index: gcc/testsuite/gcc.target/csky/fnmul-2.c
===
--- gcc/testsuite/gcc.target/csky/fnmul-2.c (nonexistent)
+++ gcc/testsuite/gcc.target/csky/fnmul-2.c (working copy)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2 -frounding-math" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnegd" } } */
+  /* { dg-final { scan-assembler "fmuld" } } */
+  return -a * b;
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnegs" } } */
+  /* { dg-final { scan-assembler "fmuls" } } */
+  return -a * b;
+}
+
Index: gcc/testsuite/gcc.target/csky/fnmul-3.c
===
--- gcc/testsuite/gcc.target/csky/fnmul-3.c (nonexistent)
+++ gcc/testsuite/gcc.target/csky/fnmul-3.c (working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -(a * b);
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -(a * b);
+}
+
Index: gcc/testsuite/gcc.target/csky/fnmul-4.c
===
--- gcc/testsuite/gcc.target/csky/fnmul-4.c (nonexistent)
+++ gcc/testsuite/gcc.target/csky/fnmul-4.c (working copy)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ck810f -mhard-float -O2 -frounding-math" } */
+
+double
+fnmuld (double a, double b)
+{
+  /* { dg-final { scan-assembler "fnmuld" } } */
+  return -(a * b);
+}
+
+float
+fnmuls (float a, float b)
+{
+  /* { dg-final { scan-assembler "fnmuls" } } */
+  return -(a * b);
+}
+





[PATCH, csky] Support -profile

2018-11-11 Thread
Hi, 
I have submitted a patch to support ‘-profile' for C-SKY


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 266012)
+++ gcc/ChangeLog   (working copy)
@@ -1,5 +1,9 @@
 2018-11-11  Xianmiao Qu  
 
+   * config/csky/csky-linux-elf.h (CC1_SPEC): Support -profile.
+
+2018-11-11  Xianmiao Qu  
+
* config/csky/csky.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
 
 2018-11-11  Richard Biener  
Index: gcc/config/csky/csky-linux-elf.h
===
--- gcc/config/csky/csky-linux-elf.h(revision 266011)
+++ gcc/config/csky/csky-linux-elf.h(working copy)
@@ -35,6 +35,7 @@
 #define CC1_SPEC  \
   "%{EB:-EB} \
%{EL:-EL} \
+   %{profile:-p}  \
   "
 
 #undef ASM_SPEC





[PATCH, csky] Define ASM_PREFERRED_EH_DATA_FORMAT

2018-11-11 Thread
Hi, 
I have submitted a patch to Define ASM_PREFERRED_EH_DATA_FORMAT for 
C-SKY


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 266011)
+++ gcc/ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2018-11-11  Xianmiao Qu  
+
+   * config/csky/csky.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
+
 2018-11-11  Richard Biener  
 
* tree-vrp.h (class value_range_base): New base class for
Index: gcc/config/csky/csky.h
===
--- gcc/config/csky/csky.h  (revision 266011)
+++ gcc/config/csky/csky.h  (working copy)
@@ -292,6 +292,9 @@ extern int csky_arch_isa_features[];
 /* The register that holds the return address in exception handlers.  */
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CSKY_EH_STACKADJ_REGNUM)
 
+/* Select a format to encode pointers in exception handling data.  */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
+  (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4)
 
 /* Registers That Address the Stack Frame  */
 




Re: [PATCH, csky] add an earlyclobber for two patterns

2018-09-08 Thread
I forgot to say that I have submitted this patch.


> 在 2018年9月9日,下午12:20,瞿仙淼  写道:
> 
> Hello!
> 
>   Two patterns were missing an earlyclobber.
> 
> 
> Index: gcc/ChangeLog
> ===
> --- gcc/ChangeLog (revision 264177)
> +++ gcc/ChangeLog (revision 264176)
> @@ -1,8 +1,3 @@
> -2018-09-09  Xianmiao Qu  
> -
> - * config/csky/csky.md (*cskyv2_adddi3, *cskyv2_subdi3): Add
> - earlyclobber.
> -
> 2018-09-08  John David Anglin  
> 
>   PR rtl-optimization/85458
> Index: gcc/config/csky/csky.md
> ===
> --- gcc/config/csky/csky.md   (revision 264177)
> +++ gcc/config/csky/csky.md   (revision 264176)
> @@ -919,7 +919,7 @@
>clear the carry bit before adding the lo words.  */
> 
> (define_insn_and_split "*cskyv2_adddi3"
> -  [(set (match_operand:DI   0 "register_operand" "=,")
> +  [(set (match_operand:DI   0 "register_operand" "=b,")
>   (plus:DI (match_operand:DI 1 "register_operand" "%0,r")
>(match_operand:DI 2 "register_operand" "b, r")))
>(clobber (reg:CC CSKY_CC_REGNUM))]
> @@ -1117,7 +1117,7 @@
>set the C bit before subtracting the lo words.  */
> 
> (define_insn_and_split "*cskyv2_subdi3"
> -  [(set (match_operand:DI0 "register_operand" "=,")
> +  [(set (match_operand:DI0 "register_operand" "=b,")
>   (minus:DI (match_operand:DI 1 "register_operand" "0, r")
> (match_operand:DI 2 "register_operand" "b, r")))
>(clobber (reg:CC CSKY_CC_REGNUM))]
> 



[PATCH, csky] add an earlyclobber for two patterns

2018-09-08 Thread
Hello!

Two patterns were missing an earlyclobber.


Index: gcc/ChangeLog
===
--- gcc/ChangeLog   (revision 264177)
+++ gcc/ChangeLog   (revision 264176)
@@ -1,8 +1,3 @@
-2018-09-09  Xianmiao Qu  
-
-   * config/csky/csky.md (*cskyv2_adddi3, *cskyv2_subdi3): Add
-   earlyclobber.
-
 2018-09-08  John David Anglin  
 
PR rtl-optimization/85458
Index: gcc/config/csky/csky.md
===
--- gcc/config/csky/csky.md (revision 264177)
+++ gcc/config/csky/csky.md (revision 264176)
@@ -919,7 +919,7 @@
clear the carry bit before adding the lo words.  */
 
 (define_insn_and_split "*cskyv2_adddi3"
-  [(set (match_operand:DI 0 "register_operand" "=,")
+  [(set (match_operand:DI 0 "register_operand" "=b,")
(plus:DI (match_operand:DI 1 "register_operand" "%0,r")
 (match_operand:DI 2 "register_operand" "b, r")))
(clobber (reg:CC CSKY_CC_REGNUM))]
@@ -1117,7 +1117,7 @@
set the C bit before subtracting the lo words.  */
 
 (define_insn_and_split "*cskyv2_subdi3"
-  [(set (match_operand:DI  0 "register_operand" "=,")
+  [(set (match_operand:DI  0 "register_operand" "=b,")
(minus:DI (match_operand:DI 1 "register_operand" "0, r")
  (match_operand:DI 2 "register_operand" "b, r")))
(clobber (reg:CC CSKY_CC_REGNUM))]



Re: [0/5] C-SKY port

2018-08-01 Thread


>>> We expect that
>>> C-SKY will also be providing a public link to the processor and ABI
>>> documentation at some point.
>> 
>> The ABI manual has been posted, but not the ISA documentation yet.  (I'd 
>> guess
>> that when it does show up it will be in the same place, though.)
>> 
>> https://github.com/c-sky/csky-doc
> 
> Could you provide the proposed GCC website changes for the port 
> (backends.html, readings.html, news item for index.html)?  readings.html, 
> in particular, would link to the ABI and ISA documentation, while 
> backends.html gives summary information about the properties of both the 
> architecture and the GCC port.
> 
> -- 
> Joseph S. Myers
> jos...@codesourcery.com

Hi,
The ISA documentation is now available from  
https://github.com/c-sky/csky-doc

-Xianmiao

Re: [2/5] C-SKY port: Backend implementation

2018-07-26 Thread


> 在 2018年7月25日,上午5:24,Jeff Law  写道:
> 
> On 07/24/2018 12:18 PM, Sandra Loosemore wrote:
>> On 07/24/2018 09:45 AM, Jeff Law wrote:
>>> On 07/23/2018 10:21 PM, Sandra Loosemore wrote:
>>> I'm not a big fan of more awk code, but I'm not going to object to it :-)
>>> 
>>> Why does the port have its own little pass for condition code
>>> optimization (cse_cc)?  What is it doing that can't be done with our
>>> generic optimizers?
>> 
>> This pass was included in the initial patch set we got from C-SKY, and
>> as it didn't seem to break anything I left it in.  Perhaps C-SKY can
>> provide a testcase that demonstrates why it's still useful in the
>> current version of GCC; otherwise we can remove this from the initial
>> port submission and restore it later if some performance analysis shows
>> it is still worthwhile.
> FWIW it looks like we model CC setting on just a few insns, (add,
> subtract) so I'd be surprised if this little mini pass found much.  I'd
> definitely like to hear from the csky authors here.
> 
> Alternately, you could do add some instrumentation to flag when it
> triggers, take a test or two that does, reduce it and we can then look
> at the key RTL sequences and see what the pass is really doing.
> 

I wrote a case to reproduce this problem on C-SKY. C code is as follows:
---
int e1, e2;

void func (int a, int b, int c, int d, int f, int g)
{
  e1 = a > b ? f : g;
  e2 = a > b ? c : d;

  return;
}
---

compile to assembler with option “-O3 -S” :
---
func:
  cmplt a1, a0
  ld.w  t1, (sp, 0)
  ld.w  t0, (sp, 4)
  movt  t0, t1
  cmplt a1, a0
  movt  a3, a2
  lrw a1, e2
  lrw a2, e1
  st.w  a3, (a1, 0)
  st.w  t0, (a2, 0)
  rts
---
There is an extra “cmplt a1, a0" in the above code without cse_cc. This 
situation mainly occurs when a relatively short branch jump is converted into a 
conditional execution instruction. And the CSE pass can not reduce the same 
conditional comparison instruction . Here is the rtx sequence after “cse2” pass.

---
(insn 28 13 29 2 (set (reg:CC 33 c)
(gt:CC (reg/v:SI 77 [ a ])
(reg/v:SI 78 [ b ]))) func.c:5 1099 {*cmpgtsi}
 (nil))
(insn 29 28 30 2 (set (reg/v:SI 82 [ g ])
(if_then_else:SI (eq (reg:CC 33 c)
(const_int 0 [0]))
(reg/v:SI 82 [ g ])
(reg/v:SI 81 [ f ]))) func.c:5 983 {movf}
 (expr_list:REG_DEAD (reg/v:SI 81 [ f ])
(expr_list:REG_DEAD (reg:CC 33 c)
(nil
(insn 30 29 31 2 (set (reg:CC 33 c)
(gt:CC (reg/v:SI 77 [ a ])
(reg/v:SI 78 [ b ]))) func.c:5 1099 {*cmpgtsi}
 (expr_list:REG_DEAD (reg/v:SI 78 [ b ])
(expr_list:REG_DEAD (reg/v:SI 77 [ a ])
(nil
(insn 31 30 18 2 (set (reg/v:SI 80 [ d ])
(if_then_else:SI (eq (reg:CC 33 c)
(const_int 0 [0]))
(reg/v:SI 80 [ d ])
(reg/v:SI 79 [ c ]))) func.c:5 983 {movf}
 (expr_list:REG_DEAD (reg/v:SI 79 [ c ])
(expr_list:REG_DEAD (reg:CC 33 c)
(nil
---

It doesn't seem to check the same conditional comparison instruction .So I 
wrote this to solve this problem, but I am not sure if this is the best way : )

PS, the same conditional comparison instruction cannot be reduced with the 
latest version gcc with C-SKY because I just insert the “cse_cc” after “cse1”, 
when I insert after “cse2”, this problem can be solved very well.


Thanks,
Xianmiao