Optimizer questions/issues with EBCDIC i370/s390 modes.

Dave Pitts dpitts@cozx.com
Wed Aug 21 13:51:00 GMT 2002


Hello:

I've a few questions concerning the operation of the optimizer when cross
compiling on an ASCII based system for an EBCDIC based system. These
things work correctly when compiling natively on an EBCDIC system. I'm
using the 3.2 release with my i370 changes.

1. Short string literals are converted to integers (CONST_INT) are not
converted to EBCDIC.

Code like:

   strcpy (foo, ":");

generates:

   L    2, =A(FOO)
   MVC    0(2,2),=H'11776'

The value 11776 is the ASCII values for ':' and null. I've looked 
through the
source and I can't  locate where this is being done.

2. Outputing of constant strings with printf are converted to puts when 
running
native.

Code like:

   printf ("some printed stuff\n");

generates natively:

LC01    EQU    *
   DC C'some printed stuff'
   DC    X'0'
...
   MVC 148(4,13),=A(LC01)
   LA    1,148(13)
   L    15,=V(PUTS)
   BALR    14,15

generates on cross compile:

LC01    EQU    *
   DC C'some printed stuff'
   DC    X'15'            EBCDIC NEWLINE
   DC    X'0'
...
   MVC 148(4,13),=A(LC01)
   LA    1,148(13)
   L    15,=V(PRINTF)
   BALR    14,15

It appears that the optimizer is looking for a native \n and not 
TARGET_NEWLINE.


3. This fails in both native and cross compile modes. The macros in 
longlong.h for
the i370 appear to fail when compiling _udiv_w_sdiv:

./xgcc -B./ -B/usr/local/i370-ibm-openedition/bin/ -isystem 
/usr/local/i370-ibm-openedition/include -isystem 
/usr/local/i370-ibm-openedition/sys-include -S -O2  -DIN_GCC 
-DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -isystem ./include     -DIN_LIBGCC2 
-D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc-3.2/gcc 
-I../../gcc-3.2/gcc/. -I../../gcc-3.2/gcc/config 
-I../../gcc-3.2/gcc/../include  -DL_udiv_w_sdiv -c 
../../gcc-3.2/gcc/libgcc2.c -fexceptions -fnon-call-exceptions -o 
libgcc/./_udiv_w_sdiv.o
../../gcc-3.2/gcc/libgcc2.c: In function `__udiv_w_sdiv':
../../gcc-3.2/gcc/libgcc2.c:403: `asm' operand requires impossible reload
../../gcc-3.2/gcc/libgcc2.c:427: `asm' operand requires impossible reload
make[1]: *** [libgcc/./_udiv_w_sdiv.o] Error 1

What causes and "impossible reload"?

The longlong.h code fragment is:

#if (defined (__i370__) || defined (__mvs__)) && W_TYPE_SIZE == 32
#define umul_ppmm(xh, xl, m0, m1) \
 do {                                                                  \
   union {UDItype __ll;                                                \
          struct {USItype __h, __l;} __i;                              \
         } __xx;                                                       \
   USItype __m0 = (m0), __m1 = (m1);                                   \
   __asm__ ("mr %0,%3"                                                 \
            : "=r" (__xx.__i.__h),                                     \
              "=r" (__xx.__i.__l)                                      \
            : "%1" (__m0),                                             \
              "r" (__m1));                                             \
   (xh) = __xx.__i.__h; (xl) = __xx.__i.__l;                           \
   (xh) += ((((SItype) __m0 >> 31) & __m1)                             \
            + (((SItype) __m1 >> 31) & __m0));                         \
 } while (0)
#define smul_ppmm(xh, xl, m0, m1) \
 do {                                                                  \
   union {DItype __ll;                                                 \
          struct {USItype __h, __l;} __i;                              \
         } __xx;                                                       \
   __asm__ ("mr %0,%3"                                                 \
            : "=r" (__xx.__i.__h),                                     \
              "=r" (__xx.__i.__l)                                      \
            : "%1" (m0),                                               \
              "r" (m1));                                               \
   (xh) = __xx.__i.__h; (xl) = __xx.__i.__l;                           \
 } while (0)
#define sdiv_qrnnd(q, r, n1, n0, d) \
 do {                                                                  \
   union {DItype __ll;                                                 \
          struct {USItype __h, __l;} __i;                              \
         } __xx;                                                       \
   __xx.__i.__h = n1; __xx.__i.__l = n0;                               \
   __asm__ ("dr %0,%2"                                                 \
            : "=r" (__xx.__ll)                                         \
            : "0" (__xx.__ll), "r" (d));                               \
   (q) = __xx.__i.__l; (r) = __xx.__i.__h;                             \
 } while (0)
#endif

What is this code doing? I didn't write it and I'm unfamiliar with the
syntax.

Thanks in advance.

--
Dave Pitts                   PULLMAN: Travel and sleep in safety and comfort.
dpitts@cozx.com              My other RV IS a Pullman (Colorado Pine). 
http://www.cozx.com/~dpitts






More information about the Gcc mailing list