public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: i370 port
@ 2011-08-20 12:15 Paul Edwards
  2011-08-22 12:23 ` Ulrich Weigand
  0 siblings, 1 reply; 92+ messages in thread
From: Paul Edwards @ 2011-08-20 12:15 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

Adding this code:

C:\devel\gcc\gcc\config\i370>cvs diff i370.md
Index: i370.md
===================================================================
RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.md,v
retrieving revision 1.21
diff -r1.21 i370.md
845a846,851
>   if (operands[1] == const0_rtx)
>   {
>     CC_STATUS_INIT;
>     mvs_check_page (0, 6, 8);
>     return \"MVC      %O0(8,%R0),=XL8'00'\";
>   }

to the i370.md definition:

;
; movdi instruction pattern(s).
;

(define_insn ""
  [(set (match_operand:DI 0 "nonimmediate_operand" "=d,m,S")
        (match_operand:DI 1 "general_operand" "g,d,SF"))]
;;  [(set (match_operand:DI 0 "r_or_s_operand" "=dS,m")
;;        (match_operand:DI 1 "r_or_s_operand" "diS*fF,d*fF"))]
  "TARGET_CHAR_INSTRUCTIONS"
  "*
{
  check_label_emit ();
  if (REG_P (operands[0]))
    {
      if (FP_REG_P (operands[1]))
    {
      mvs_check_page (0, 8, 0);
      return \"STD    %1,\" CONVLO \"(,13)\;LM    %0,%N0,\" CONVLO \"(13)\";
    }
      if (REG_P (operands[1]))
    {
      mvs_check_page (0, 4, 0);
      return \"LR    %0,%1\;LR    %N0,%N1\";
    }
      if (operands[1] == const0_rtx)
    {
      CC_STATUS_INIT;
      mvs_check_page (0, 4, 0);
      return \"SLR    %0,%0\;SLR    %N0,%N0\";
    }
      if (GET_CODE (operands[1]) == CONST_INT
        && (unsigned) INTVAL (operands[1]) < 4096)
    {
      CC_STATUS_INIT;
      mvs_check_page (0, 6, 0);
      return \"SLR    %0,%0\;LA    %N0,%c1(0,0)\";
    }
      if (GET_CODE (operands[1]) == CONST_INT)
    {
      CC_STATUS_SET (operands[0], operands[1]);
      mvs_check_page (0, 8, 0);
      return \"L    %0,%1\;SRDA    %0,32\";
    }
      if (GET_CODE (operands[1]) == CONST_DOUBLE)
    {
      mvs_check_page (0, 6, 8);
      return \"LM    %0,%N0,%1\";
    }
      mvs_check_page (0, 4, 0);
      /*return \"LM    %0,%N0,%1\";*/
      return \"L    %0,%1\;L    %N0,4+%1\";
    }
  else if (FP_REG_P (operands[1]))
    {
      mvs_check_page (0, 4, 0);
      return \"STD    %1,%0\";
    }
  else if (REG_P (operands[1]))
    {
      mvs_check_page (0, 4, 0);
      /*return \"STM    %1,%N1,%0\"; */
      return \"ST    %1,%0\;ST    %N1,4+%0\";
    }
  if (operands[1] == const0_rtx)
  {
    CC_STATUS_INIT;
    mvs_check_page (0, 6, 8);
    return \"MVC    %O0(8,%R0),=XL8'00'\";
  }
  mvs_check_page (0, 6, 8);
  return \"MVC    %O0(8,%R0),%1\";
}"
   [(set_attr "length" "8")]
)


forces it to use XL8'00' instead of the default F'0' and that
seems to work.  Does that seem like a proper solution to
you?

Unfortunately there's still another problem I've noticed.
I'll put that in another message after I've investigated it.

BFN.  Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2014-02-13  4:23 Paul Edwards
  0 siblings, 0 replies; 92+ messages in thread
From: Paul Edwards @ 2014-02-13  4:23 UTC (permalink / raw)
  To: gcc

Let me ask a different question.

On GCC 3.2.3, does this sequence look correct:

./configure --target=i370-mvspdp --prefix=~/devel/mvscross --with-sysroot=~/devel/mvshead 
 --enable-languages=c
make
make install

./configure --build=x86_64-unknown-linux-gnu --host=i370-mvspdp --target=i370-mvspdp 
 --prefix=~/devel/mvshost --enable-languages=c --disable-nls
make


The first bit is working well - it is creating a cross-compiler.
But the second bit is not working well, on gcc 3.2.3 at
least. The sequence worked fine on gcc 3.4.6.

Thanks. Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2012-04-07  5:45 Paul Edwards
  2012-04-08 17:43 ` Ulrich Weigand
  0 siblings, 1 reply; 92+ messages in thread
From: Paul Edwards @ 2012-04-07  5:45 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

Hi Ulrich.

A further question.

I put some debugging on here:

  op0 = XEXP (operands[0], 0);
  if (GET_CODE (op0) == REG
      || (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 0)) == REG
    && GET_CODE (XEXP (op0, 1)) == CONST_INT
    && (unsigned) INTVAL (XEXP (op0, 1)) < 4096))
  {
    op0 = operands[0];
    fprintf(stderr, \"used as-is\n\");
  }
  else
  {
    op0 = replace_equiv_address (operands[0], copy_to_mode_reg (SImode, 
op0));
    fprintf(stderr, \"replaced\n\");
  }

And I found out that op0 is already being "replaced". Shouldn't this
replacement eliminate the index register and just have a base
register, so that I don't need the hack further down?

Thanks.  Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2012-04-06 12:49 Paul Edwards
  2012-04-06 18:16 ` Ulrich Weigand
  0 siblings, 1 reply; 92+ messages in thread
From: Paul Edwards @ 2012-04-06 12:49 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

I've managed to isolate the problem to a small test program.

Any suggestions on how to debug this?

Thanks.  Paul.




C:\devel\gcc\gcc>type bug27.c
/* This program demonstrates a bug in a modification to GCC 3.4.6 */
/* It generates the below error when compiled with -O2 */

#if 0
bug27.c: In function `foo':
bug27.c:28: error: unrecognizable insn:
(insn 116 34 35 2 (set (reg:SI 5 5)
        (plus:SI (plus:SI (reg:SI 2 2 [orig:54 i ] [54])
                (reg/f:SI 13 13))
            (const_int 104 [0x68]))) -1 (nil)
    (nil))
bug27.c:28: internal compiler error: in ZZZ_680, at recog.c:2083
#endif

void foo(int c)
{
    int x[3];
    int y[3];
    int i;

    for (i = 0; i < 2; i++)
    {
        if (c == 1) x[i] &= y[i];
        else if (c == 2) x[i] |= y[i];
    }

    return;
}

C:\devel\gcc\gcc>





-----Original Message----- 
From: Paul Edwards
Sent: Friday, April 06, 2012 3:50 PM
To: Ulrich Weigand
Cc: gcc@gcc.gnu.org
Subject: Re: i370 port

I have made this change:

C:\devel\gcc\gcc\config\i370>cvs diff -c -r 1.23 i370.md
Index: i370.md
===================================================================
RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.md,v
retrieving revision 1.23
retrieving revision 1.24
diff -c -r1.23 -r1.24
*** i370.md     6 Apr 2012 03:57:08 -0000       1.23
--- i370.md     6 Apr 2012 04:03:21 -0000       1.24
***************
*** 843,848 ****
--- 843,853 ----
        /*return \"STM  %1,%N1,%0\"; */
        return \"ST     %1,%0\;ST       %N1,4+%0\";
      }
+   if (GET_CODE (operands[1]) == CONST_INT)
+     {
+       mvs_check_page (0, 6, 8);
+       return \"MVC    %O0(8,%R0),%W1\";
+     }
    mvs_check_page (0, 6, 8);
    return \"MVC        %O0(8,%R0),%1\";
  }"

C:\devel\gcc\gcc\config\i370>


And it has had a good effect:

diff old/cpplib.s new/cpplib.s
1670c1670
<          MVC   120(8,13),=F'0'
---
>          MVC   120(8,13),=XL8'0000000000000000'
1796c1796
<          MVC   120(8,13),=F'0'
---
>          MVC   120(8,13),=XL8'0000000000000000'




However, I'm still stuck.  Because when I make this change:

C:\devel\gcc\gcc\config\i370>cvs diff -r 1.17 i370.h
Index: i370.h
===================================================================
RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -r1.17 -r1.18
599a600,602
> #define EXTRA_MEMORY_CONSTRAINT(C, STR) \
>   ((C) == 'S')
>

It triggers off a problem with plus:SI

C:\devel\gcc\gcc>stdcompm global.c

C:\devel\gcc\gcc>gccmvs -DUSE_MEMMGR -Os -S -DHAVE_CONFIG_H -DIN_GCC -DPUREISO
-
I ../../pdos/pdpclib -I . -I config/i370 -I ../include         global.c
global.c: In function `find_reg':
global.c:1325: error: unrecognizable insn:
(insn 2432 130 131 12 (set (reg:SI 15 15)
        (plus:SI (plus:SI (reg:SI 4 4 [orig:82 allocno ] [82])
                (reg:SI 3 3 [87]))
            (const_int 44 [0x2c]))) -1 (nil)
    (nil))
global.c:1325: internal compiler error: in ZZZ_680, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gccmvs.sourceforge.net> for instructions.

C:\devel\gcc\gcc>


Seems to be a problem when adding very small const_ints (in
the above case, 44) that can fit into a LA.  I tried to isolate
which plus:SI rule was causing the problem by commenting out these:

;
; addsi3 instruction pattern(s).
;
; The following insn is used when it is known that operand one is an
address,
; frame, stack or argument pointer, and operand two is a constant that is
; small enough to fit in the displacement field.
; Notice that we can't allow the frame pointer to used as a normal register
; because of this insn.
;

;(define_insn ""
;  [(set (match_operand:SI 0 "register_operand" "=d")
;^I(plus:SI (match_operand:SI 1 "general_operand" "%a")
;^I^I (match_operand:SI 2 "immediate_operand" "J")))]
;  "((REGNO (operands[1]) == FRAME_POINTER_REGNUM || REGNO (operands[1]) ==
ARG$
;  "*
;{
;  check_label_emit ();
;  CC_STATUS_INIT;  /* add assumes CC but LA doesn't set CC */
;  mvs_check_page (0, 4, 0);
;  return \"LA^I%0,%c2(,%1)\";
;}"
;   [(set_attr "length" "4")]
;)

;; The CC status bits for the arithmetic instructions are handled
;; in the NOTICE_UPDATE_CC macro (yeah???) and so they do not need
;; to be set below.  They only need to be invalidated if *not* set
;; (e.g. by BCTR) ... yeah I think that's right ...
;;

;(define_insn "addsi3"
;  [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
;^I(plus:SI (match_operand:SI 1 "general_operand" "%0")
;^I^I (match_operand:SI 2 "general_operand" "g")))]
;  ""
;  "*
;{
;  check_label_emit ();
;  if (REG_P (operands[2]))
;    {
;      mvs_check_page (0, 2, 0);
;      return \"AR^I%0,%2\";
;    }
;  if (GET_CODE (operands[2]) == CONST_INT)
;    {
;      if (INTVAL (operands[2]) == -1)
;^I{
;          CC_STATUS_INIT;  /* add assumes CC but BCTR doesn't set CC */
;^I  mvs_check_page (0, 2, 0);
;^I  return \"BCTR^I%0,0\";
;^I}
;    }
;  mvs_check_page (0, 4, 0);
;  return \"A^I%0,%2\";
;}"
;   [(set_attr "length" "4")]
;)


But that seemed to invoke some sort of bug in the main compiler:

C:\devel\gcc\gcc>stdcompm alias.c

C:\devel\gcc\gcc>gdb --args
gccmvs -DUSE_MEMMGR -Os -S -DHAVE_CONFIG_H -DIN_GCC
-DPUREISO -I ../../pdos/pdpclib -I . -I config/i370 -I ../include
alias.
c
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program:
/cygdrive/c/devel/gcc/gcc/gccmvs.exe -DUSE_MEMMGR -Os -S -DHAV
E_CONFIG_H -DIN_GCC -DPUREISO -I ../../pdos/pdpclib -I . -I config/i370 -I
../in
clude alias.c
Error: dll starting at 0x76901000 not found.
Error: dll starting at 0x761f1000 not found.
Error: dll starting at 0x76901000 not found.
Error: dll starting at 0x765f1000 not found.
Loaded symbols for /cygdrive/c/Windows/system32/ntdll.dll
Loaded symbols for /cygdrive/c/Windows/syswow64/kernel32.dll
Loaded symbols for /cygdrive/c/Windows/syswow64/KernelBase.dll

Program received signal SIGSEGV, Segmentation fault.
0x005fca41 in discover_flags_reg () at regmove.c:174
174       if (GET_CODE (tmp) == SET)
(gdb) where
#0  0x005fca41 in discover_flags_reg () at regmove.c:174
#1  0x005fdfd7 in regmove_optimize (f=0x1aaecc0, nregs=29,
    regmove_dump_file=0x0) at regmove.c:1056
#2  0x0064d6bc in rest_of_handle_regmove (decl=0x177a000, insns=0x1aaecc0)
    at toplev.c:2438
#3  0x0064f1af in ZZZ_1833 (decl=0x177a000) at toplev.c:3412
#4  0x00656061 in tree_rest_of_compilation (fndecl=0x177a000,
nested_p=false)
    at tree-optimize.c:168
#5  0x0043e6ec in c_expand_body_1 (fndecl=0x177a000, nested_p=0)
    at c-decl.c:6190
#6  0x0043e835 in ZZZ_331 (fndecl=0x177a000) at c-decl.c:6222
#7  0x00487dee in cgraph_expand_function (node=0x177ec3c) at
cgraphunit.c:538
#8  0x00489e7e in cgraph_expand_all_functions () at cgraphunit.c:1542
#9  0x0048a046 in cgraph_optimize () at cgraphunit.c:1607
#10 0x00447d75 in ZZZ_345 () at c-objc-common.c:240
#11 0x0044664b in ZZZ_708 () at c-lang.c:185
#12 0x0044947f in ZZZ_318 (set_yydebug=0) at c-opts.c:1270
#13 0x0064cd88 in compile_file () at toplev.c:1848
#14 0x00650f5a in do_compile () at toplev.c:4695
#15 0x00650ff5 in toplev_main (argc=26, argv=0xcc583c) at toplev.c:4735
#16 0x0054df47 in execute () at gcc.c:2785
#17 0x00551c59 in do_spec (
    spec=0x6a997c "%{E|M|MM:%(trad_capable_cpp) %(cpp_options)
%(cpp_debug_optio
ns)} %{!E:%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer
supports -tra
ditional without -E} %{save-temps|traditional-cpp|no-integr"...)
    at gcc.c:4265
#18 0x00556a1b in main (argc=16, argv=0x6e6920) at gcc.c:6437
(gdb)


/* Determine if the pattern generated by add_optab has a clobber,
   such as might be issued for a flags hard register.  To make the
   code elsewhere simpler, we handle cc0 in this same framework.

   Return the register if one was discovered.  Return NULL_RTX if
   if no flags were found.  Return pc_rtx if we got confused.  */

static rtx
discover_flags_reg (void)
{
  rtx tmp;
  tmp = gen_rtx_REG (word_mode, 10000);
  tmp = gen_add3_insn (tmp, tmp, GEN_INT (2));

  /* If we get something that isn't a simple set, or a
     [(set ..) (clobber ..)], this whole function will go wrong.  */
  if (GET_CODE (tmp) == SET)



I tried commenting out different plus:SI rules, but that also
met with a crash in the main compiler.

So I don't know which plus:SI is causing the problem, and
it seems very strange that the extra memory constraint
triggers off the problem.

Any ideas?

Thanks.  Paul.






-----Original Message----- 
From: Paul Edwards
Sent: Thursday, April 05, 2012 11:31 PM
To: Ulrich Weigand
Cc: gcc@gcc.gnu.org
Subject: Re: i370 port

Hi Ulrich.

I'm getting back to this after a long hiatus.

I have reviewed the 'W' code in PRINT_OPERAND:

else if (CODE == 'W')
  {
    /* hand-built sign-extension of signed 32-bit to 64-bit */
    mvs_page_lit += 8;
    if (0 <=  INTVAL (XV)) {
       fprintf (FILE, "=XL8'00000000");
    } else {
       fprintf (FILE, "=XL8'FFFFFFFF");
    }
    fprintf (FILE, "%08X'", INTVAL (XV));
  }

and it looks to me like it is already correct. If movdi is given a
const_int as a parameter, then sign-extending to 64-bit is
exactly what needs to happen, isn't it?

I'm only expecting to compile programs as 32-bit, so I'm not
expecting more than 32-bit integers. The IFOX assembler
won't do more than that. In case that's the issue.

But regardless I don't know how to make this code:

mvs_check_page (0, 6, 8);
return \"MVC^I%O0(8,%R0),%1\";

make use of that 'W' operand.

Do I change that %1 to %W1 perhaps?

I'll give that a try tomorrow.

Thanks.  Paul.





-----Original Message----- 
From: Ulrich Weigand
Sent: Monday, August 22, 2011 10:22 PM
To: Paul Edwards
Cc: gcc@gcc.gnu.org
Subject: Re: i370 port

Paul Edwards wrote:

>   if (operands[1] == const0_rtx)
>   {
>     CC_STATUS_INIT;
>     mvs_check_page (0, 6, 8);
>     return \"MVC    %O0(8,%R0),=XL8'00'\";
>   }
>   mvs_check_page (0, 6, 8);
>   return \"MVC    %O0(8,%R0),%1\";
> }"
>    [(set_attr "length" "8")]
> )
>
> forces it to use XL8'00' instead of the default F'0' and that
> seems to work.  Does that seem like a proper solution to
> you?

Well, there isn't really anything special about const0_rtx.
*Any* CONST_INT that shows up as second operand to the movdi
pattern must be emitted into an 8 byte literal at this point.

You can do that inline; but the more usual way would be to
define an operand print format that encodes the fact that
a 64-bit operand is requested.

In fact, looking at the i370.h PRINT_OPERAND, there already
seems to be such a format: 'W'.  (Maybe not quite; since 'W'
sign-extends a 32-bit operand to 64-bit.  But since 'W'
doesn't seem to be used anyway, maybe this can be changed.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com 

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2012-04-06  5:51 Paul Edwards
  0 siblings, 0 replies; 92+ messages in thread
From: Paul Edwards @ 2012-04-06  5:51 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

I have made this change:

C:\devel\gcc\gcc\config\i370>cvs diff -c -r 1.23 i370.md
Index: i370.md
===================================================================
RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.md,v
retrieving revision 1.23
retrieving revision 1.24
diff -c -r1.23 -r1.24
*** i370.md     6 Apr 2012 03:57:08 -0000       1.23
--- i370.md     6 Apr 2012 04:03:21 -0000       1.24
***************
*** 843,848 ****
--- 843,853 ----
        /*return \"STM  %1,%N1,%0\"; */
        return \"ST     %1,%0\;ST       %N1,4+%0\";
      }
+   if (GET_CODE (operands[1]) == CONST_INT)
+     {
+       mvs_check_page (0, 6, 8);
+       return \"MVC    %O0(8,%R0),%W1\";
+     }
    mvs_check_page (0, 6, 8);
    return \"MVC        %O0(8,%R0),%1\";
  }"

C:\devel\gcc\gcc\config\i370>


And it has had a good effect:

diff old/cpplib.s new/cpplib.s
1670c1670
<          MVC   120(8,13),=F'0'
---
>          MVC   120(8,13),=XL8'0000000000000000'
1796c1796
<          MVC   120(8,13),=F'0'
---
>          MVC   120(8,13),=XL8'0000000000000000'




However, I'm still stuck.  Because when I make this change:

C:\devel\gcc\gcc\config\i370>cvs diff -r 1.17 i370.h
Index: i370.h
===================================================================
RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -r1.17 -r1.18
599a600,602
> #define EXTRA_MEMORY_CONSTRAINT(C, STR) \
>   ((C) == 'S')
>

It triggers off a problem with plus:SI

C:\devel\gcc\gcc>stdcompm global.c

C:\devel\gcc\gcc>gccmvs -DUSE_MEMMGR -Os -S -DHAVE_CONFIG_H -DIN_GCC -DPUREISO 
 -
I ../../pdos/pdpclib -I . -I config/i370 -I ../include         global.c
global.c: In function `find_reg':
global.c:1325: error: unrecognizable insn:
(insn 2432 130 131 12 (set (reg:SI 15 15)
        (plus:SI (plus:SI (reg:SI 4 4 [orig:82 allocno ] [82])
                (reg:SI 3 3 [87]))
            (const_int 44 [0x2c]))) -1 (nil)
    (nil))
global.c:1325: internal compiler error: in ZZZ_680, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gccmvs.sourceforge.net> for instructions.

C:\devel\gcc\gcc>


Seems to be a problem when adding very small const_ints (in
the above case, 44) that can fit into a LA.  I tried to isolate
which plus:SI rule was causing the problem by commenting out these:

;
; addsi3 instruction pattern(s).
;
; The following insn is used when it is known that operand one is an 
address,
; frame, stack or argument pointer, and operand two is a constant that is
; small enough to fit in the displacement field.
; Notice that we can't allow the frame pointer to used as a normal register
; because of this insn.
;

;(define_insn ""
;  [(set (match_operand:SI 0 "register_operand" "=d")
;^I(plus:SI (match_operand:SI 1 "general_operand" "%a")
;^I^I (match_operand:SI 2 "immediate_operand" "J")))]
;  "((REGNO (operands[1]) == FRAME_POINTER_REGNUM || REGNO (operands[1]) == 
ARG$
;  "*
;{
;  check_label_emit ();
;  CC_STATUS_INIT;  /* add assumes CC but LA doesn't set CC */
;  mvs_check_page (0, 4, 0);
;  return \"LA^I%0,%c2(,%1)\";
;}"
;   [(set_attr "length" "4")]
;)

;; The CC status bits for the arithmetic instructions are handled
;; in the NOTICE_UPDATE_CC macro (yeah???) and so they do not need
;; to be set below.  They only need to be invalidated if *not* set
;; (e.g. by BCTR) ... yeah I think that's right ...
;;

;(define_insn "addsi3"
;  [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
;^I(plus:SI (match_operand:SI 1 "general_operand" "%0")
;^I^I (match_operand:SI 2 "general_operand" "g")))]
;  ""
;  "*
;{
;  check_label_emit ();
;  if (REG_P (operands[2]))
;    {
;      mvs_check_page (0, 2, 0);
;      return \"AR^I%0,%2\";
;    }
;  if (GET_CODE (operands[2]) == CONST_INT)
;    {
;      if (INTVAL (operands[2]) == -1)
;^I{
;          CC_STATUS_INIT;  /* add assumes CC but BCTR doesn't set CC */
;^I  mvs_check_page (0, 2, 0);
;^I  return \"BCTR^I%0,0\";
;^I}
;    }
;  mvs_check_page (0, 4, 0);
;  return \"A^I%0,%2\";
;}"
;   [(set_attr "length" "4")]
;)


But that seemed to invoke some sort of bug in the main compiler:

C:\devel\gcc\gcc>stdcompm alias.c

C:\devel\gcc\gcc>gdb --args 
gccmvs -DUSE_MEMMGR -Os -S -DHAVE_CONFIG_H -DIN_GCC
-DPUREISO -I ../../pdos/pdpclib -I . -I config/i370 -I ../include 
alias.
c
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: 
/cygdrive/c/devel/gcc/gcc/gccmvs.exe -DUSE_MEMMGR -Os -S -DHAV
E_CONFIG_H -DIN_GCC -DPUREISO -I ../../pdos/pdpclib -I . -I config/i370 -I 
../in
clude alias.c
Error: dll starting at 0x76901000 not found.
Error: dll starting at 0x761f1000 not found.
Error: dll starting at 0x76901000 not found.
Error: dll starting at 0x765f1000 not found.
Loaded symbols for /cygdrive/c/Windows/system32/ntdll.dll
Loaded symbols for /cygdrive/c/Windows/syswow64/kernel32.dll
Loaded symbols for /cygdrive/c/Windows/syswow64/KernelBase.dll

Program received signal SIGSEGV, Segmentation fault.
0x005fca41 in discover_flags_reg () at regmove.c:174
174       if (GET_CODE (tmp) == SET)
(gdb) where
#0  0x005fca41 in discover_flags_reg () at regmove.c:174
#1  0x005fdfd7 in regmove_optimize (f=0x1aaecc0, nregs=29,
    regmove_dump_file=0x0) at regmove.c:1056
#2  0x0064d6bc in rest_of_handle_regmove (decl=0x177a000, insns=0x1aaecc0)
    at toplev.c:2438
#3  0x0064f1af in ZZZ_1833 (decl=0x177a000) at toplev.c:3412
#4  0x00656061 in tree_rest_of_compilation (fndecl=0x177a000, 
nested_p=false)
    at tree-optimize.c:168
#5  0x0043e6ec in c_expand_body_1 (fndecl=0x177a000, nested_p=0)
    at c-decl.c:6190
#6  0x0043e835 in ZZZ_331 (fndecl=0x177a000) at c-decl.c:6222
#7  0x00487dee in cgraph_expand_function (node=0x177ec3c) at 
cgraphunit.c:538
#8  0x00489e7e in cgraph_expand_all_functions () at cgraphunit.c:1542
#9  0x0048a046 in cgraph_optimize () at cgraphunit.c:1607
#10 0x00447d75 in ZZZ_345 () at c-objc-common.c:240
#11 0x0044664b in ZZZ_708 () at c-lang.c:185
#12 0x0044947f in ZZZ_318 (set_yydebug=0) at c-opts.c:1270
#13 0x0064cd88 in compile_file () at toplev.c:1848
#14 0x00650f5a in do_compile () at toplev.c:4695
#15 0x00650ff5 in toplev_main (argc=26, argv=0xcc583c) at toplev.c:4735
#16 0x0054df47 in execute () at gcc.c:2785
#17 0x00551c59 in do_spec (
    spec=0x6a997c "%{E|M|MM:%(trad_capable_cpp) %(cpp_options) 
%(cpp_debug_optio
ns)} %{!E:%{!M:%{!MM: %{traditional|ftraditional:%eGNU C no longer 
supports -tra
ditional without -E} %{save-temps|traditional-cpp|no-integr"...)
    at gcc.c:4265
#18 0x00556a1b in main (argc=16, argv=0x6e6920) at gcc.c:6437
(gdb)


/* Determine if the pattern generated by add_optab has a clobber,
   such as might be issued for a flags hard register.  To make the
   code elsewhere simpler, we handle cc0 in this same framework.

   Return the register if one was discovered.  Return NULL_RTX if
   if no flags were found.  Return pc_rtx if we got confused.  */

static rtx
discover_flags_reg (void)
{
  rtx tmp;
  tmp = gen_rtx_REG (word_mode, 10000);
  tmp = gen_add3_insn (tmp, tmp, GEN_INT (2));

  /* If we get something that isn't a simple set, or a
     [(set ..) (clobber ..)], this whole function will go wrong.  */
  if (GET_CODE (tmp) == SET)



I tried commenting out different plus:SI rules, but that also
met with a crash in the main compiler.

So I don't know which plus:SI is causing the problem, and
it seems very strange that the extra memory constraint
triggers off the problem.

Any ideas?

Thanks.  Paul.






-----Original Message----- 
From: Paul Edwards
Sent: Thursday, April 05, 2012 11:31 PM
To: Ulrich Weigand
Cc: gcc@gcc.gnu.org
Subject: Re: i370 port

Hi Ulrich.

I'm getting back to this after a long hiatus.

I have reviewed the 'W' code in PRINT_OPERAND:

else if (CODE == 'W')
  {
    /* hand-built sign-extension of signed 32-bit to 64-bit */
    mvs_page_lit += 8;
    if (0 <=  INTVAL (XV)) {
       fprintf (FILE, "=XL8'00000000");
    } else {
       fprintf (FILE, "=XL8'FFFFFFFF");
    }
    fprintf (FILE, "%08X'", INTVAL (XV));
  }

and it looks to me like it is already correct. If movdi is given a
const_int as a parameter, then sign-extending to 64-bit is
exactly what needs to happen, isn't it?

I'm only expecting to compile programs as 32-bit, so I'm not
expecting more than 32-bit integers. The IFOX assembler
won't do more than that. In case that's the issue.

But regardless I don't know how to make this code:

mvs_check_page (0, 6, 8);
return \"MVC^I%O0(8,%R0),%1\";

make use of that 'W' operand.

Do I change that %1 to %W1 perhaps?

I'll give that a try tomorrow.

Thanks.  Paul.





-----Original Message----- 
From: Ulrich Weigand
Sent: Monday, August 22, 2011 10:22 PM
To: Paul Edwards
Cc: gcc@gcc.gnu.org
Subject: Re: i370 port

Paul Edwards wrote:

>   if (operands[1] == const0_rtx)
>   {
>     CC_STATUS_INIT;
>     mvs_check_page (0, 6, 8);
>     return \"MVC    %O0(8,%R0),=XL8'00'\";
>   }
>   mvs_check_page (0, 6, 8);
>   return \"MVC    %O0(8,%R0),%1\";
> }"
>    [(set_attr "length" "8")]
> )
>
> forces it to use XL8'00' instead of the default F'0' and that
> seems to work.  Does that seem like a proper solution to
> you?

Well, there isn't really anything special about const0_rtx.
*Any* CONST_INT that shows up as second operand to the movdi
pattern must be emitted into an 8 byte literal at this point.

You can do that inline; but the more usual way would be to
define an operand print format that encodes the fact that
a 64-bit operand is requested.

In fact, looking at the i370.h PRINT_OPERAND, there already
seems to be such a format: 'W'.  (Maybe not quite; since 'W'
sign-extends a 32-bit operand to 64-bit.  But since 'W'
doesn't seem to be used anyway, maybe this can be changed.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com 

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2011-08-20 10:09 Paul Edwards
  0 siblings, 0 replies; 92+ messages in thread
From: Paul Edwards @ 2011-08-20 10:09 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

And here is the same debug info as last time ...

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"

rtx
foo (rtx addr, int size, int n_refs)
{
  int offset = 0;

  switch (GET_CODE (addr))
    {
    case PRE_INC:
      offset = (n_refs + 1) * size;
      break;
    case PRE_DEC:
      offset = -(n_refs + 1) * size;
      break;
    case POST_INC:
      offset = n_refs * size;
      break;
    }

  if (offset)
    addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0),
                         GEN_INT (offset));
  else
    addr = XEXP (addr, 0);

  return addr;
}


         COPY  PDPTOP
         CSECT
* Program text area
         DS    0F
* X-func foo prologue
FOO      PDPPRLG CINDEX=0,FRAME=120,BASER=12,ENTRY=YES
         B     FEN0
         LTORG
FEN0     EQU   *
         DROP  12
         BALR  12,0
         USING *,12
PG0      EQU   *
         LR    11,1
         L     10,=A(PGT0)
* Function foo code
         MVC 112(8,13),=F'0'
         SLR   8,8
         SLR   9,9
         LR    6,8
         LR    7,9
         L     3,0(11)
         L     2,8(11)
         LH    4,0(3)
         N     4,=XL4'0000FFFF'
         ST    4,104(13)
         LA    5,110(0,0)
         CLR   4,5
         BE    L3
         BH    L6
         LA    15,109(0,0)
         CLR   4,15
         BE    L4
         B     L7
L6       EQU   *
         L     5,104(13)
         LA    4,112(0,0)
         CLR   5,4
         BE    L5
         B     L7
L3       EQU   *
         A     2,=F'1'
         L     15,4(11)
         ST    15,116(13)
         L     4,112(13)
         L     5,4+112(13)
         MR    4,2
         ST    4,112(13)
         ST    5,4+112(13)
         LR    2,5
         B     L2
L4       EQU   *
         X     2,=F'-1'
         L     9,4(11)
         MR    8,2
         LR    2,9
         B     L2
L5       EQU   *
         L     7,4(11)
         MR    6,2
         LR    2,7
L2       EQU   *
         LTR   2,2
         BE    L7
         MVC   88(4,13),=F'0'
         ST    2,92(13)
         LA    1,88(,13)
         L     15,=V(ZZZ@947)
         BALR  14,15
         MVC   88(4,13),=F'88'
         SLR   5,5
         IC    5,2(3)
         ST    5,92(13)
         MVC   96(4,13),4(3)
         ST    15,100(13)
         LA    1,88(,13)
         L     15,=V(ZZZ@957)
         BALR  14,15
         LR    3,15
         B     L8
L7       EQU   *
         L     3,4(3)
L8       EQU   *
         LR    15,3
* Function foo epilogue
         PDPEPIL
* Function foo literal pool
         DS    0F
         LTORG
* Function foo page table
         DS    0F
PGT0     EQU   *
         DC    A(PG0)
         END



;; Function foo

;; 8 regs to allocate: 37 28 29 31 (2) 35 (2) 34 (2) 26 27
;; 26 conflicts: 26 27 28 29 31 34 35 37 11 15
;; 27 conflicts: 26 27 28 31 34 35 37 11
;; 28 conflicts: 26 27 28 31 34 35 37 11
;; 29 conflicts: 26 29 11
;; 31 conflicts: 26 27 28 31 34 35 37 11
;; 34 conflicts: 26 27 28 31 34 35 37 11
;; 35 conflicts: 26 27 28 31 34 35 37 11
;; 37 conflicts: 26 27 28 31 34 35 37 11

Spilling for insn 3.
Spilling for insn 4.
Spilling for insn 5.
Spilling for insn 45.
Spilling for insn 46.
Using reg 15 for reload 0
Spilling for insn 48.
Using reg 4 for reload 0
Spilling for insn 50.
Using reg 4 for reload 0
Spilling for insn 55.
Using reg 4 for reload 0
Spilling for insn 19.
Spilling for insn 29.
Spilling for insn 37.
Spilling for insn 63.
Spilling for insn 64.
Spilling for insn 67.
Spilling for insn 71.
Using reg 2 for reload 0
Spilling for insn 72.
Spilling for insn 73.
Spilling for insn 80.
Register 37 now on stack.

Spilling for insn 3.
Spilling for insn 4.
Spilling for insn 5.
Spilling for insn 45.
Using reg 15 for reload 0
Spilling for insn 46.
Using reg 15 for reload 1
Using reg 4 for reload 0
Spilling for insn 48.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 50.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 55.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 19.
Spilling for insn 29.
Spilling for insn 37.
Spilling for insn 63.
Spilling for insn 64.
Spilling for insn 67.
Spilling for insn 71.
Using reg 2 for reload 0
Spilling for insn 72.
Spilling for insn 73.
Spilling for insn 80.
Register 31 now on stack.

Spilling for insn 113.
Spilling for insn 3.
Spilling for insn 4.
Spilling for insn 5.
Spilling for insn 45.
Using reg 4 for reload 0
Spilling for insn 46.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 48.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 50.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 55.
Using reg 4 for reload 1
Using reg 5 for reload 0
Spilling for insn 19.
Using reg 4 for reload 0
Spilling for insn 20.
Using reg 4 for reload 0
Spilling for insn 21.
Spilling for insn 29.
Spilling for insn 37.
Spilling for insn 63.
Spilling for insn 64.
Spilling for insn 67.
Spilling for insn 71.
Using reg 2 for reload 0
Spilling for insn 72.
Spilling for insn 73.
Spilling for insn 80.

Reloads for insn # 113
Reload 0: reload_out (DI) = (reg:DI 31 [ size ])
         NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (reg:DI 31 [ size ])

Reloads for insn # 3
Reload 0: reload_in (SI) = (mem/f:SI (reg/f:SI 11 11) [2 addr+0 S4 A32])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (mem/f:SI (reg/f:SI 11 11) [2 addr+0 S4 A32])

Reloads for insn # 5
Reload 0: reload_in (SI) = (mem/f:SI (plus:SI (reg/f:SI 11 11)
                                                        (const_int 8 [0x8])) 
[3 n_refs+0 S4 A32])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (mem/f:SI (plus:SI (reg/f:SI 11 11)
                                                        (const_int 8 [0x8])) 
[3 n_refs+0 S4 A32])

Reloads for insn # 45
Reload 0: reload_in (HI) = (mem/s:HI (reg/v/f:SI 3 3 [orig:26 addr ] [26]) 
[4 S2 A32])
         reload_out (SI) = (reg:SI 37)
         DATA_REGS, RELOAD_OTHER (opnum = 0)
         reload_in_reg: (mem/s:HI (reg/v/f:SI 3 3 [orig:26 addr ] [26]) [4 
S2 A32])
         reload_out_reg: (reg:SI 37)
         reload_reg_rtx: (reg:SI 4 4)

Reloads for insn # 46
Reload 0: reload_in (SI) = (reg:SI 37)
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 0)
         reload_in_reg: (reg:SI 37)
         reload_reg_rtx: (reg:SI 4 4)
Reload 1: reload_in (SI) = (const_int 110 [0x6e])
         ADDR_REGS, RELOAD_FOR_INPUT (opnum = 1)
         reload_in_reg: (const_int 110 [0x6e])
         reload_reg_rtx: (reg:SI 5 5)

Reloads for insn # 48
Reload 0: reload_in (SI) = (reg:SI 37)
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 0)
         reload_in_reg: (reg:SI 37)
         reload_reg_rtx: (reg:SI 4 4)
Reload 1: reload_in (SI) = (const_int 110 [0x6e])
         ADDR_REGS, RELOAD_FOR_INPUT (opnum = 1)
         reload_in_reg: (const_int 110 [0x6e])
         reload_reg_rtx: (reg:SI 5 5)

Reloads for insn # 50
Reload 0: reload_in (SI) = (reg:SI 37)
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 0)
         reload_in_reg: (reg:SI 37)
         reload_reg_rtx: (reg:SI 4 4)
Reload 1: reload_in (SI) = (const_int 109 [0x6d])
         ADDR_REGS, RELOAD_FOR_INPUT (opnum = 1)
         reload_in_reg: (const_int 109 [0x6d])
         reload_reg_rtx: (reg:SI 15 15)

Reloads for insn # 55
Reload 0: reload_in (SI) = (reg:SI 37)
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 0)
         reload_in_reg: (reg:SI 37)
         reload_reg_rtx: (reg:SI 5 5)
Reload 1: reload_in (SI) = (const_int 112 [0x70])
         ADDR_REGS, RELOAD_FOR_INPUT (opnum = 1)
         reload_in_reg: (const_int 112 [0x70])
         reload_reg_rtx: (reg:SI 4 4)

Reloads for insn # 19
Reload 0: reload_out (SI) = (subreg:SI (reg:DI 31 [ size ]) 4)
         DATA_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
         reload_out_reg: (subreg:SI (reg:DI 31 [ size ]) 4)
         reload_reg_rtx: (reg:SI 15 15)
Reload 1: reload_in (SI) = (reg/v:SI 27 [ size ])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (reg/v:SI 27 [ size ])

Reloads for insn # 20
Reload 0: reload_in (DI) = (reg:DI 31 [ size ])
         reload_out (DI) = (reg:DI 31 [ size ])
         DATA_REGS, RELOAD_OTHER (opnum = 0)
         reload_in_reg: (reg:DI 31 [ size ])
         reload_out_reg: (reg:DI 31 [ size ])
         reload_reg_rtx: (reg:DI 4 4)

Reloads for insn # 21
Reload 0: reload_in (SI) = (subreg:SI (reg:DI 31 [ size ]) 4)
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1)
         reload_in_reg: (subreg:SI (reg:DI 31 [ size ]) 4)
         reload_reg_rtx: (reg:SI 5 5)

Reloads for insn # 29
Reload 0: reload_in (SI) = (reg/v:SI 27 [ size ])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (reg/v:SI 27 [ size ])

Reloads for insn # 37
Reload 0: reload_in (SI) = (reg/v:SI 27 [ size ])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (reg/v:SI 27 [ size ])

Reloads for insn # 63
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 88 
[0x58])) [0 S4 A32])
         NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 88 
[0x58])) [0 S4 A32])

Reloads for insn # 64
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 92 
[0x5c])) [0 S4 A32])
         DATA_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 92 
[0x5c])) [0 S4 A32])

Reloads for insn # 67
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 88 
[0x58])) [0 S4 A32])
         NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 88 
[0x58])) [0 S4 A32])

Reloads for insn # 71
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 92 
[0x5c])) [0 S4 A32])
         DATA_REGS, RELOAD_OTHER (opnum = 0)
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 92 
[0x5c])) [0 S4 A32])
         reload_reg_rtx: (reg:SI 5 5)

Reloads for insn # 72
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 96 
[0x60])) [0 S4 A32])
         NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 96 
[0x60])) [0 S4 A32])

Reloads for insn # 73
Reload 0: reload_out (SI) = (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 100 
[0x64])) [0 S4 A32])
         DATA_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
         reload_out_reg: (mem/f:SI (plus:SI (reg/f:SI 13 13)
                                                        (const_int 100 
[0x64])) [0 S4 A32])

Reloads for insn # 80
Reload 0: reload_in (SI) = (mem/s:SI (plus:SI (reg/v/f:SI 3 3 [orig:26 
addr ] [26])
                                                        (const_int 4 [0x4])) 
[0 <variable>.rtx+0 S4 A32])
         DATA_REGS, RELOAD_FOR_INPUT (opnum = 1), optional
         reload_in_reg: (mem/s:SI (plus:SI (reg/v/f:SI 3 3 [orig:26 addr ] 
[26])
                                                        (const_int 4 [0x4])) 
[0 <variable>.rtx+0 S4 A32])
;; Register dispositions:
26 in 3  28 in 2  29 in 2  34 in 8  35 in 6

;; Hard regs used:  2 3 4 5 6 7 8 9 11 13 15

(note 2 0 96 NOTE_INSN_DELETED)

;; Start of basic block 0, registers live: 11 [11] 13 [13]
(note 96 2 113 0 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 113 96 114 0 (set (mem:DI (plus:SI (reg/f:SI 13 13)
                (const_int 112 [0x70])) [22 S8 A8])
        (const_int 0 [0x0])) 13 {*i370.md:786} (nil)
    (nil))

(insn 114 113 115 0 (set (reg:DI 8 8 [orig:34 size ] [34])
        (const_int 0 [0x0])) 13 {*i370.md:786} (nil)
    (nil))

(insn 115 114 3 0 (set (reg:DI 6 6 [orig:35 size ] [35])
        (const_int 0 [0x0])) 13 {*i370.md:786} (nil)
    (nil))

(insn 3 115 4 0 (set (reg/v/f:SI 3 3 [orig:26 addr ] [26])
        (mem/f:SI (reg/f:SI 11 11) [2 addr+0 S4 A32])) 15 {movsi} (nil)
    (expr_list:REG_EQUIV (mem/f:SI (reg/f:SI 11 11) [2 addr+0 S4 A32])
        (nil)))

(note 4 3 5 0 NOTE_INSN_DELETED)

(insn 5 4 6 0 (set (reg/v:SI 2 2 [orig:28 n_refs ] [28])
        (mem/f:SI (plus:SI (reg/f:SI 11 11)
                (const_int 8 [0x8])) [3 n_refs+0 S4 A32])) 15 {movsi} (nil)
    (expr_list:REG_EQUIV (mem/f:SI (plus:SI (reg/f:SI 11 11)
                (const_int 8 [0x8])) [3 n_refs+0 S4 A32])
        (nil)))

(note 6 5 44 0 NOTE_INSN_FUNCTION_BEG)

(note 44 6 117 0 NOTE_INSN_DELETED)

(insn 117 44 45 0 alias.c:15 (set (reg:HI 4 4)
        (mem/s:HI (reg/v/f:SI 3 3 [orig:26 addr ] [26]) [4 S2 A32])) 16 
{*i370.md:1004} (nil)
    (nil))

(insn 45 117 118 0 alias.c:15 (set (reg:SI 4 4)
        (zero_extend:SI (reg:HI 4 4))) 30 {zero_extendhisi2} (insn_list 3 
(nil))
    (nil))

(insn 118 45 119 0 alias.c:15 (set (mem:SI (plus:SI (reg/f:SI 13 13)
                (const_int 104 [0x68])) [21 S4 A8])
        (reg:SI 4 4)) 15 {movsi} (nil)
    (nil))

(insn 119 118 46 0 alias.c:15 (set (reg:SI 5 5)
        (const_int 110 [0x6e])) 15 {movsi} (nil)
    (nil))

(insn:QI 46 119 47 0 alias.c:15 (set (cc0)
        (compare (reg:SI 4 4)
            (reg:SI 5 5))) 5 {cmpsi} (insn_list 45 (nil))
    (nil))

(jump_insn 47 46 97 0 alias.c:15 (set (pc)
        (if_then_else (eq (cc0)
                (const_int 0 [0x0]))
            (label_ref 16)
            (pc))) 104 {beq} (nil)
    (expr_list:REG_BR_PROB (const_int 2900 [0xb54])
        (nil)))
;; End of basic block 0, registers live:
11 [11] 13 [13] 26 27 28 31 34 35 37

;; Start of basic block 1, registers live: 11 [11] 13 [13] 26 27 28 34 35 37
(note 97 47 48 1 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn:QI 48 97 49 1 alias.c:15 (set (cc0)
        (compare (reg:SI 4 4)
            (reg:SI 5 5))) 5 {cmpsi} (nil)
    (nil))

(jump_insn 49 48 98 1 alias.c:15 (set (pc)
        (if_then_else (gtu (cc0)
                (const_int 0 [0x0]))
            (label_ref 54)
            (pc))) 107 {bgtu} (nil)
    (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
;; End of basic block 1, registers live:
11 [11] 13 [13] 26 27 28 34 35 37

;; Start of basic block 2, registers live: 11 [11] 13 [13] 26 27 28 34 37
(note 98 49 120 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 120 98 50 2 alias.c:15 (set (reg:SI 15 15)
        (const_int 109 [0x6d])) 15 {movsi} (nil)
    (nil))

(insn:QI 50 120 51 2 alias.c:15 (set (cc0)
        (compare (reg:SI 4 4)
            (reg:SI 15 15))) 5 {cmpsi} (nil)
    (nil))

(jump_insn 51 50 99 2 alias.c:15 (set (pc)
        (if_then_else (eq (cc0)
                (const_int 0 [0x0]))
            (label_ref 25)
            (pc))) 104 {beq} (nil)
    (expr_list:REG_BR_PROB (const_int 2900 [0xb54])
        (nil)))
;; End of basic block 2, registers live:
11 [11] 13 [13] 26 27 28 34

;; Start of basic block 3, registers live: 11 [11] 13 [13] 26
(note 99 51 52 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(jump_insn 52 99 53 3 alias.c:15 (set (pc)
        (label_ref 78)) 126 {jump} (nil)
    (nil))
;; End of basic block 3, registers live:
11 [11] 13 [13] 26

(barrier 53 52 54)

;; Start of basic block 4, registers live: 11 [11] 13 [13] 26 27 28 35 37
(code_label 54 53 100 4 6 "" [1 uses])

(note 100 54 121 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 121 100 122 4 alias.c:15 (set (reg:SI 5 5)
        (mem:SI (plus:SI (reg/f:SI 13 13)
                (const_int 104 [0x68])) [21 S4 A8])) 15 {movsi} (nil)
    (nil))

(insn 122 121 55 4 alias.c:15 (set (reg:SI 4 4)
        (const_int 112 [0x70])) 15 {movsi} (nil)
    (nil))

(insn:QI 55 122 56 4 alias.c:15 (set (cc0)
        (compare (reg:SI 5 5)
            (reg:SI 4 4))) 5 {cmpsi} (nil)
    (nil))

(jump_insn 56 55 101 4 alias.c:15 (set (pc)
        (if_then_else (eq (cc0)
                (const_int 0 [0x0]))
            (label_ref 35)
            (pc))) 104 {beq} (nil)
    (expr_list:REG_BR_PROB (const_int 2900 [0xb54])
        (nil)))
;; End of basic block 4, registers live:
11 [11] 13 [13] 26 27 28 35

;; Start of basic block 5, registers live: 11 [11] 13 [13] 26
(note 101 56 57 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(jump_insn 57 101 58 5 alias.c:15 (set (pc)
        (label_ref 78)) 126 {jump} (nil)
    (nil))
;; End of basic block 5, registers live:
11 [11] 13 [13] 26

(barrier 58 57 16)

;; Start of basic block 6, registers live: 11 [11] 13 [13] 26 27 28 31
(code_label 16 58 102 6 3 "" [1 uses])

(note 102 16 17 6 [bb 6] NOTE_INSN_BASIC_BLOCK)

(note 17 102 18 6 ("alias.c") 15)

(insn 18 17 19 6 alias.c:15 (set (reg/v:SI 2 2 [orig:28 n_refs ] [28])
        (plus:SI (reg/v:SI 2 2 [orig:28 n_refs ] [28])
            (const_int 1 [0x1]))) 41 {addsi3} (nil)
    (nil))

(insn 19 18 123 6 alias.c:15 (set (reg:SI 15 15)
        (mem/f:SI (plus:SI (reg/f:SI 11 11)
                (const_int 4 [0x4])) [3 size+0 S4 A32])) 15 {movsi} (nil)
    (nil))

(insn 123 19 124 6 alias.c:15 (set (mem:SI (plus:SI (reg/f:SI 13 13)
                (const_int 116 [0x74])) [22 S4 A8])
        (reg:SI 15 15)) 15 {movsi} (nil)
    (nil))

(insn 124 123 20 6 alias.c:15 (set (reg:DI 4 4)
        (mem:DI (plus:SI (reg/f:SI 13 13)
                (const_int 112 [0x70])) [22 S8 A8])) 13 {*i370.md:786} (nil)
    (nil))

(insn 20 124 125 6 alias.c:15 (set (reg:DI 4 4)
        (mult:DI (reg:DI 4 4)
            (reg/v:SI 2 2 [orig:28 n_refs ] [28]))) 53 {*i370.md:2604} 
(insn_list 18 (insn_list 19 (nil)))
    (nil))

(insn 125 20 21 6 alias.c:15 (set (mem:DI (plus:SI (reg/f:SI 13 13)
                (const_int 112 [0x70])) [22 S8 A8])
        (reg:DI 4 4)) 13 {*i370.md:786} (nil)
    (nil))

(insn 21 125 22 6 alias.c:15 (set (reg/v:SI 2 2 [orig:29 offset ] [29])
        (reg:SI 5 5)) 15 {movsi} (insn_list 20 (nil))
    (expr_list:REG_EQUAL (mult:SI (reg:SI 30)
            (mem/f:SI (plus:SI (reg/f:SI 11 11)
                    (const_int 4 [0x4])) [3 size+0 S4 A32]))
        (nil)))

(note 22 21 23 6 ("alias.c") 16)

(jump_insn 23 22 24 6 alias.c:16 (set (pc)
        (label_ref 43)) 126 {jump} (nil)
    (nil))
;; End of basic block 6, registers live:
11 [11] 13 [13] 26 29

(barrier 24 23 25)

;; Start of basic block 7, registers live: 11 [11] 13 [13] 26 27 28 34
(code_label 25 24 103 7 4 "" [1 uses])

(note 103 25 26 7 [bb 7] NOTE_INSN_BASIC_BLOCK)

(note 26 103 27 7 ("alias.c") 18)

(note 27 26 28 7 NOTE_INSN_DELETED)

(insn 28 27 29 7 alias.c:18 (set (reg/v:SI 2 2 [orig:28 n_refs ] [28])
        (not:SI (reg/v:SI 2 2 [orig:28 n_refs ] [28]))) 86 {*i370.md:3685} 
(nil)
    (nil))

(insn 29 28 30 7 alias.c:18 (set (reg:SI 9 9 [orig:34 size+4 ] [34])
        (mem/f:SI (plus:SI (reg/f:SI 11 11)
                (const_int 4 [0x4])) [3 size+0 S4 A32])) 15 {movsi} (nil)
    (nil))

(insn 30 29 31 7 alias.c:18 (set (reg:DI 8 8 [orig:34 size ] [34])
        (mult:DI (reg:DI 8 8 [orig:34 size ] [34])
            (reg/v:SI 2 2 [orig:28 n_refs ] [28]))) 53 {*i370.md:2604} 
(insn_list 28 (insn_list 29 (nil)))
    (nil))

(insn 31 30 32 7 alias.c:18 (set (reg/v:SI 2 2 [orig:29 offset ] [29])
        (reg:SI 9 9 [orig:34 size+4 ] [34])) 15 {movsi} (insn_list 30 (nil))
    (expr_list:REG_EQUAL (mult:SI (reg:SI 33)
            (mem/f:SI (plus:SI (reg/f:SI 11 11)
                    (const_int 4 [0x4])) [3 size+0 S4 A32]))
        (nil)))

(note 32 31 33 7 ("alias.c") 19)

(jump_insn 33 32 34 7 alias.c:19 (set (pc)
        (label_ref 43)) 126 {jump} (nil)
    (nil))
;; End of basic block 7, registers live:
11 [11] 13 [13] 26 29

(barrier 34 33 35)

;; Start of basic block 8, registers live: 11 [11] 13 [13] 26 27 28 35
(code_label 35 34 104 8 5 "" [1 uses])

(note 104 35 36 8 [bb 8] NOTE_INSN_BASIC_BLOCK)

(note 36 104 37 8 ("alias.c") 21)

(insn 37 36 38 8 alias.c:21 (set (reg:SI 7 7 [orig:35 size+4 ] [35])
        (mem/f:SI (plus:SI (reg/f:SI 11 11)
                (const_int 4 [0x4])) [3 size+0 S4 A32])) 15 {movsi} (nil)
    (nil))

(insn 38 37 39 8 alias.c:21 (set (reg:DI 6 6 [orig:35 size ] [35])
        (mult:DI (reg:DI 6 6 [orig:35 size ] [35])
            (reg/v:SI 2 2 [orig:28 n_refs ] [28]))) 53 {*i370.md:2604} 
(insn_list 37 (nil))
    (nil))

(insn 39 38 40 8 alias.c:21 (set (reg/v:SI 2 2 [orig:29 offset ] [29])
        (reg:SI 7 7 [orig:35 size+4 ] [35])) 15 {movsi} (insn_list 38 (nil))
    (expr_list:REG_EQUAL (mult:SI (reg/v:SI 2 2 [orig:28 n_refs ] [28])
            (mem/f:SI (plus:SI (reg/f:SI 11 11)
                    (const_int 4 [0x4])) [3 size+0 S4 A32]))
        (nil)))
;; End of basic block 8, registers live:
11 [11] 13 [13] 26 29

(note 40 39 43 ("alias.c") 22)

;; Start of basic block 9, registers live: 11 [11] 13 [13] 26 29
(code_label 43 40 105 9 2 "" [2 uses])

(note 105 43 60 9 [bb 9] NOTE_INSN_BASIC_BLOCK)

(insn:QI 60 105 61 9 alias.c:22 (set (cc0)
        (reg/v:SI 2 2 [orig:29 offset ] [29])) 1 {tstsi} (nil)
    (nil))

(jump_insn 61 60 106 9 alias.c:22 (set (pc)
        (if_then_else (eq (cc0)
                (const_int 0 [0x0]))
            (label_ref 78)
            (pc))) 104 {beq} (nil)
    (expr_list:REG_BR_PROB (const_int 7000 [0x1b58])
        (nil)))
;; End of basic block 9, registers live:
11 [11] 13 [13] 26 29

;; Start of basic block 10, registers live: 11 [11] 13 [13] 26 29
(note 106 61 63 10 [bb 10] NOTE_INSN_BASIC_BLOCK)

(insn 63 106 64 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 88 [0x58])) [0 S4 A32])
        (const_int 0 [0x0])) 15 {movsi} (nil)
    (nil))

(insn 64 63 65 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 92 [0x5c])) [0 S4 A32])
        (reg/v:SI 2 2 [orig:29 offset ] [29])) 15 {movsi} (nil)
    (nil))

(call_insn 65 64 66 10 alias.c:22 (set (reg:SI 15 15)
        (call (mem:QI (symbol_ref/v:SI ("ZZZ_947") [flags 0x41] 
<function_decl c8c000 ZZZ_947>) [0 S1 A8])
            (const_int 8 [0x8]))) 132 {*i370.md:4869} (nil)
    (nil)
    (nil))

(note 66 65 67 10 NOTE_INSN_DELETED)

(insn 67 66 68 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 88 [0x58])) [0 S4 A32])
        (const_int 88 [0x58])) 15 {movsi} (nil)
    (nil))

(note 68 67 69 10 NOTE_INSN_DELETED)

(note 69 68 70 10 NOTE_INSN_DELETED)

(note 70 69 71 10 NOTE_INSN_DELETED)

(insn 71 70 126 10 alias.c:22 (set (reg:SI 5 5)
        (zero_extend:SI (mem/s:QI (plus:SI (reg/v/f:SI 3 3 [orig:26 addr ] 
[26])
                    (const_int 2 [0x2])) [4 S1 A16]))) 31 {zero_extendqisi2} 
(nil)
    (nil))

(insn 126 71 72 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 92 [0x5c])) [0 S4 A32])
        (reg:SI 5 5)) 15 {movsi} (nil)
    (nil))

(insn 72 126 73 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 96 [0x60])) [0 S4 A32])
        (mem/s:SI (plus:SI (reg/v/f:SI 3 3 [orig:26 addr ] [26])
                (const_int 4 [0x4])) [0 <variable>.rtx+0 S4 A32])) 15 
{movsi} (nil)
    (nil))

(insn 73 72 74 10 alias.c:22 (set (mem/f:SI (plus:SI (reg/f:SI 13 13)
                (const_int 100 [0x64])) [0 S4 A32])
        (reg:SI 15 15)) 15 {movsi} (insn_list 65 (nil))
    (nil))

(call_insn 74 73 75 10 alias.c:22 (set (reg:SI 15 15)
        (call (mem:QI (symbol_ref/v:SI ("ZZZ_957") [flags 0x41] 
<function_decl c63af8 ZZZ_957>) [0 S1 A8])
            (const_int 16 [0x10]))) 132 {*i370.md:4869} (nil)
    (nil)
    (nil))

(insn 75 74 76 10 alias.c:22 (set (reg/v/f:SI 3 3 [orig:26 addr ] [26])
        (reg:SI 15 15)) 15 {movsi} (insn_list 74 (nil))
    (nil))

(jump_insn 76 75 77 10 alias.c:22 (set (pc)
        (label_ref 81)) 126 {jump} (nil)
    (nil))
;; End of basic block 10, registers live:
11 [11] 13 [13] 26

(barrier 77 76 78)

;; Start of basic block 11, registers live: 11 [11] 13 [13] 26
(code_label 78 77 107 11 7 "" [3 uses])

(note 107 78 80 11 [bb 11] NOTE_INSN_BASIC_BLOCK)

(insn 80 107 81 11 alias.c:22 (set (reg/v/f:SI 3 3 [orig:26 addr ] [26])
        (mem/s:SI (plus:SI (reg/v/f:SI 3 3 [orig:26 addr ] [26])
                (const_int 4 [0x4])) [0 <variable>.rtx+0 S4 A32])) 15 
{movsi} (nil)
    (nil))
;; End of basic block 11, registers live:
11 [11] 13 [13] 26

;; Start of basic block 12, registers live: 11 [11] 13 [13] 26
(code_label 81 80 108 12 8 "" [1 uses])

(note 108 81 89 12 [bb 12] NOTE_INSN_BASIC_BLOCK)

(note 89 108 92 12 NOTE_INSN_FUNCTION_END)

(insn 92 89 95 12 alias.c:22 (set (reg/i:SI 15 15 [ <result> ])
        (reg/v/f:SI 3 3 [orig:26 addr ] [26])) 15 {movsi} (nil)
    (nil))

(insn 95 92 116 12 alias.c:22 (use (reg/i:SI 15 15 [ <result> ])) -1 
(insn_list 92 (nil))
    (nil))
;; End of basic block 12, registers live:
11 [11] 13 [13] 15 [15]

(note 116 95 0 NOTE_INSN_DELETED)

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2011-08-20  7:44 Paul Edwards
  0 siblings, 0 replies; 92+ messages in thread
From: Paul Edwards @ 2011-08-20  7:44 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

> (like the 8 byte move from F'0').  I'll do my own investigation
> of that and report that later.

Ok, the bad MVC:

MVC 112(8,13),=F'0'

is being generated by the movdi instruction:

;
; movdi instruction pattern(s).
;

(define_insn ""
  [(set (match_operand:DI 0 "nonimmediate_operand" "=d,m,S")
        (match_operand:DI 1 "general_operand" "g,d,SF"))]
;;  [(set (match_operand:DI 0 "r_or_s_operand" "=dS,m")
;;        (match_operand:DI 1 "r_or_s_operand" "diS*fF,d*fF"))]
  "TARGET_CHAR_INSTRUCTIONS"
  "*
{
...
  return \"MVC^I%O0(8,%R0),%1\";
}"

which looks correct to me.  The problem seems to be an =F'0' being
treated as a DI operand.

That extra memory constraint thing must be allowing this rogue
value through that was normally not picked up.

Any ideas?

Thanks.  Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2009-09-22 12:31 Paul Edwards
  0 siblings, 0 replies; 92+ messages in thread
From: Paul Edwards @ 2009-09-22 12:31 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

> I have a theory that if both displacements in the S-type (ie register plus
> displacement) address are non-zero, that something fails.  So the
> next thing I will do is see if I can detect just that situation, and stop
> it going into the CLC.

I now have that detection in place, and done a self-compile, and all
is looking great.  No idea if that is producing a technically correct
compiler or not though (ie whether my workaround correctly
bypasses all circumstances).

So that leaves 2 more workarounds which I would like to reverse
out.  I'll spend some time on them next.

BFN.  Paul.




;
; cmpmemsi instruction pattern(s).
;

(define_expand "cmpmemsi"
  [(set (match_operand:SI 0 "general_operand" "")
   (compare (match_operand:BLK 1 "general_operand" "")
     (match_operand:BLK 2 "general_operand" "")))
     (use (match_operand:SI 3 "general_operand" ""))
     (use (match_operand:SI 4 "" ""))]
   ""
   "
{
  rtx op1, op2;
  int iv1 = 0;
  int iv2 = 0;

  op1 = XEXP (operands[1], 0);
  if (GET_CODE (op1) == REG
      || (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1, 0)) == REG
   && GET_CODE (XEXP (op1, 1)) == CONST_INT
   && (unsigned) (iv1 = INTVAL (XEXP (op1, 1))) < 4096))
    {
      op1 = operands[1];
    }
  else
    {
      op1 = gen_rtx_MEM (BLKmode, copy_to_mode_reg (SImode, op1));
    }

  op2 = XEXP (operands[2], 0);
  if (GET_CODE (op2) == REG
      || (GET_CODE (op2) == PLUS && GET_CODE (XEXP (op2, 0)) == REG
   && GET_CODE (XEXP (op2, 1)) == CONST_INT
   && (unsigned) (iv2 = INTVAL (XEXP (op2, 1))) < 4096))
    {
      op2 = operands[2];
    }
  else
    {
      op2 = gen_rtx_MEM (BLKmode, copy_to_mode_reg (SImode, op2));
    }

  /* one circumstance has been found where this short comparison
     causes an internal error. Could be related to the fact that
     both displacements were non-zero, which is unusual. So check
     for that */
  if (((iv1 == 0) || (iv2 == 0)) &&
      GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) < 256)
    {
      emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2,
  gen_rtx_SET (VOIDmode, operands[0],
   gen_rtx_COMPARE (SImode, op1, op2)), /* was VOIDmode */
  gen_rtx_USE (VOIDmode, operands[3]))));
    }
  else
    {
        /* implementation suggested by  Richard Henderson <rth@cygnus.com> 
*/
        rtx reg1 = gen_reg_rtx (DImode);
        rtx reg2 = gen_reg_rtx (DImode);
        rtx result = operands[0];
        rtx mem1 = operands[1];
        rtx mem2 = operands[2];
        rtx len = operands[3];
        if (!CONSTANT_P (len))
          len = force_reg (SImode, len);

        /* Load up the address+length pairs.  */
        emit_insn (gen_rtx_CLOBBER (VOIDmode, reg1));
        emit_move_insn (gen_rtx_SUBREG (SImode, reg1, 0),
                        force_operand (XEXP (mem1, 0), NULL_RTX));
        emit_move_insn (gen_rtx_SUBREG (SImode, reg1, GET_MODE_SIZE 
(SImode)), len);

        emit_insn (gen_rtx_CLOBBER (VOIDmode, reg2));
        emit_move_insn (gen_rtx_SUBREG (SImode, reg2, 0),
                        force_operand (XEXP (mem2, 0), NULL_RTX));
        emit_move_insn (gen_rtx_SUBREG (SImode, reg2, GET_MODE_SIZE 
(SImode)), len);

        /* Compare! */
        emit_insn (gen_cmpmemsi_1 (result, reg1, reg2));
    }
  DONE;
}")

; Compare a block that is less than 256 bytes in length.

(define_insn ""
  [(set (match_operand:SI 0 "register_operand" "=d")
 (compare:SI (match_operand:BLK 1 "s_operand" "m")
   (match_operand:BLK 2 "s_operand" "m")))
   (use (match_operand:QI 3 "immediate_operand" "I"))]
  "((unsigned) INTVAL (operands[3]) < 256)"
  "*
{
  check_label_emit ();
  mvs_check_page (0, 22, 0);
  return \"CLC %O1(%c3,%R1),%2\;BH *+12\;BL *+6\;SLR %0,%0\;LNR %0,%0\";
}"
   [(set_attr "length" "22")]
)

; Compare a block that is larger than 255 bytes in length.
;        (mem:BLK (subreg:SI (match_operand:DI 1 "register_operand" "+d") 
0))
;        (mem:BLK (subreg:SI (match_operand:DI 2 "register_operand" "+d") 
0))))

(define_insn "cmpmemsi_1"
  [(set (match_operand:SI 0 "register_operand" "+d")
        (compare:SI
        (mem:BLK (match_operand:DI 1 "register_operand" "+d") )
        (mem:BLK (match_operand:DI 2 "register_operand" "+d") )))
   (use (match_dup 1))
   (use (match_dup 2))
   (clobber (match_dup 1))
   (clobber (match_dup 2))]
  ""
  "*
{
  check_label_emit ();
  mvs_check_page (0, 18, 0);
  return \"LA %0,1(0,0)\;CLCL %1,%2\;BH *+12\;BL *+6\;SLR %0,%0\;LNR 
%0,%0\";
}"
   [(set_attr "length" "18")]
)

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2009-09-09 22:33 Paul Edwards
  2009-09-14 15:42 ` Ulrich Weigand
  0 siblings, 1 reply; 92+ messages in thread
From: Paul Edwards @ 2009-09-09 22:33 UTC (permalink / raw)
  To: Joseph S. Myers, Ulrich Weigand; +Cc: gcc

> 2. I am unable to do an optimized compile even as a cross-compile,
> I get an internal error in this function:
> 
> gcse.c:
> 
> static void
> compute_hash_table_work (struct hash_table *table)
> {
> ...
>  if (!current_bb) /* +++ why are we getting NULL here? */

It appears I have misdiagnosed this.  The code will handle NULL
already.  Taking that out though, exposes this internal error:

int
i370_branch_dest (branch)
     rtx branch;
{
  rtx dest = SET_SRC (PATTERN (branch));
  int dest_uid;
  int dest_addr;

  /* first, compute the estimated address of the branch target */
  if (GET_CODE (dest) == IF_THEN_ELSE)
    dest = XEXP (dest, 1);
  dest = XEXP (dest, 0);
  /* +++ why is this becoming NULL? */
  if (!dest)
  {
      printf("internal error in branch dest\n");
      exit (0);
  }

which is obviously specific to the i370 port.  This code works fine on
3.2.3 though, so any idea what 3.4.6 changed to stop this from
working?

Thanks.  Paul.




  dest_uid = INSN_UID (dest);
  dest_addr = INSN_ADDRESSES (dest_uid);

  /* next, record the address of this insn as the true addr of first ref */
  {
     label_node_t *lp;
     rtx label = JUMP_LABEL (branch);
     int labelno = CODE_LABEL_NUMBER (label);

     if (!label || CODE_LABEL != GET_CODE (label)) abort ();

     lp = mvs_get_label (labelno);
     if (-1 == lp -> first_ref_page) lp->first_ref_page = mvs_page_num;
     just_referenced_page = lp->label_page;
  }
  return dest_addr;
}

^ permalink raw reply	[flat|nested] 92+ messages in thread
* Re: i370 port
@ 2009-08-23  8:50 Paul Edwards
  2009-08-26 22:13 ` Henrik Sorensen
  0 siblings, 1 reply; 92+ messages in thread
From: Paul Edwards @ 2009-08-23  8:50 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc

>> > How does this work?  ASM_FORMAT_PRIVATE_NAME is not supposed
>> > to completely ignore the NAME argument, the function may well
>> > be called with the same LABELNO but different NAME strings,
>> > and this must not result in conflicting symbols ...
>> 
>> I have compiled the entire GCC and not come up with any duplicate
>> static function names, so I think the number is always unique.
> 
> Hmm, I see that in the 3.2.x code base this is indeed true.
> However, in later compilers ASM_FORMAT_PRIVATE_NAME is used
> for other purposes by the middle-end, not just static function
> or variable names.  You definitely can get number collisions
> in later compilers ...

Well I've compiled and linked all of 3.4.6 without getting name
clashes either.

>> > At this point, you may refer to "current_function_decl" to
>> > retrieve information about the function currently being output.
>> > In particular, you can retrieve the original source-level name
>> > associated with the routine via DECL_NAME (current_function_decl).
>> 
>> Thanks a lot!  I couldn't use that directly, but this:
> 
> Why not?  

It was missing the IDENTIFIER_POINTER so getting a compile
error.

>  printf ("%s", IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
> 
> should work fine ...

Yes, I've adopted that, thanks.

Anyway, I've finally packaged all those changes discussed on the
list, and also creditted you in the documentation for your assistance
in polishing the product off.  Details in announcement below.

BFN.  Paul.






Jujitsu are pleased to announce the release of the
following software:

GCC 3.2.3 MVS 7.5 - GCC C compiler for z/OS, MVS/380, MVS/370.
Delivered in xmit format.

GCC 3.2.3 CMS 7.5 - GCC C compiler for z/VM, VM/380, VM/370.
Delivered in vmarc format.

PDPCLIB 2.00 - C (C90-compliant) runtime library for MVS 
(all flavours), CMS (all flavours), Windows 32, MSDOS, 
OS/2, Linux (new with this release), PDOS. Provided in
source form only, but also delivered as part of GCCMVS
and GCCCMS.

Hercules/380 3.06 v6.0 - Used to run MVS/380. It now does
S/380 even if you specify S/370, so that Hercgui will
work. Now has native support for ftp-rdw files (ie files
that have been transferred from z/OS using ftp with
the RDW option), so that you can quickly get your files
restored to a V dataset. Windows executables provided.
Unix users need to compile from source.

You can find the products at:

http://gccmvs.sourceforge.net
http://pdos.sourceforge.net
http://mvs380.sourceforge.net

(respectively).

Initial documentation can be found in gccmvs.txt,
pdpclib.txt and README.S380 respectively.

Any comments/questions please post over at:

http://tech.groups.yahoo.com/group/hercules-os380

where our complaint department is in operation 24
hours a day, even during Ramadan - may Allah have
mercy on our souls.

BFN.  Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread
* i370 port
@ 2009-06-05 12:45 Paul Edwards
  2009-06-05 14:33 ` Joseph S. Myers
  2009-06-05 15:21 ` Ulrich Weigand
  0 siblings, 2 replies; 92+ messages in thread
From: Paul Edwards @ 2009-06-05 12:45 UTC (permalink / raw)
  To: gcc

Hello GCC maintainers.

There used to be an i370 target for GCC.  It was written in 1989,
and put into GCC 2.5 in 1993.

It has always been semi-working, but never good enough to
actually use.

It was dropped from GCC 4 when there was supposedly no
maintainer available.  Actually, Dave Pitts and myself were
both maintaining it at that time, but we were both still working
on an old version of it (3.2). So gcc 3.4.6, circa 2004, was the
last time it was included in the normal GCC distribution.

We were both maintaining it, and continue to maintain it,
because MVS doesn't have any alternate free C compiler
available.

As of yesterday, after years of work, an i370 version was 
released that is now fully working.  The code generator has 
no known bugs that would stop it from being C90-compliant,
and GCC can fully regenerate itself, with full optimization.  

You can see it here:

http://gccmvs.sourceforge.net

It's based on GCC 3.2.3.

There is also a free i370 emulator (Hercules) and a free i370-based 
operating system (MVS/380) that enables the compiler to be fully 
tested and fully regenerate itself on its native environment.  Not
only that, but there is an effort underway to allow this free
environment to be made available on the internet so that Unix
users can do an MVS build (takes around 4 hours if done properly
- ie 3 stage, full optimization, on an emulated machine), from the 
safety of their Unix box.

Both of those products are also under active development by a
community of mainframe enthusiasts.

In addition, that code has been ported to GCC 3.4.6, which is now
working as a cross-compiler at least.  It's still some months away
from working natively though.  It takes a lot of effort to convert
the Posix-expecting GCC compiler into C90 compliance.  This has
been done though, in a way that has minimal code changes to the
GCC mainline.

There is a lot of other activity (e.g. availability of REXX, PL/1, Cobol)
that rests on the C compiler being available.

So, my question is - what is required to get the i370 port reinstated
into the GCC mainline?

Yes, I'm aware that there is an S/390 port, but it isn't EBCDIC, isn't
HLASM, isn't 370, isn't C90, isn't MVS.  It may well be possible to
change all those things, and I suspect that in a few years from now
I may be sending another message asking what I need to do to get 
all my changes to the s390 target into the s390 target.  At that time,
I suspect there will be a lot of objection to "polluting" the s390 target
with all those "unnecessary" things.

So, here's hoping that the i370 port can end up where it was originally
intended to end up, and that all the effort that was spent in the GCC
mainline to get rid of the ASCII assumptions can now be put to good
use.

BFN.  Paul.

^ permalink raw reply	[flat|nested] 92+ messages in thread

end of thread, other threads:[~2017-03-31 10:34 UTC | newest]

Thread overview: 92+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-20 12:15 i370 port Paul Edwards
2011-08-22 12:23 ` Ulrich Weigand
2012-04-05 13:32   ` Paul Edwards
2012-04-06 18:13     ` Ulrich Weigand
  -- strict thread matches above, loose matches on Subject: below --
2014-02-13  4:23 Paul Edwards
2012-04-07  5:45 Paul Edwards
2012-04-08 17:43 ` Ulrich Weigand
2014-02-11 17:01   ` Paul Edwards
2012-04-06 12:49 Paul Edwards
2012-04-06 18:16 ` Ulrich Weigand
2012-04-07  4:12   ` Paul Edwards
2012-04-06  5:51 Paul Edwards
2011-08-20 10:09 Paul Edwards
2011-08-20  7:44 Paul Edwards
2009-09-22 12:31 Paul Edwards
2009-09-09 22:33 Paul Edwards
2009-09-14 15:42 ` Ulrich Weigand
2009-09-15 12:59   ` Paul Edwards
2009-09-15 13:51     ` Ulrich Weigand
2009-09-17 13:00       ` Paul Edwards
2009-09-17 17:55         ` Ulrich Weigand
2009-09-18  0:35           ` Paul Edwards
2009-09-18 12:06             ` Ulrich Weigand
2009-09-18 12:23               ` Paul Edwards
2009-09-18 13:27                 ` Ulrich Weigand
2009-09-18 13:42                   ` Paul Edwards
2009-09-18 16:08                     ` Ulrich Weigand
2009-09-19 12:57                       ` Paul Edwards
2009-09-25 10:19                       ` Paul Edwards
2009-09-25 15:20                         ` Ulrich Weigand
2009-11-04  5:21                       ` Paul Edwards
2009-11-04 16:47                         ` Ulrich Weigand
2009-11-09 14:55                           ` Paul Edwards
2009-11-09 15:57                             ` Ian Lance Taylor
2009-11-09 23:10                               ` Paul Edwards
2009-11-10 14:58                               ` Paul Edwards
2009-11-10 15:36                                 ` Ian Lance Taylor
2009-11-10 15:51                               ` Paul Edwards
2009-11-10 15:56                                 ` Ian Lance Taylor
2009-12-02 22:03                                   ` Paul Edwards
2011-08-13  8:34                           ` Paul Edwards
2011-08-15 14:32                             ` Ulrich Weigand
2011-08-15 15:26                               ` Paul Edwards
2011-08-15 17:23                                 ` Ulrich Weigand
2011-08-16 11:20                                   ` Paul Edwards
2011-08-16 13:26                                     ` Ulrich Weigand
2011-08-18 12:15                                       ` Paul Edwards
2011-08-18 13:14                                         ` Ulrich Weigand
2011-08-18 14:18                                           ` Paul Edwards
2009-08-23  8:50 Paul Edwards
2009-08-26 22:13 ` Henrik Sorensen
2009-06-05 12:45 Paul Edwards
2009-06-05 14:33 ` Joseph S. Myers
2009-06-05 14:57   ` Paul Edwards
2009-06-05 15:03     ` Joseph S. Myers
2009-06-05 15:24       ` Paul Edwards
2009-06-05 15:47         ` Joseph S. Myers
2017-03-31 10:34       ` Paul Edwards
2009-09-12 12:41   ` Paul Edwards
2009-06-05 15:21 ` Ulrich Weigand
2009-06-05 15:39   ` Paul Edwards
2009-06-05 15:49     ` Daniel Jacobowitz
2009-06-05 15:57       ` Paul Edwards
2009-06-05 20:20         ` Joseph S. Myers
2009-06-05 20:45           ` Paul Edwards
2009-06-06 15:00       ` Paul Edwards
2009-06-15 17:46         ` Ulrich Weigand
2009-06-19  0:06           ` Paul Edwards
2009-06-19 12:28             ` Ulrich Weigand
2009-07-18 11:28               ` Paul Edwards
2009-07-20 14:27                 ` Ulrich Weigand
2009-08-08 12:04                   ` Paul Edwards
2009-08-10 21:25                     ` Ulrich Weigand
2009-08-11  0:34                       ` Paul Edwards
2009-08-11 15:21                         ` Ulrich Weigand
2009-08-12 11:52                           ` Paul Edwards
2009-08-12 15:27                             ` Paolo Bonzini
2009-08-12 16:35                             ` Ulrich Weigand
2009-08-12 17:27                               ` Paul Edwards
2009-08-12 17:56                                 ` Paolo Bonzini
2009-08-12 19:46                                 ` Ulrich Weigand
2009-08-12 20:31                                   ` Paul Edwards
2009-08-19 12:07                               ` Paul Edwards
2009-08-19 12:27                                 ` Paolo Bonzini
2009-08-20 12:49                               ` Paul Edwards
2009-08-20 22:48                                 ` Ulrich Weigand
2009-08-21  2:37                                   ` Paul Edwards
2009-08-21 16:46                                     ` Ulrich Weigand
2009-06-05 15:44   ` Joseph S. Myers
2009-06-05 15:52     ` Paul Edwards
2009-09-08 15:55     ` Paul Edwards
2009-09-14 15:32       ` Ulrich Weigand

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).