This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cfg merge part 19 - gcse tweek
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, law at redhat dot com
- Date: Thu, 06 Jun 2002 13:42:02 +0100
- Subject: Re: cfg merge part 19 - gcse tweek
- Organization: SuperH UK Ltd.
> Hi,
> this is small patch from cfg-branch. It's purpose is to make gcse to drop
> REG_EQUAL note when it GCSEes out the real computation so the local passes
> won't lose track of what is going on.
> It helps to avoid negative results of my next GCSE patch to switch it
> into code hoisting functions (that patch needs liveness that is still
> discussed), but anyway this has small positive effect.
> Bootstrapped/regtested i386.
> Honza
> Mon May 27 13:53:16 CEST 2002 Jan Hubicka <jh@suse.cz>
> * gcse.c (gcse_emit_move_after): New.
> (pre_delete, hoist_store): Use it.
You delete the check to verify that the change is valid. I don't see any
code that you have added to check validity before. Worse, instead of
changing an instruction that is already valid, you generate an ad-hoc
instruction pattern, altogether ignoring the machine description.
Your patch break the SH newlib build; the first file that fails to build is
newlib/libm/math/ef_jn.c for -m3e
To reproduce the problem, you can compile the attached preprocessed file with
the options:
-fpreprocessed ef_jn.i -quiet -dumpbase ef_jn.c -m3e -g -O2 -version
-fno-builtin -o ef_jn.s
The problem is that gcse_emit_move_after, called from pre_delete creates an
instruction:
(insn 858 467 468 25 (nil) (set (reg/v:SF 210)
(reg:SF 258)) -1 (nil)
(nil))
If you are trying to generate a move insn that 'just works', I suggest you look
at
gen_move_insn.
--
--------------------------
SuperH
2430 Aztec West / Almondsbury / BRISTOL / BS32 4AQ
T:+44 1454 462330
# 1 "../../../../../../srcw/newlib/libm/math/ef_jn.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "../../../../../../srcw/newlib/libm/math/ef_jn.c"
# 16 "../../../../../../srcw/newlib/libm/math/ef_jn.c"
# 1 "../../../../../../srcw/newlib/libm/common/fdlibm.h" 1
# 15 "../../../../../../srcw/newlib/libm/common/fdlibm.h"
# 1 "/export/home/build/srcw/newlib/libc/include/math.h" 1 3 4
# 9 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
# 1 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 1 3 4
# 13 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
# 1 "/export/home/build/srcw/newlib/libc/include/_ansi.h" 1 3 4
# 15 "/export/home/build/srcw/newlib/libc/include/_ansi.h" 3 4
# 1 "/export/home/build/srcw/newlib/libc/include/sys/config.h" 1 3 4
# 133 "/export/home/build/srcw/newlib/libc/include/sys/config.h" 3 4
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
# 167 "/export/home/build/srcw/newlib/libc/include/sys/config.h" 3 4
typedef int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef long long __int64_t;
__extension__ typedef unsigned long long __uint64_t;
# 16 "/export/home/build/srcw/newlib/libc/include/_ansi.h" 2 3 4
# 14 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 2 3 4
# 1 "/export/home/build/srcw/newlib/libc/include/sys/_types.h" 1 3 4
# 12 "/export/home/build/srcw/newlib/libc/include/sys/_types.h" 3 4
typedef long _off_t;
typedef long _ssize_t;
# 15 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 2 3 4
typedef unsigned long __ULong;
# 36 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct _glue
{
struct _glue *_next;
int _niobs;
struct __sFILE *_iobs;
};
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
# 71 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void);
void *_fnargs[32];
__uint32_t _fntypes;
};
# 94 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct __sbuf {
unsigned char *_base;
int _size;
};
typedef long _fpos_t;
# 155 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void * _cookie;
int (*_read) (void * _cookie, char *_buf, int _n);
int (*_write) (void * _cookie, const char *_buf, int _n);
_fpos_t (*_seek) (void * _cookie, _fpos_t _offset, int _whence);
int (*_close) (void * _cookie);
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
int _offset;
struct _reent *_data;
};
# 219 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
# 437 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
struct _reent
{
int _errno;
struct __sFILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _current_category;
const char *_current_locale;
int __sdidinit;
void (*__cleanup) (struct _reent *);
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
int _mblen_state;
int _mbtowc_state;
int _wctomb_state;
char _l64a_buf[8];
} _reent;
struct
{
unsigned char * _nextf[30];
unsigned int _nmalloc[30];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**(_sig_func))(int);
struct _glue __sglue;
struct __sFILE __sf[3];
};
# 603 "/export/home/build/srcw/newlib/libc/include/sys/reent.h" 3 4
extern struct _reent *_impure_ptr ;
void _reclaim_reent (struct _reent *);
# 10 "/export/home/build/srcw/newlib/libc/include/math.h" 2 3 4
# 1 "/export/home/build/srcw/newlib/libc/include/machine/ieeefp.h" 1 3 4
# 11 "/export/home/build/srcw/newlib/libc/include/math.h" 2 3 4
union __dmath
{
__uint32_t i[2];
double d;
};
extern const union __dmath __infinity[];
# 36 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
extern double atan (double);
extern double cos (double);
extern double sin (double);
extern double tan (double);
extern double tanh (double);
extern double frexp (double, int *);
extern double modf (double, double *);
extern double ceil (double);
extern double fabs (double);
extern double floor (double);
extern double acos (double);
extern double asin (double);
extern double atan2 (double, double);
extern double cosh (double);
extern double sinh (double);
extern double exp (double);
extern double ldexp (double, int);
extern double log (double);
extern double log10 (double);
extern double pow (double, double);
extern double sqrt (double);
extern double fmod (double, double);
extern double infinity (void);
extern double nan (void);
extern int isnan (double);
extern int isinf (double);
extern int finite (double);
extern double copysign (double, double);
extern int ilogb (double);
extern double asinh (double);
extern double cbrt (double);
extern double nextafter (double, double);
extern double rint (double);
extern double scalbn (double, int);
extern double log1p (double);
extern double expm1 (double);
extern double acosh (double);
extern double atanh (double);
extern double remainder (double, double);
extern double gamma (double);
extern double gamma_r (double, int *);
extern double lgamma (double);
extern double lgamma_r (double, int *);
extern double erf (double);
extern double erfc (double);
extern double y0 (double);
extern double y1 (double);
extern double yn (int, double);
extern double j0 (double);
extern double j1 (double);
extern double jn (int, double);
extern double hypot (double, double);
extern double cabs();
extern double drem (double, double);
# 123 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
extern float atanf (float);
extern float cosf (float);
extern float sinf (float);
extern float tanf (float);
extern float tanhf (float);
extern float frexpf (float, int *);
extern float modff (float, float *);
extern float ceilf (float);
extern float fabsf (float);
extern float floorf (float);
extern float acosf (float);
extern float asinf (float);
extern float atan2f (float, float);
extern float coshf (float);
extern float sinhf (float);
extern float expf (float);
extern float ldexpf (float, int);
extern float logf (float);
extern float log10f (float);
extern float powf (float, float);
extern float sqrtf (float);
extern float fmodf (float, float);
# 155 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
extern float infinityf (void);
extern float nanf (void);
extern int isnanf (float);
extern int isinff (float);
extern int finitef (float);
extern float copysignf (float, float);
extern int ilogbf (float);
extern float asinhf (float);
extern float cbrtf (float);
extern float nextafterf (float, float);
extern float rintf (float);
extern float scalbnf (float, int);
extern float log1pf (float);
extern float expm1f (float);
extern float acoshf (float);
extern float atanhf (float);
extern float remainderf (float, float);
extern float gammaf (float);
extern float gammaf_r (float, int *);
extern float lgammaf (float);
extern float lgammaf_r (float, int *);
extern float erff (float);
extern float erfcf (float);
extern float y0f (float);
extern float y1f (float);
extern float ynf (int, float);
extern float j0f (float);
extern float j1f (float);
extern float jnf (int, float);
extern float hypotf (float, float);
extern float cabsf();
extern float dremf (float, float);
extern int *__signgam (void);
# 208 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
struct exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
int err;
};
extern int matherr (struct exception *e);
# 261 "/export/home/build/srcw/newlib/libc/include/math.h" 3 4
enum __fdlibm_version
{
__fdlibm_ieee = -1,
__fdlibm_svid,
__fdlibm_xopen,
__fdlibm_posix
};
extern const enum __fdlibm_version __fdlib_version;
# 16 "../../../../../../srcw/newlib/libm/common/fdlibm.h" 2
# 140 "../../../../../../srcw/newlib/libm/common/fdlibm.h"
extern double logb (double);
extern double scalb (double, double);
extern double significand (double);
extern double __ieee754_sqrt (double);
extern double __ieee754_acos (double);
extern double __ieee754_acosh (double);
extern double __ieee754_log (double);
extern double __ieee754_atanh (double);
extern double __ieee754_asin (double);
extern double __ieee754_atan2 (double,double);
extern double __ieee754_exp (double);
extern double __ieee754_cosh (double);
extern double __ieee754_fmod (double,double);
extern double __ieee754_pow (double,double);
extern double __ieee754_lgamma_r (double,int *);
extern double __ieee754_gamma_r (double,int *);
extern double __ieee754_log10 (double);
extern double __ieee754_sinh (double);
extern double __ieee754_hypot (double,double);
extern double __ieee754_j0 (double);
extern double __ieee754_j1 (double);
extern double __ieee754_y0 (double);
extern double __ieee754_y1 (double);
extern double __ieee754_jn (int,double);
extern double __ieee754_yn (int,double);
extern double __ieee754_remainder (double,double);
extern __int32_t __ieee754_rem_pio2 (double,double*);
extern double __ieee754_scalb (double,double);
extern double __kernel_standard (double,double,int);
extern double __kernel_sin (double,double,int);
extern double __kernel_cos (double,double);
extern double __kernel_tan (double,double,int);
extern int __kernel_rem_pio2 (double*,double*,int,int,int,const __int32_t*);
extern float logbf (float);
extern float scalbf (float, float);
extern float significandf (float);
extern float __ieee754_sqrtf (float);
extern float __ieee754_acosf (float);
extern float __ieee754_acoshf (float);
extern float __ieee754_logf (float);
extern float __ieee754_atanhf (float);
extern float __ieee754_asinf (float);
extern float __ieee754_atan2f (float,float);
extern float __ieee754_expf (float);
extern float __ieee754_coshf (float);
extern float __ieee754_fmodf (float,float);
extern float __ieee754_powf (float,float);
extern float __ieee754_lgammaf_r (float,int *);
extern float __ieee754_gammaf_r (float,int *);
extern float __ieee754_log10f (float);
extern float __ieee754_sinhf (float);
extern float __ieee754_hypotf (float,float);
extern float __ieee754_j0f (float);
extern float __ieee754_j1f (float);
extern float __ieee754_y0f (float);
extern float __ieee754_y1f (float);
extern float __ieee754_jnf (int,float);
extern float __ieee754_ynf (int,float);
extern float __ieee754_remainderf (float,float);
extern __int32_t __ieee754_rem_pio2f (float,float*);
extern float __ieee754_scalbf (float,float);
extern float __kernel_sinf (float,float,int);
extern float __kernel_cosf (float,float);
extern float __kernel_tanf (float,float,int);
extern int __kernel_rem_pio2f (float*,float*,int,int,int,const __int32_t*);
# 254 "../../../../../../srcw/newlib/libm/common/fdlibm.h"
typedef union
{
double value;
struct
{
__uint32_t msw;
__uint32_t lsw;
} parts;
} ieee_double_shape_type;
# 341 "../../../../../../srcw/newlib/libm/common/fdlibm.h"
typedef union
{
float value;
__uint32_t word;
} ieee_float_shape_type;
# 17 "../../../../../../srcw/newlib/libm/math/ef_jn.c" 2
static const float
invsqrtpi= 5.6418961287e-01,
two = 2.0000000000e+00,
one = 1.0000000000e+00;
static const float zero = 0.0000000000e+00;
float __ieee754_jnf(int n, float x)
{
__int32_t i,hx,ix, sgn;
float a, b, temp, di;
float z, w;
do { ieee_float_shape_type gf_u; gf_u.value = (x); (hx) = gf_u.word; } while (0);
ix = 0x7fffffff&hx;
if(((ix)>0x7f800000L)) return x+x;
if(n<0){
n = -n;
x = -x;
hx ^= 0x80000000;
}
if(n==0) return(__ieee754_j0f(x));
if(n==1) return(__ieee754_j1f(x));
sgn = (n&1)&(hx>>31);
x = fabsf(x);
if(((ix)==0)||((ix)==0x7f800000L))
b = zero;
else if((float)n<=x) {
a = __ieee754_j0f(x);
b = __ieee754_j1f(x);
for(i=1;i<n;i++){
temp = b;
b = b*((float)(i+i)/x) - a;
a = temp;
}
} else {
if(ix<0x30800000) {
if(n>33)
b = zero;
else {
temp = x*(float)0.5; b = temp;
for (a=one,i=2;i<=n;i++) {
a *= (float)i;
b *= temp;
}
b = b/a;
}
} else {
# 116 "../../../../../../srcw/newlib/libm/math/ef_jn.c"
float t,v;
float q0,q1,h,tmp; __int32_t k,m;
w = (n+n)/(float)x; h = (float)2.0/(float)x;
q0 = w; z = w+h; q1 = w*z - (float)1.0; k=1;
while(q1<(float)1.0e9) {
k += 1; z += h;
tmp = z*q1 - q0;
q0 = q1;
q1 = tmp;
}
m = n+n;
for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
a = t;
b = one;
# 138 "../../../../../../srcw/newlib/libm/math/ef_jn.c"
tmp = n;
v = two/x;
tmp = tmp*__ieee754_logf(fabsf(v*tmp));
if(tmp<(float)8.8721679688e+01) {
for(i=n-1,di=(float)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
}
} else {
for(i=n-1,di=(float)(i+i);i>0;i--){
temp = b;
b *= di;
b = b/x - a;
a = temp;
di -= two;
if(b>(float)1e10) {
a /= b;
t /= b;
b = one;
}
}
}
b = (t*__ieee754_j0f(x)/b);
}
}
if(sgn==1) return -b; else return b;
}
float __ieee754_ynf(int n, float x)
{
__int32_t i,hx,ix,ib;
__int32_t sign;
float a, b, temp;
do { ieee_float_shape_type gf_u; gf_u.value = (x); (hx) = gf_u.word; } while (0);
ix = 0x7fffffff&hx;
if(((ix)>0x7f800000L)) return x+x;
if(((ix)==0)) return -one/zero;
if(hx<0) return zero/zero;
sign = 1;
if(n<0){
n = -n;
sign = 1 - ((n&1)<<1);
}
if(n==0) return(__ieee754_y0f(x));
if(n==1) return(sign*__ieee754_y1f(x));
if(((ix)==0x7f800000L)) return zero;
a = __ieee754_y0f(x);
b = __ieee754_y1f(x);
do { ieee_float_shape_type gf_u; gf_u.value = (b); (ib) = gf_u.word; } while (0);
for(i=1;i<n&&ib!=0xff800000;i++){
temp = b;
b = ((float)(i+i)/x)*b - a;
do { ieee_float_shape_type gf_u; gf_u.value = (b); (ib) = gf_u.word; } while (0);
a = temp;
}
if(sign>0) return b; else return -b;
}