OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [g77/] [dnrm2.f] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
c { dg-do run }
2
CCC g77 0.5.21 `Actual Bugs':
3
CCC   * A code-generation bug afflicts Intel x86 targets when `-O2' is
4
CCC     specified compiling, for example, an old version of the `DNRM2'
5
CCC     routine.  The x87 coprocessor stack is being somewhat mismanaged
6
CCC     in cases where assigned `GOTO' and `ASSIGN' are involved.
7
CCC
8
CCC     Version 0.5.21 of `g77' contains an initial effort to fix the
9
CCC     problem, but this effort is incomplete, and a more complete fix is
10
CCC     planned for the next release.
11
 
12
C     Currently this test fails with (at least) `-O2 -funroll-loops' on
13
C     i586-unknown-linux-gnulibc1.
14
 
15
C     (This is actually an obsolete version of dnrm2 -- consult the
16
c     current Netlib BLAS.)
17
 
18
      integer i
19
      double precision a(1:100), dnrm2
20
      do i=1,100
21
         a(i)=0.D0
22
      enddo
23
      if (dnrm2(100,a,1) .ne. 0.0) call abort
24
      end
25
 
26
      double precision function dnrm2 ( n, dx, incx)
27
      integer i, incx, ix, j, n, next
28
      double precision   dx(1), cutlo, cuthi, hitest, sum, xmax,zero,one
29
      data   zero, one /0.0d0, 1.0d0/
30
      data cutlo, cuthi / 8.232d-11,  1.304d19 /
31
      j = 0
32
      if(n .gt. 0 .and. incx.gt.0) go to 10
33
         dnrm2  = zero
34
         go to 300
35
   10 assign 30 to next ! { dg-warning "ASSIGN" "" }
36
      sum = zero
37
      i = 1
38
      ix = 1
39
   20    go to next,(30, 50, 70, 110) ! { dg-warning "Assigned GOTO" "" }
40
   30 if( dabs(dx(i)) .gt. cutlo) go to 85
41
      assign 50 to next ! { dg-warning "ASSIGN" "" }
42
      xmax = zero
43
   50 if( dx(i) .eq. zero) go to 200
44
      if( dabs(dx(i)) .gt. cutlo) go to 85
45
      assign 70 to next ! { dg-warning "ASSIGN" "" }
46
      go to 105
47
  100 continue
48
      ix = j
49
      assign 110 to next ! { dg-warning "ASSIGN" "" }
50
      sum = (sum / dx(i)) / dx(i)
51
  105 xmax = dabs(dx(i))
52
      go to 115
53
   70 if( dabs(dx(i)) .gt. cutlo ) go to 75
54
  110 if( dabs(dx(i)) .le. xmax ) go to 115
55
         sum = one + sum * (xmax / dx(i))**2
56
         xmax = dabs(dx(i))
57
         go to 200
58
  115 sum = sum + (dx(i)/xmax)**2
59
      go to 200
60
   75 sum = (sum * xmax) * xmax
61
   85 hitest = cuthi/float( n )
62
      do 95 j = ix,n
63
      if(dabs(dx(i)) .ge. hitest) go to 100
64
         sum = sum + dx(i)**2
65
         i = i + incx
66
   95 continue
67
      dnrm2 = dsqrt( sum )
68
      go to 300
69
  200 continue
70
      ix = ix + 1
71
      i = i + incx
72
      if( ix .le. n ) go to 20
73
      dnrm2 = xmax * dsqrt(sum)
74
  300 continue
75
      end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.